From daniel at coder.com Tue Oct 18 14:31:22 2005 From: daniel at coder.com (Daniel R. Allen) Date: Tue, 18 Oct 2005 17:31:22 -0400 (EDT) Subject: [kw-pm] Meeting this Thursday, 7pm Message-ID: Thursday, October 20, 2005 Matt Sargeant will talk about POE [1], a framework for creating event-driven multitasking programs in Perl. Hope to see you Thursday! -Daniel [1] http://poe.perl.org/?What_POE_Is From daniel at coder.com Tue Oct 18 14:39:33 2005 From: daniel at coder.com (Daniel R. Allen) Date: Tue, 18 Oct 2005 17:39:33 -0400 (EDT) Subject: [kw-pm] Meeting this Thursday, 7pm In-Reply-To: Message-ID: Oops, forgot the pizza-reminder. I'm sponsoring the pizza 'n pop this month; add your name to http://kw.pm.org/wiki/index.cgi?PizzaList if you want in on slicezz. -Daniel On Tue, 18 Oct 2005, Daniel R. Allen wrote: > Thursday, October 20, 2005 > > Matt Sargeant will talk about POE [1], a framework for creating > event-driven multitasking programs in Perl. > > Hope to see you Thursday! -Daniel > > [1] http://poe.perl.org/?What_POE_Is From matt at sergeant.org Fri Oct 21 06:11:24 2005 From: matt at sergeant.org (Matt Sergeant) Date: Fri, 21 Oct 2005 09:11:24 -0400 Subject: [kw-pm] POE Slides Message-ID: http://axkit.org/docs/presentations/tpc2002/ (including other talks, and the demos). From daniel at coder.com Fri Oct 21 10:43:35 2005 From: daniel at coder.com (Daniel R. Allen) Date: Fri, 21 Oct 2005 13:43:35 -0400 (EDT) Subject: [kw-pm] POE Slides In-Reply-To: Message-ID: Thanks Matt, both for the excellent talk and for the slides. Now I've got visions of cooperatively multitasking IRCbots dancing in my brain. And various other, possibly more useful tools as well. I notice there's a POE component for Asterisk manager events, even. -Daniel On Fri, 21 Oct 2005, Matt Sergeant wrote: > http://axkit.org/docs/presentations/tpc2002/ (including other talks, > and the demos). > > _______________________________________________ > kw-pm mailing list > kw-pm at pm.org > http://mail.pm.org/mailman/listinfo/kw-pm > From rpjday at mindspring.com Thu Oct 27 10:51:01 2005 From: rpjday at mindspring.com (Robert P. J. Day) Date: Thu, 27 Oct 2005 13:51:01 -0400 (EDT) Subject: [kw-pm] potentially dumb perl question regarding packages Message-ID: some perl code i've inherited has a number of ".pl" files with the following structure -- consider a sample file fred.pl: ============================= #!/usr/bin/perl ... package fred; ... executable code ... 1; ============================== i understand the concept of defining a package name in a .pm file, but this is just a regular executable file and it doesn't appear to need to be part of any package. what is the rationale for defining a package for a top-level executable file? rday p.s. this file *does* "use" a number of module files, but they have no relation to the above package name in any way. From abez at abez.ca Thu Oct 27 11:04:25 2005 From: abez at abez.ca (abez) Date: Thu, 27 Oct 2005 14:04:25 -0400 (EDT) Subject: [kw-pm] potentially dumb perl question regarding packages In-Reply-To: Message-ID: Packages are used to create modules, you don't need to make PM files to use packages. Some applications, like classes, require packages to handle namespace issues. Did they use base or modify the @ISA array in that fred package? On Thu, 27 Oct 2005, Robert P. J. Day wrote: > > some perl code i've inherited has a number of ".pl" files with the > following structure -- consider a sample file fred.pl: > > ============================= > > #!/usr/bin/perl > ... > > package fred; > > ... executable code ... > > 1; > > ============================== > > i understand the concept of defining a package name in a .pm file, > but this is just a regular executable file and it doesn't appear to > need to be part of any package. > > what is the rationale for defining a package for a top-level > executable file? > > rday > > p.s. this file *does* "use" a number of module files, but they have > no relation to the above package name in any way. > _______________________________________________ > kw-pm mailing list > kw-pm at pm.org > http://mail.pm.org/mailman/listinfo/kw-pm > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez at abez.ca) ------------------------------------------ abez From rpjday at mindspring.com Thu Oct 27 11:17:07 2005 From: rpjday at mindspring.com (Robert P. J. Day) Date: Thu, 27 Oct 2005 14:17:07 -0400 (EDT) Subject: [kw-pm] potentially dumb perl question regarding packages In-Reply-To: References: Message-ID: On Thu, 27 Oct 2005, abez wrote: > Packages are used to create modules, you don't need to make PM files > to use packages. Some applications, like classes, require packages > to handle namespace issues. Did they use base or modify the @ISA > array in that fred package? nope. in fact, i deleted the package definition in one of those files and everything worked just fine. a recursive grep showed that nothing else in the entire source used that package name. rday From john at perlwolf.com Thu Oct 27 12:01:14 2005 From: john at perlwolf.com (John Macdonald) Date: Thu, 27 Oct 2005 15:01:14 -0400 Subject: [kw-pm] potentially dumb perl question regarding packages In-Reply-To: References: Message-ID: <20051027190114.GA10042@lupus.perlwolf.com> The .pl extension stands for Perl Library and it was used back in perl 4 days - before packages and modules were invented. They still work, of course. Specifying a package name in top level code makes subsequent global names default to that package instead of the default "main" package. So, any subroutines defined after the package statement, or any global variables referenced will be in that package. If there are any uses of "fred::foo" (or the older variant "fred'foo") in the other files, they refer to the variable or subroutine named "foo" defined in the package "fred". If there are no such references, then the package declaration was probably being used to make the variables/subroutines used in that code be separate from variables/subroutines of teh same name in other files. (And the programmer learned perl in the days before the "my" declaration was added to the language and hadn't gotten around to using that new-fangled invention yet. :-) On Thu, Oct 27, 2005 at 01:51:01PM -0400, Robert P. J. Day wrote: > > some perl code i've inherited has a number of ".pl" files with the > following structure -- consider a sample file fred.pl: > > ============================= > > #!/usr/bin/perl > ... > > package fred; > > ... executable code ... > > 1; > > ============================== > > i understand the concept of defining a package name in a .pm file, > but this is just a regular executable file and it doesn't appear to > need to be part of any package. > > what is the rationale for defining a package for a top-level > executable file? > > rday > > p.s. this file *does* "use" a number of module files, but they have > no relation to the above package name in any way. > _______________________________________________ > kw-pm mailing list > kw-pm at pm.org > http://mail.pm.org/mailman/listinfo/kw-pm -- From rpjday at mindspring.com Thu Oct 27 11:26:01 2005 From: rpjday at mindspring.com (Robert P. J. Day) Date: Thu, 27 Oct 2005 14:26:01 -0400 (EDT) Subject: [kw-pm] potentially dumb perl question regarding packages In-Reply-To: <20051027190114.GA10042@lupus.perlwolf.com> References: <20051027190114.GA10042@lupus.perlwolf.com> Message-ID: On Thu, 27 Oct 2005, John Macdonald wrote: > The .pl extension stands for Perl Library and it was used back in > perl 4 days - before packages and modules were invented. They still > work, of course. Specifying a package name in top level code makes > subsequent global names default to that package instead of the > default "main" package. So, any subroutines defined after the > package statement, or any global variables referenced will be in > that package. If there are any uses of "fred::foo" (or the older > variant "fred'foo") in the other files, they refer to the variable > or subroutine named "foo" defined in the package "fred". If there > are no such references, then the package declaration was probably > being used to make the variables/subroutines used in that code be > separate from variables/subroutines of teh same name in other files. > (And the programmer learned perl in the days before the "my" > declaration was added to the language and hadn't gotten around to > using that new-fangled invention yet. :-) in short, in my context, it doesn't *hurt* but it has no value. rday From da at coder.com Thu Oct 27 11:35:13 2005 From: da at coder.com (Daniel R. Allen) Date: Thu, 27 Oct 2005 14:35:13 -0400 (EDT) Subject: [kw-pm] potentially dumb perl question regarding packages In-Reply-To: Message-ID: On Thu, 27 Oct 2005, Robert P. J. Day wrote: > in short, in my context, it doesn't *hurt* but it has no value. Conceivably there could have been variable collisions between namespaces. But given what you've said, that's the only thing I'd have worried about. ...you can thank your lucky stars how backward compatible perl has been :) -Daniel From quantum.mechanic.1964 at gmail.com Thu Oct 27 13:45:04 2005 From: quantum.mechanic.1964 at gmail.com (Quantum Mechanic) Date: Thu, 27 Oct 2005 16:45:04 -0400 Subject: [kw-pm] potentially dumb perl question regarding packages In-Reply-To: References: Message-ID: <77f3972e0510271345j3293899fu5f951ceaf321233c@mail.gmail.com> To broach a pun, the author may have been "packaging" a number of modules into a single file, simply by concatenating the files together. That would also help explain the "1;" in your example. On 10/27/05, Robert P. J. Day wrote: > > > some perl code i've inherited has a number of ".pl" files with the > following structure -- consider a sample file fred.pl: > > ============================= > > #!/usr/bin/perl > ... > > package fred; > > ... executable code ... > > 1; > > ============================== > > i understand the concept of defining a package name in a .pm file, > but this is just a regular executable file and it doesn't appear to > need to be part of any package. > > what is the rationale for defining a package for a top-level > executable file? > > rday > > p.s. this file *does* "use" a number of module files, but they have > no relation to the above package name in any way. > _______________________________________________ > kw-pm mailing list > kw-pm at pm.org > http://mail.pm.org/mailman/listinfo/kw-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/kw-pm/attachments/20051027/c99ce479/attachment.html From rdice at pobox.com Thu Oct 27 14:28:29 2005 From: rdice at pobox.com (Richard Dice) Date: Thu, 27 Oct 2005 17:28:29 -0400 Subject: [kw-pm] potentially dumb perl question regarding packages In-Reply-To: <77f3972e0510271345j3293899fu5f951ceaf321233c@mail.gmail.com> References: <77f3972e0510271345j3293899fu5f951ceaf321233c@mail.gmail.com> Message-ID: <1130448509.4361467d549ef@webmail.tht.net> Quoting Quantum Mechanic : > To broach a pun, the author may have been "packaging" a number of modules > into a single file, simply by concatenating the files together. That would > also help explain the "1;" in your example. That's a thought, but I figure it's probably more a mis-understanding of the nature of packages / modules / classes (at least, what it takes for them to work) on the part of the original author. The reason why .pm files end (most often) in "1;" is because it is needed by the "use" (or "require") command. That is, if the terminal executable line of the .pm file isn't a true value then "use" considers this to mean that the attempt to use the file failed, and therefore use dies and kills the program at compile-time. But in this case, there should be no "use" statement in the program, i.e. fred.pl doesn't have a "use fred;" line in it. And yet, assuming that "package fred" is set up to implement a class, my $newfred = fred->new(); should still work even though no 'use fred;' was previously called. This is because "package fred" further down in the file creates the "fred" namespace, in which the stuff which semantically implements the class is founds. Cheers, Richard > On 10/27/05, Robert P. J. Day wrote: > > > > > > some perl code i've inherited has a number of ".pl" files with the > > following structure -- consider a sample file fred.pl: > > > > ============================= > > > > #!/usr/bin/perl > > ... > > > > package fred; > > > > ... executable code ... > > > > 1; > > > > ============================== > > > > i understand the concept of defining a package name in a .pm file, > > but this is just a regular executable file and it doesn't appear to > > need to be part of any package. > > > > what is the rationale for defining a package for a top-level > > executable file? > > > > rday > > > > p.s. this file *does* "use" a number of module files, but they have > > no relation to the above package name in any way. > > _______________________________________________ > > kw-pm mailing list > > kw-pm at pm.org > > http://mail.pm.org/mailman/listinfo/kw-pm > > > ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ From john at perlwolf.com Thu Oct 27 19:50:46 2005 From: john at perlwolf.com (John Macdonald) Date: Thu, 27 Oct 2005 22:50:46 -0400 Subject: [kw-pm] potentially dumb perl question regarding packages In-Reply-To: References: <20051027190114.GA10042@lupus.perlwolf.com> Message-ID: <20051028025046.GA13804@lupus.perlwolf.com> On Thu, Oct 27, 2005 at 02:26:01PM -0400, Robert P. J. Day wrote: > On Thu, 27 Oct 2005, John Macdonald wrote: > > > The .pl extension stands for Perl Library and it was used back in > > perl 4 days - before packages and modules were invented. They still > > work, of course. Specifying a package name in top level code makes > > subsequent global names default to that package instead of the > > default "main" package. So, any subroutines defined after the > > package statement, or any global variables referenced will be in > > that package. If there are any uses of "fred::foo" (or the older > > variant "fred'foo") in the other files, they refer to the variable > > or subroutine named "foo" defined in the package "fred". If there > > are no such references, then the package declaration was probably > > being used to make the variables/subroutines used in that code be > > separate from variables/subroutines of teh same name in other files. > > (And the programmer learned perl in the days before the "my" > > declaration was added to the language and hadn't gotten around to > > using that new-fangled invention yet. :-) > > in short, in my context, it doesn't *hurt* but it has no value. If any of the code elsewhere uses global variables with common names, then removing the package declaration might lead to errors as two separate pieces of code use the same variable for two different purposes, and that could hurt. --