From rdice at pobox.com Thu Oct 4 12:16:36 2007 From: rdice at pobox.com (Richard Dice) Date: Thu, 4 Oct 2007 15:16:36 -0400 Subject: [tpm] Fwd: The Pittsburgh Perl Workshop 2007 is October 13-14, 2007. In-Reply-To: <470523B6.8080902@robertblackwell.com> References: <470523B6.8080902@robertblackwell.com> Message-ID: <5bef4baf0710041216o1d99e997j42e25089eba3c789@mail.gmail.com> Hi everyone, PPW is coming up - it's good stuff! Cheers, Richard ---------- Forwarded message ---------- From: Robert Blackwell Date: Oct 4, 2007 1:32 PM Subject: The Pittsburgh Perl Workshop 2007 is October 13-14, 2007. To: ppw-announce at googlegroups.com Please pass it along the Pittsburgh Perl Workshop is fast approaching. The Pittsburgh Perl Mongers are pleased to announce The PITTSBURGH PERL WORKSHOP, a two-day, low-cost conference on Saturday and Sunday, October 13-14, 2007. The Pittsburgh Perl Workshop is an annual conference dedicated to the Perl programming language. In 2006, the Pittsburgh Perl Mongers hosted the first Perl Workshop based in the United States. This year, the Workshop has been expanded to two days. The 2007 Workshop is structured as a series of short lectures, but the atmosphere is low key and engaging: the perfect combination to open your mind and then cram it full of good stuff. After last year's conference you gave us lots of feedback, and we listened. * The workshop was expanded to a two-day event to allow for more talks, birds-of-a-feather sessions, and social interactions. * A one-day course for programmers with little or no Perl experience---taught by a world-class Perl trainer---was added. * The schedule has been improved to allow you more flexibility in choosing sessions to attend. Lightning Talks There's still time to get a third of your fifteen minutes of fame! Submit your lightning talk today. The deadline for early acceptance is one week before the conference (October 6). But if you have an idea on the first day of the conference, we're holding at least two lightning talk spots until the end of that day. However, you have a much better chance of being accepted if submit your talk now. Stay up to date with everything that's going on with the Perl Workshop by subscribing to our RSS feed at http://pghpw.org/ppw2007/atom/en.xml. If you are coming to the Friday Social, RSVP at http://pghpw.org/ppw2007/wiki?node=Friday%20Social. Full details are on the Workshop Web site at http://pghpw.org. Hope to see you there. Robert Blackwell --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Pittsburgh Perl Workshop Announce" group. To post to this group, send email to ppw-announce at googlegroups.com To unsubscribe from this group, send email to ppw-announce-unsubscribe at googlegroups.com For more options, visit this group at http://groups.google.com/group/ppw-announce?hl=en -~----------~----~----~----~------~----~------~--~--- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20071004/80733356/attachment.html From psema4 at gmail.com Fri Oct 5 13:43:20 2007 From: psema4 at gmail.com (Scott Elcomb) Date: Fri, 5 Oct 2007 16:43:20 -0400 Subject: [tpm] Is it possible to get a $coderef to an object method? Message-ID: <99a6c38f0710051343s502f4397r71b1452c410f645a@mail.gmail.com> Hi all, I'd like to create a very lightweight MVC architecture using plugins. I'm not sure if I'm barking up the right tree with this, but aside from one issue it seems the idea should be doable. I've looked at Maypole and Catalyst, but they have far too many dependencies for my clients' tastes. What I'm trying to do with the "mvcplugs" POC is dead simple: drop a plugin object (containing a combination of model/view/controller methods) into the plugin directory ("MVCPlugs") and have it automatically load/register when the main script ("mvcplugs.pl") runs. Currently this doesn't do much beyond loading/registering an explicit list of plugins. The problem shows up when I try to register the model/view/controller method coderefs in %registry. In the output sample (bottom of post) the coderefs showup as "DUMMY" subs. Is there a way to get valid coderefs or am I headed in the wrong direction? Thanks in advance, - Scott. #// START OF mvcplugs.pl //# #!/usr/bin/perl use strict; use Data::Dumper; ################################################### # CONFIG (Should read in from file or CLI args) # my @plugins = qw[Core PluginTemplate TestPlugin]; my $verbose = 1; ################################################### my %registry = ( 'plugins' => {}, 'models' => {}, 'views' => {}, 'controllers' => {} ); foreach my $n (@plugins) { my $instantiatePlugin = "use MVCPlugs::$n; return MVCPlugs::$n" . '->new()'; my $plugin = eval($instantiatePlugin); my $name = $plugin->name($n); %registry->{'plugins'}->{$name} = $plugin; if ($verbose) { print "[mvcplugs.pl] Plugin Instantiation String: $instantiatePlugin\n"; print "[mvcplugs.pl] Plugin Instantiaion: $plugin\n"; } if ( %registry->{'plugins'}->{$name}->initPlugin(\%registry) ) { print qq[Plugin $name initialized.\n]; } else { print qq[Plugin $name initialization failed!\n]; } } if ($verbose) { print "\n[mvcplugs.pl] Dumping Registry:\n" . Dumper(%registry) . "\n\n"; } #// END OF mvcplugs.pl //# #// START OF MVCPlugs/TestPlugin.pm //# package MVCPlugs::TestPlugin; use strict; no strict 'refs'; use Data::Dumper; sub new { my $self = {}; $self->{'NAME'} = 'TEST_PLUGIN'; bless($self); return $self; } sub name { my $self = shift; if (@_) { $self->{'NAME'} = shift } return $self->{'NAME'}; } sub registry { my $self = shift; if (@_) { $self->{'REGISTRY'} = shift } return $self->{'REGISTRY'}; } sub initPlugin { my $self = shift; my $registryref = shift; ###################### # This block and the associated "coderefTest" methods are the only # differences from the Core.pm & PluginTemplate.pm sample plugins # # register a model, view, and controller $registryref->{'models'}->{'TestModel'} = \&coderefTest1; $registryref->{'views'}->{'TestView'} = sub { my $self = shift; $self->coderefTest2(); }; $registryref->{'controllers'}->{'TestController'} = \&coderefTest3; ###################### return 1; } sub coderefTest1 { my $self = shift; return 'coderefTest1: call success!'; } sub coderefTest2 { my $self = shift; return 'coderefTest2: call success!'; } sub coderefTest3 { my $self = shift; return 'coderefTest3: call success!'; } 1; #// END OF MVCPlugs/TestPlugin.pm //# #// START OF Sample Output (VERBOSE=1)//# [mvcplugs.pl] Plugin Instantiation String: use MVCPlugs::Core; return MVCPlugs::Core->new() [mvcplugs.pl] Plugin Instantiaion: MVCPlugs::Core=HASH(0x81d77e0) Plugin Core initialized. [mvcplugs.pl] Plugin Instantiation String: use MVCPlugs::PluginTemplate; return MVCPlugs::PluginTemplate->new() [mvcplugs.pl] Plugin Instantiaion: MVCPlugs::PluginTemplate=HASH(0x81d77f8) Plugin PluginTemplate initialized. [mvcplugs.pl] Plugin Instantiation String: use MVCPlugs::TestPlugin; return MVCPlugs::TestPlugin->new() [mvcplugs.pl] Plugin Instantiaion: MVCPlugs::TestPlugin=HASH(0x81d7810) Plugin TestPlugin initialized. [mvcplugs.pl] Dumping Registry: $VAR1 = 'models'; $VAR2 = { 'TestModel' => sub { "DUMMY" } }; $VAR3 = 'controllers'; $VAR4 = { 'TestController' => sub { "DUMMY" } }; $VAR5 = 'views'; $VAR6 = { 'TestView' => sub { "DUMMY" } }; $VAR7 = 'plugins'; $VAR8 = { 'PluginTemplate' => bless( { 'NAME' => 'PluginTemplate' }, 'MVCPlugs::PluginTemplate' ), 'TestPlugin' => bless( { 'NAME' => 'TestPlugin' }, 'MVCPlugs::TestPlugin' ), 'Core' => bless( { 'NAME' => 'Core' }, 'MVCPlugs::Core' ) }; -- Scott Elcomb http://www.psema4.com/ From sdmeisner at yahoo.com Fri Oct 5 14:18:59 2007 From: sdmeisner at yahoo.com (Sean Meisner) Date: Fri, 5 Oct 2007 14:18:59 -0700 (PDT) Subject: [tpm] Is it possible to get a $coderef to an object method? In-Reply-To: <99a6c38f0710051343s502f4397r71b1452c410f645a@mail.gmail.com> Message-ID: <811218.18592.qm@web53010.mail.re2.yahoo.com> The "DUMMY" string is actually coming from Data::Dumper. It won't show coderefs by default. Try setting the Deparse flag for Data::Dumper. Cheers, Sean --- Scott Elcomb wrote: > Hi all, > > I'd like to create a very lightweight MVC > architecture using plugins. > I'm not sure if I'm barking up the right tree with > this, but aside > from one issue it seems the idea should be doable. > > I've looked at Maypole and Catalyst, but they have > far too many > dependencies for my clients' tastes. What I'm > trying to do with the > "mvcplugs" POC is dead simple: drop a plugin object > (containing a > combination of model/view/controller methods) into > the plugin > directory ("MVCPlugs") and have it automatically > load/register when > the main script ("mvcplugs.pl") runs. > > Currently this doesn't do much beyond > loading/registering an explicit > list of plugins. The problem shows up when I try to > register the > model/view/controller method coderefs in %registry. > In the output > sample (bottom of post) the coderefs showup as > "DUMMY" subs. > > Is there a way to get valid coderefs or am I headed > in the wrong direction? > > Thanks in advance, > - Scott. > > > #// START OF mvcplugs.pl //# > #!/usr/bin/perl > > use strict; > use Data::Dumper; > > ################################################### > # CONFIG (Should read in from file or CLI args) > # > my @plugins = qw[Core PluginTemplate TestPlugin]; > my $verbose = 1; > ################################################### > > my %registry = ( > 'plugins' => {}, > 'models' => {}, > 'views' => {}, > 'controllers' => {} > ); > > foreach my $n (@plugins) { > my $instantiatePlugin = "use MVCPlugs::$n; return > MVCPlugs::$n" . '->new()'; > my $plugin = eval($instantiatePlugin); > my $name = $plugin->name($n); > > %registry->{'plugins'}->{$name} = $plugin; > > if ($verbose) { > print "[mvcplugs.pl] Plugin Instantiation > String: $instantiatePlugin\n"; > print "[mvcplugs.pl] Plugin Instantiaion: > $plugin\n"; > } > > if ( > %registry->{'plugins'}->{$name}->initPlugin(\%registry) > ) { > print qq[Plugin $name initialized.\n]; > } else { > print qq[Plugin $name initialization failed!\n]; > } > > } > > if ($verbose) { > print "\n[mvcplugs.pl] Dumping Registry:\n" . > Dumper(%registry) . "\n\n"; > } > #// END OF mvcplugs.pl //# > > > > #// START OF MVCPlugs/TestPlugin.pm //# > package MVCPlugs::TestPlugin; > use strict; > no strict 'refs'; > use Data::Dumper; > > sub new { > my $self = {}; > $self->{'NAME'} = 'TEST_PLUGIN'; > bless($self); > return $self; > } > > sub name { > my $self = shift; > if (@_) { $self->{'NAME'} = shift } > return $self->{'NAME'}; > } > > sub registry { > my $self = shift; > if (@_) { $self->{'REGISTRY'} = shift } > return $self->{'REGISTRY'}; > } > > sub initPlugin { > my $self = shift; > my $registryref = shift; > > ###################### > # This block and the associated "coderefTest" > methods are the only > # differences from the Core.pm & PluginTemplate.pm > sample plugins > # > # register a model, view, and controller > $registryref->{'models'}->{'TestModel'} = > \&coderefTest1; > $registryref->{'views'}->{'TestView'} = sub { my > $self = shift; > $self->coderefTest2(); }; > $registryref->{'controllers'}->{'TestController'} > = \&coderefTest3; > ###################### > > return 1; > } > > sub coderefTest1 { > my $self = shift; > return 'coderefTest1: call success!'; > } > > sub coderefTest2 { > my $self = shift; > return 'coderefTest2: call success!'; > } > > sub coderefTest3 { > my $self = shift; > return 'coderefTest3: call success!'; > } > > 1; > #// END OF MVCPlugs/TestPlugin.pm //# > > > #// START OF Sample Output (VERBOSE=1)//# > [mvcplugs.pl] Plugin Instantiation String: use > MVCPlugs::Core; return > MVCPlugs::Core->new() > [mvcplugs.pl] Plugin Instantiaion: > MVCPlugs::Core=HASH(0x81d77e0) > Plugin Core initialized. > [mvcplugs.pl] Plugin Instantiation String: use > MVCPlugs::PluginTemplate; return > MVCPlugs::PluginTemplate->new() > [mvcplugs.pl] Plugin Instantiaion: > MVCPlugs::PluginTemplate=HASH(0x81d77f8) > Plugin PluginTemplate initialized. > [mvcplugs.pl] Plugin Instantiation String: use > MVCPlugs::TestPlugin; > return MVCPlugs::TestPlugin->new() > [mvcplugs.pl] Plugin Instantiaion: > MVCPlugs::TestPlugin=HASH(0x81d7810) > Plugin TestPlugin initialized. > > [mvcplugs.pl] Dumping Registry: > $VAR1 = 'models'; > $VAR2 = { > 'TestModel' => sub { "DUMMY" } > }; > $VAR3 = 'controllers'; > $VAR4 = { > 'TestController' => sub { "DUMMY" } > }; > $VAR5 = 'views'; > $VAR6 = { > 'TestView' => sub { "DUMMY" } > }; > $VAR7 = 'plugins'; > $VAR8 = { > 'PluginTemplate' => bless( { > 'NAME' => > 'PluginTemplate' > }, > 'MVCPlugs::PluginTemplate' ), > 'TestPlugin' => bless( { > 'NAME' => > 'TestPlugin' > }, > 'MVCPlugs::TestPlugin' ), > === message truncated === From psema4 at gmail.com Fri Oct 5 15:03:29 2007 From: psema4 at gmail.com (Scott Elcomb) Date: Fri, 5 Oct 2007 18:03:29 -0400 Subject: [tpm] Is it possible to get a $coderef to an object method? In-Reply-To: <811218.18592.qm@web53010.mail.re2.yahoo.com> References: <99a6c38f0710051343s502f4397r71b1452c410f645a@mail.gmail.com> <811218.18592.qm@web53010.mail.re2.yahoo.com> Message-ID: <99a6c38f0710051503r70b62b6ao1276472b352b901@mail.gmail.com> On 10/5/07, Sean Meisner wrote: > The "DUMMY" string is actually coming from > Data::Dumper. It won't show coderefs by default. Try > setting the Deparse flag for Data::Dumper. Yup, that did it. Many thanks. - Scott. -- Scott Elcomb http://www.psema4.com/ From psema4 at gmail.com Sun Oct 7 11:03:38 2007 From: psema4 at gmail.com (Scott Elcomb) Date: Sun, 7 Oct 2007 14:03:38 -0400 Subject: [tpm] Is it possible to get a $coderef to an object method? In-Reply-To: <99a6c38f0710051343s502f4397r71b1452c410f645a@mail.gmail.com> References: <99a6c38f0710051343s502f4397r71b1452c410f645a@mail.gmail.com> Message-ID: <99a6c38f0710071103q12ef2e57k5659a4f24377bff3@mail.gmail.com> On 10/5/07, Scott Elcomb wrote: > I'd like to create a very lightweight MVC architecture using plugins. I haven't had a chance to write anything in regards to documentation - on my way to a meeting with Turkey ;-) - but a working POC is available[1]. Any and all comments regarding the source would be most appreciated; I'm sure it could be written better. If nobody minds, I'll have some questions in the next few days about best-practice approaches. Take care all, and happy Thanks Giving. :-) - Scott. [1] Download: http://projects.psema4.com/mvcplugs/mvcplugs-0.0-7.tar.gz [2] Live: http://projects.psema4.com/mvcplugs/mvcplugs.cgi?view=DefaultView2 -- Scott Elcomb http://www.psema4.com/ From tom at legrady.ca Sun Oct 7 15:26:39 2007 From: tom at legrady.ca (Tom Legrady) Date: Sun, 7 Oct 2007 18:26:39 -0400 Subject: [tpm] Is it possible to get a $coderef to an object method? In-Reply-To: <99a6c38f0710071103q12ef2e57k5659a4f24377bff3@mail.gmail.com> References: <99a6c38f0710051343s502f4397r71b1452c410f645a@mail.gmail.com> <99a6c38f0710071103q12ef2e57k5659a4f24377bff3@mail.gmail.com> Message-ID: <61CC3F9C-7DC0-4B04-AC90-7C89CEA55182@legrady.ca> Enjoy your dead turkey day Tom On 7-Oct-07, at 2:03 PM, Scott Elcomb wrote: > On 10/5/07, Scott Elcomb wrote: >> I'd like to create a very lightweight MVC architecture using plugins. > > I haven't had a chance to write anything in regards to documentation - > on my way to a meeting with Turkey ;-) - but a working POC is > available[1]. > > Any and all comments regarding the source would be most appreciated; > I'm sure it could be written better. If nobody minds, I'll have some > questions in the next few days about best-practice approaches. > > Take care all, and happy Thanks Giving. :-) > - Scott. > > > [1] Download: http://projects.psema4.com/mvcplugs/ > mvcplugs-0.0-7.tar.gz > [2] Live: http://projects.psema4.com/mvcplugs/mvcplugs.cgi? > view=DefaultView2 > > > -- > Scott Elcomb > http://www.psema4.com/ > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > Tom Legrady tom at legrady.ca My photo gallery ... http://picasaweb.google.com/legrady -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20071007/d528f1ff/attachment.html From psema4 at gmail.com Sun Oct 7 20:32:25 2007 From: psema4 at gmail.com (Scott Elcomb) Date: Sun, 7 Oct 2007 23:32:25 -0400 Subject: [tpm] Is it possible to get a $coderef to an object method? In-Reply-To: <61CC3F9C-7DC0-4B04-AC90-7C89CEA55182@legrady.ca> References: <99a6c38f0710051343s502f4397r71b1452c410f645a@mail.gmail.com> <99a6c38f0710071103q12ef2e57k5659a4f24377bff3@mail.gmail.com> <61CC3F9C-7DC0-4B04-AC90-7C89CEA55182@legrady.ca> Message-ID: <99a6c38f0710072032t35b3fe45xd831cc92dfcadae3@mail.gmail.com> On 10/7/07, Tom Legrady wrote: > Enjoy your dead turkey day Heh, thanks. :-) I love dead Turkey. And dead plants. And all the live "bugs" (bacteria) that let me digest the dead stuff I get to eat. Lol. Yup, I thank all the live and dead things that let me keep on keeping on. Gotta hope that Simba'll be proud. ;-) -- Scott Elcomb http://www.psema4.com/ From samogon at gmail.com Tue Oct 9 09:23:42 2007 From: samogon at gmail.com (Ilia) Date: Tue, 9 Oct 2007 12:23:42 -0400 Subject: [tpm] slides and source code for the Online Banking talk Message-ID: Slides: http://nurey.com/bankelf_talk/bankelf_talk.pdf Screencast: http://nurey.com/bankelf_talk/bankelf_screencast.divx The perl code: http://svn.nurey.com/byob/ The python code: http://svn.nurey.com/public/python_workarea/ Finance::Bank::PC and Finance::Bank::CIBC are not yet on CPAN, pending discussions at http://groups.google.com/group/finance-bank ilia. From jeff at pencom.com Fri Oct 12 08:09:48 2007 From: jeff at pencom.com (Jeffrey Apelian) Date: Fri, 12 Oct 2007 11:09:48 -0400 Subject: [tpm] Job opportunity Message-ID: <470F8E3C.2090608@pencom.com> Our client, is looking for a Perl Developer / Software Architect in their Production Build and Release Team. This team is engaged in several major projects involving the management of source code, build systems, and global software release cycles. They have a number of openings available in New York for Perl developers to work on new and exciting projects that will create the new architecture to manage my clients large-scale code bases, including both legacy code and new C and C++ componentized systems. Please note that these are not ?scripting? positions, but software engineering positions. We are looking for experienced Perl developers with knowledge of software configuration and build engineering to develop and support the existing build and release environment, as well as engineer brand new infrastructure to support the next generation of software development lifecycle (SDLC) tools and processes. Team members have a desire to design and deploy serious Perl infrastructure in a large-scale industrial environment. Qualifications Bachelor's Degree in Computer Science, Engineering or Related or Equivalent Experience 4+ years experience writing reusable Perl libraries (object-oriented Perl a plus) Good working knowledge of C and C++ development, in particular the use and configuration of compilers and linkers An understanding of software design and architecture as well as the ability to render designs in code Plus: Familiarity with the concept of physical design with refactoring large libraries, and with the basics of compiling and linking a large code base Experience with source control (e.g. CVS, Subversion) Experience with Unix platforms, especially Solaris, AIX, and Linux Excellent written and verbal communication skills The ability to work effectively as part of a team -- Jeffrey Apelian Pencom Systems Incorporated 40 Fulton Street, 18th Floor New York, NY 10038 jeff at pencom.com 212-513-7777 ext. 286 http://www.pencom.com/ -- Jeffrey Apelian Pencom Systems Incorporated 40 Fulton Street, 18th Floor New York, NY 10038 jeff at pencom.com 212-513-7777 ext. 286 http://www.pencom.com/ From dimitrio at perlnow.com Fri Oct 12 16:33:04 2007 From: dimitrio at perlnow.com (dmitri) Date: Fri, 12 Oct 2007 19:33:04 -0400 Subject: [tpm] slides and source code for the Online Banking talk In-Reply-To: References: Message-ID: <47100430.8090101@perlnow.com> pretty cool stuff! Ilia wrote: > Slides: http://nurey.com/bankelf_talk/bankelf_talk.pdf > Screencast: http://nurey.com/bankelf_talk/bankelf_screencast.divx > The perl code: http://svn.nurey.com/byob/ > The python code: http://svn.nurey.com/public/python_workarea/ > > Finance::Bank::PC and Finance::Bank::CIBC are not yet on CPAN, pending > discussions at http://groups.google.com/group/finance-bank > > ilia. > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > > > -- Dimitri Ostapenko LAMP developer/System Administrator d at perlnow.com From linux at alteeve.com Tue Oct 16 12:53:51 2007 From: linux at alteeve.com (Madison Kelly) Date: Tue, 16 Oct 2007 15:53:51 -0400 Subject: [tpm] File handle problem in a script called by another script Message-ID: <471516CF.1060002@alteeve.com> Hi all, I've got a program (main) that calls a second program (small), both written in perl. Both the main and small program access a common library. When I call the second, small program directly from the command line, it works fine. At one point it calls a subrouting from the library that opens a file, reads it and writes back out a modified version (specifically, it tracks various records and keeps track of a counter). Now, when I call the small program from within the main program, I get an error: -=-=-=-=- [] small_script.pl: Use of uninitialized value in concatenation (.) or string at ./nmc.lib line 1741. [] small_script.pl: readline() on closed filehandle GEN16 at ./nmc.lib line 1746. -=-=-=-=- Here, nmc.lib is the library. I use 'IO::Handle' for creating the filehandle used to write out the file. Here is the specific block of code that generates the error: nmc.lib lines 1069 - 1076 -=-=-=-=- # Now re-write the file. my $write_inc=IO::Handle->new(); open ($write_inc, ">$inc_file") || &error($conf, "error_0042", 1, 0, $this_file, __LINE__, $inc_file, $!); for (@lines) { print $write_inc $_; } $write_inc->close(); -=-=-=-=- If I comment out this section, the program works fine (but obviously, the file is not updated...). Again, if I run the small program directly, there is no problem, either. My *guess* is that for some reason, the filehandle created by the main program to read the output from the call to the second, small program must be clobbering the filehandle above. I can't understand why though, because they are different sections of code using different file handle names (though the code to call the second program IS in the same library). In case it matters, here is the code from the main program that calls the small program (cleaned up to make it more readable): nmc.lib lines 2266 - 2284 -=-=-=-=- my $gzf=IO::Handle->new(); my $shell_call=?/path/to/small_script.pl 2>&1 |"; # write to log what I am calling... open ($gzf, $shell_call) || die...; while (<$gzf>) { chomp; my $line=$_; # write to log this line... $line=~s/\[(.*?)\]/\[$1<\/span>\]/g; my %value=( replace_0 => "", replace_1 => "$line", ); &print_template($conf, "tool_item", $$conf{template_ga}, \%value); %value=(); } $gzf->close(); -=-=-=-=- Any idea why the second example code could be clobbering the first block of code (if that is what is even happening)? Thanks!! Madi From indy at indigostar.com Tue Oct 16 13:19:33 2007 From: indy at indigostar.com (Indy Singh) Date: Tue, 16 Oct 2007 16:19:33 -0400 Subject: [tpm] File handle problem in a script called by another script References: <471516CF.1060002@alteeve.com> Message-ID: <027f01c81031$ddc53530$6600a8c0@roadhog> The line numbers that you supplied code for (1069 - 1076) don't cover where you say the error is (line 1741) Assuming that that is just an oversight. It would probably be a good idea to print out the content of $inc_file to verify that it actually contains a valid file name and path. How do you know that there is something actually in @lines ? A print statement in the loop would be a good idea. How do you know that your error subroutine does actually print out something? How do you know that your error does NOT print out something? How do you know that your error does not return (and therby cause a cascading error). Rewrite the code, add print statements, remove calls to external functions if you cal (error, IO::Handle). Indy Singh IndigoSTAR Software -- www.indigostar.com ----- Original Message ----- From: "Madison Kelly" To: "TPM Mailing List" Sent: Tuesday, October 16, 2007 3:53 PM Subject: [tpm] File handle problem in a script called by another script Hi all, I've got a program (main) that calls a second program (small), both written in perl. Both the main and small program access a common library. When I call the second, small program directly from the command line, it works fine. At one point it calls a subrouting from the library that opens a file, reads it and writes back out a modified version (specifically, it tracks various records and keeps track of a counter). Now, when I call the small program from within the main program, I get an error: -=-=-=-=- [] small_script.pl: Use of uninitialized value in concatenation (.) or string at ./nmc.lib line 1741. [] small_script.pl: readline() on closed filehandle GEN16 at ./nmc.lib line 1746. -=-=-=-=- Here, nmc.lib is the library. I use 'IO::Handle' for creating the filehandle used to write out the file. Here is the specific block of code that generates the error: nmc.lib lines 1069 - 1076 -=-=-=-=- # Now re-write the file. my $write_inc=IO::Handle->new(); open ($write_inc, ">$inc_file") || &error($conf, "error_0042", 1, 0, $this_file, __LINE__, $inc_file, $!); for (@lines) { print $write_inc $_; } $write_inc->close(); -=-=-=-=- If I comment out this section, the program works fine (but obviously, the file is not updated...). Again, if I run the small program directly, there is no problem, either. My *guess* is that for some reason, the filehandle created by the main program to read the output from the call to the second, small program must be clobbering the filehandle above. I can't understand why though, because they are different sections of code using different file handle names (though the code to call the second program IS in the same library). In case it matters, here is the code from the main program that calls the small program (cleaned up to make it more readable): nmc.lib lines 2266 - 2284 -=-=-=-=- my $gzf=IO::Handle->new(); my $shell_call=?/path/to/small_script.pl 2>&1 |"; # write to log what I am calling... open ($gzf, $shell_call) || die...; while (<$gzf>) { chomp; my $line=$_; # write to log this line... $line=~s/\[(.*?)\]/\[$1<\/span>\]/g; my %value=( replace_0 => "", replace_1 => "$line", ); &print_template($conf, "tool_item", $$conf{template_ga}, \%value); %value=(); } $gzf->close(); -=-=-=-=- Any idea why the second example code could be clobbering the first block of code (if that is what is even happening)? Thanks!! Madi _______________________________________________ toronto-pm mailing list toronto-pm at pm.org http://mail.pm.org/mailman/listinfo/toronto-pm From linux at alteeve.com Tue Oct 16 13:39:48 2007 From: linux at alteeve.com (Madison Kelly) Date: Tue, 16 Oct 2007 16:39:48 -0400 Subject: [tpm] File handle problem in a script called by another script In-Reply-To: <027f01c81031$ddc53530$6600a8c0@roadhog> References: <471516CF.1060002@alteeve.com> <027f01c81031$ddc53530$6600a8c0@roadhog> Message-ID: <47152194.70503@alteeve.com> Indy Singh wrote: > The line numbers that you supplied code for (1069 - 1076) don't cover > where you say the error is (line 1741) > Assuming that that is just an oversight. > > It would probably be a good idea to print out the content of $inc_file > to verify that it actually contains a valid file name and path. > How do you know that there is something actually in @lines ? > A print statement in the loop would be a good idea. > How do you know that your error subroutine does actually print out > something? > How do you know that your error does NOT print out something? > How do you know that your error does not return (and therby cause a > cascading error). > > Rewrite the code, add print statements, remove calls to external > functions if you cal (error, IO::Handle). > > > > Indy Singh > IndigoSTAR Software -- www.indigostar.com > > > ----- Original Message ----- From: "Madison Kelly" > To: "TPM Mailing List" > Sent: Tuesday, October 16, 2007 3:53 PM > Subject: [tpm] File handle problem in a script called by another script > > > Hi all, > > I've got a program (main) that calls a second program (small), both > written in perl. Both the main and small program access a common > library. > > When I call the second, small program directly from the command line, > it works fine. At one point it calls a subrouting from the library that > opens a file, reads it and writes back out a modified version > (specifically, it tracks various records and keeps track of a counter). > > Now, when I call the small program from within the main program, I > get an error: > > -=-=-=-=- > [] small_script.pl: Use of uninitialized value in concatenation > (.) or string at ./nmc.lib line 1741. > [] small_script.pl: readline() on closed filehandle GEN16 at > ./nmc.lib line 1746. > -=-=-=-=- > > Here, nmc.lib is the library. > > I use 'IO::Handle' for creating the filehandle used to write out the > file. Here is the specific block of code that generates the error: > > nmc.lib lines 1069 - 1076 > -=-=-=-=- > # Now re-write the file. > my $write_inc=IO::Handle->new(); > open ($write_inc, ">$inc_file") || &error($conf, "error_0042", 1, 0, > $this_file, __LINE__, $inc_file, $!); > for (@lines) > { > print $write_inc $_; > } > $write_inc->close(); > -=-=-=-=- > > If I comment out this section, the program works fine (but obviously, > the file is not updated...). Again, if I run the small program directly, > there is no problem, either. > > My *guess* is that for some reason, the filehandle created by the > main program to read the output from the call to the second, small > program must be clobbering the filehandle above. I can't understand why > though, because they are different sections of code using different file > handle names (though the code to call the second program IS in the same > library). > > In case it matters, here is the code from the main program that calls > the small program (cleaned up to make it more readable): > > nmc.lib lines 2266 - 2284 > -=-=-=-=- > my $gzf=IO::Handle->new(); > my $shell_call=?/path/to/small_script.pl 2>&1 |"; > # write to log what I am calling... > open ($gzf, $shell_call) || die...; > while (<$gzf>) > { > chomp; > my $line=$_; > # write to log this line... > > $line=~s/\[(.*?)\]/\[$1<\/span>\]/g; > my %value=( > replace_0 => "", > replace_1 => "$line", > ); > &print_template($conf, "tool_item", $$conf{template_ga}, \%value); > %value=(); > > } > $gzf->close(); > -=-=-=-=- > > Any idea why the second example code could be clobbering the first > block of code (if that is what is even happening)? > > Thanks!! > > Madi > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > GAH! Thanks both, turns out it was all fine and the problem was file permissions.... I'll go head->desk now. Sorry for the line noise! Madi From sz_2 at hotmail.com Wed Oct 17 14:04:35 2007 From: sz_2 at hotmail.com (s z) Date: Wed, 17 Oct 2007 21:04:35 +0000 Subject: [tpm] (no subject) Message-ID: Hi, this is a newbie's question and I would like to get some advice from you: I am using perl to develop an application. I am able to read and write through ODBC to dbf files by using dbd-odbc. The script generates the html files for user interface like tables, input textboxes and submit buttons. when user enters new values into textboxes and press button to save, the form is submited and user's input is saved to the data file. This is done by calling a different perl script file. The screen goes blank afterwards. It would be nice to redisplay the input boxes and the buttons on the screen to let user to continue the editing. But how to call the perl display routine from another perl script? I am thinking to reuse the perl code from the previous routine in the update routine. Is there a better way to reuse the perl codes? How? Thanks a lot for your advice. Sam _________________________________________________________________ Send a smile, make someone laugh, have some fun! Start now! http://www.freemessengeremoticons.ca/?icid=EMENCA122 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20071017/fa3535be/attachment.html From sfryer at sourcery.ca Wed Oct 17 14:23:03 2007 From: sfryer at sourcery.ca (Shaun Fryer) Date: Wed, 17 Oct 2007 17:23:03 -0400 Subject: [tpm] (no subject) In-Reply-To: References: Message-ID: <20071017212302.GA29123@sourcery.ca> On Wed, Oct 17, 2007 at 09:04:35PM +0000, s z wrote: > > Hi, this is a newbie's question and I would like to get some advice from you: > > I am using perl to develop an application. I am able to read and write through ODBC to dbf files by using dbd-odbc. The script generates the html files for user interface like tables, input textboxes and submit buttons. when user enters new values into textboxes and press button to save, the form is submited and user's input is saved to the data file. This is done by calling a different perl script file. The screen goes blank afterwards. It would be nice to redisplay the input boxes and the buttons on the screen to let user to continue the editing. But how to call the perl display routine from another perl script? I am thinking to reuse the perl code from the previous routine in the update routine. Is there a better way to reuse the perl codes? How? > Thanks a lot for your advice. > > Sam Hi Sam, If the script which recieves the form submission does not output any other data, you might consider sending an HTTP redirect back to the first script. There are a number of ways to do this, but perhaps the very simplest (and for which I'll likely get flamed) is to print the following line (assuming your webserver doesn't do headers for you automatically). print "Location: http://domain.tld/path/to/your/first.cgi\n\n"; You can do this either before or after your database call, depending on the speed of the application and whether or not you might need to output an error to the user in case of problems. If you are using the CGI module or another variant such as Apache::whatever, then you should read the API docs for info on how to do this. -- Shaun Fryer From sz_2 at hotmail.com Wed Oct 17 19:01:11 2007 From: sz_2 at hotmail.com (s z) Date: Thu, 18 Oct 2007 02:01:11 +0000 Subject: [tpm] CGI Message-ID: this is a second post. Please comment on the issue. I appreciate your help. Thank you in advance. Hi, this is a newbie's question and I would like to get some advice from you: I am using perl to develop an application. I am able to read and write through ODBC to dbf files by using dbd-odbc. The script generates the html files for user interface like tables, input textboxes and submit buttons. when user enters new values into textboxes and press button to save, the form is submited and user's input is saved to the data file. This is done by calling a different perl script file. The screen goes blank afterwards. It would be nice to redisplay the input boxes and the buttons on the screen to let user to continue the editing. But how to call the perl display routine from another perl script? I am thinking to reuse the perl code from the previous routine in the update routine. Is there a better way to reuse the perl codes? How?Thanks a lot for your advice. Sam _________________________________________________________________ Send a smile, make someone laugh, have some fun! Start now! http://www.freemessengeremoticons.ca/?icid=EMENCA122 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20071018/ae5b1bfc/attachment.html From liam at holoweb.net Wed Oct 17 21:47:32 2007 From: liam at holoweb.net (Liam R E Quin) Date: Thu, 18 Oct 2007 00:47:32 -0400 Subject: [tpm] CGI In-Reply-To: References: Message-ID: <1192682852.15058.20.camel@dell.barefootcomputing.com> On Thu, 2007-10-18 at 02:01 +0000, s z wrote: > this is a second post. Please comment on the issue. I appreciate your > help. Thank you in advance. You already had one reply I think. Let's take a higher-level look at the problem. States are: [1] issue blank form to user [2] receive data 2a data is not OK, go back to [1] but with correct fields still there 2b data is OK, proceed to [3] *important* people can edit data in Web forms, never ever trust it! never ever display user data in error messages unless you escape all special characters like < & > ' " where needed. Otherwise your site is vulnerable to a cross-site scripting attack, or can be used to attack another site, or can be used to host links to porn sites inside those error messages! [3] data is OK, update the dataqbase 3a failed, go back to [1] with an explanation 3b OK, so proceed to [1] with a note that everything was OK You can do all this with a single CGI script. I make it easier for myself with a hidden input field that supplies a state parameter, although you still need to check the data is OK of course, as someone can always add the parameter right there in the URL! mypage.cgi looks like if (data_was_ok) { initial_page(message) } elsif (got_data) { if (data_is_bad) { initial_page("data was bad"); # do better than this! } elsif (store_data()) { initial_page("data stored."); } else { initial_page("failed to store data"); } } else { initial_page() } Now you only need one program and the logic is fairly clear. The initial_page() routine would of course send the HTML forms, populated with data if supplied, and with an optional message at the start. If you really do end up wanting to share code between different scripts, you may want to learn about modules, although an alternative is just to call the other script with system() (if you are VERY careful not to pass command-line arguments, or to quote them properly, so that a value of `/bin/rm -rf /` does not delete every file on your server... people WILL try this sort of thing) Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org www.advogato.org From indy at indigostar.com Mon Oct 22 13:33:32 2007 From: indy at indigostar.com (Indy Singh) Date: Mon, 22 Oct 2007 16:33:32 -0400 Subject: [tpm] Source of when Perl features added References: <1192682852.15058.20.camel@dell.barefootcomputing.com> Message-ID: <036b01c814ea$d0416ab0$6600a8c0@roadhog> Hello folks, Anybody have any idea where one can find a list of what Perl features were added in what release? I am not interested in ancient versions just ones that one might run into in a production environment. Also not looking for every bug or feature that was added in every release just the major items. Some of the specific things I am interested in are: What release introduced 'use warnings'? What release introduced the 'our' variable declaration? What release allowed calls to undeclared user subs without a leading &. Indy Singh IndigoSTAR Software -- www.indigostar.com From rdice at pobox.com Mon Oct 22 13:44:52 2007 From: rdice at pobox.com (Richard Dice) Date: Mon, 22 Oct 2007 16:44:52 -0400 Subject: [tpm] Source of when Perl features added In-Reply-To: <036b01c814ea$d0416ab0$6600a8c0@roadhog> References: <1192682852.15058.20.camel@dell.barefootcomputing.com> <036b01c814ea$d0416ab0$6600a8c0@roadhog> Message-ID: <5bef4baf0710221344h5fb0441fq51a8076baf26737e@mail.gmail.com> Hi Indy, Is what you're looking for different from "perldelta"? E.g. http://search.cpan.org/~nwclark/perl-5.8.8/pod/perl588delta.pod You can see various perldeta files for various minor-numbered releases at: http://search.cpan.org/~nwclark/perl-5.8.8/ The "even more detailed" file I think you were trying to ignore is - http://search.cpan.org/src/NWCLARK/perl-5.8.8/Changes Cheers, Richard On 10/22/07, Indy Singh wrote: > > Hello folks, > > Anybody have any idea where one can find a list of what Perl features > were added in what release? > > I am not interested in ancient versions just ones that one might run > into in a production environment. Also not looking for every bug or > feature that was added in every release just the major items. > > Some of the specific things I am interested in are: > What release introduced 'use warnings'? > What release introduced the 'our' variable declaration? > What release allowed calls to undeclared user subs without a leading &. > > Indy Singh > IndigoSTAR Software -- www.indigostar.com > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20071022/596c7139/attachment.html From liam at holoweb.net Mon Oct 22 13:41:38 2007 From: liam at holoweb.net (Liam R E Quin) Date: Mon, 22 Oct 2007 16:41:38 -0400 Subject: [tpm] Source of when Perl features added In-Reply-To: <036b01c814ea$d0416ab0$6600a8c0@roadhog> References: <1192682852.15058.20.camel@dell.barefootcomputing.com> <036b01c814ea$d0416ab0$6600a8c0@roadhog> Message-ID: <1193085698.8132.24.camel@dell.barefootcomputing.com> On Mon, 2007-10-22 at 16:33 -0400, Indy Singh wrote: > Some of the specific things I am interested in are: > What release introduced 'use warnings'? uncertain -- perl -w was much older and is safe, e.g. in the #! line > What release introduced the 'our' variable declaration? Perl 5 but not sure which release. > What release allowed calls to undeclared user subs without a leading &. Perl 5, some time before 1998 But I don't have a general algorithm for answering the question, sorry. -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org www.advogato.org From magog at the-wire.com Tue Oct 23 10:14:08 2007 From: magog at the-wire.com (Michael Graham) Date: Tue, 23 Oct 2007 13:14:08 -0400 Subject: [tpm] October Meeting - This Thursday - 25 Oct, 2007 - Richard's Summer of Perl Message-ID: <20071023131408.g44jz23kg0wgwgkw@webmail.the-wire.com> (These details are also on the TPM web site: http://to.pm.org/) The next meeting is this Thursday (25 Oct). Date: Thursday 25 Oct 2007 Time: 6:45pm Where: 2 Bloor Street West (NW corner of Yonge/Bloor, skyscraper with the CIBC logo on top) Classroom TBA. =================================================================== Talk Details: Speaker: Richard Dice Title: Richard's Summer of Perl Description: Between May and October Richard did much Perl stuff. Conferences attended: YAPC::NA, OSCON, YAPC::EU and PPW. He did a few other Perl things which are hard to categorize too. Come to this talk to hear confessions of a Perl addict. Richard promises only the bare minimum in organization and preparation, but will probably have no trouble in filling the time allotted, however much that time may be before you collectively shout him down. He hopes this talk will be entertaining if informal, maybe marginally useful, and at least not overly personally embarrassing. =================================================================== Note: The elevators in the building are "locked down" after 5:30pm to people without building access cards. Leading up to the meeting someone will come down to the main floor lobby every few minutes to ferry people upstairs. After 19:00, you can reach the access-card-carrying guy via a cell phone number that we'll leave with security in the front lobby. The room and floor numbers will be left with security too. -- Michael Graham From michael.a.bolton at gmail.com Wed Oct 24 07:53:59 2007 From: michael.a.bolton at gmail.com (Michael Bolton) Date: Wed, 24 Oct 2007 10:53:59 -0400 Subject: [tpm] David Platt Speaking Virtually At TASSQ Message-ID: <004801c8164d$bc89a7d0$5100000a@Koko> Hi, folks... One of my favourite talks over the spring conference season was David Platt's keynote address at SD West, on the subject of his book, "Why Software Sucks". We're lucky to have David presenting that talk to us via real-time video hookup next Tuesday, October 30, at the Toronto Association of System and Software Quality. You can get information and register for the event at http://www.tassq.org. Cheers, ---Michael B. TASSQ - The Toronto Association of System and Software Quality http://www.tassq.org Michael Bolton DevelopSense: Software Testing in Plain English Web Site: http://www.developsense.com Newsletter: addme at developsense.com From michael.a.bolton at gmail.com Wed Oct 24 12:11:05 2007 From: michael.a.bolton at gmail.com (Michael Bolton) Date: Wed, 24 Oct 2007 15:11:05 -0400 Subject: [tpm] David Platt Speaking Virtually At TASSQ Message-ID: <009801c81671$a0de0700$5100000a@Koko> Hi, folks... One of my favourite talks over the spring conference season was David Platt's keynote address at SD West, on the subject of his book, "Why Software Sucks". We're lucky to have David presenting that talk to us via real-time video hookup next Tuesday, October 30, at the Toronto Association of System and Software Quality. You can get information and register for the event at http://www.tassq.org. Cheers, ---Michael B. TASSQ - The Toronto Association of System and Software Quality http://www.tassq.org Michael Bolton DevelopSense: Software Testing in Plain English Web Site: http://www.developsense.com Newsletter: addme at developsense.com _______________________________________________ toronto-pm mailing list toronto-pm at pm.org http://mail.pm.org/mailman/listinfo/toronto-pm From magog at the-wire.com Wed Oct 24 12:46:44 2007 From: magog at the-wire.com (Michael Graham) Date: Wed, 24 Oct 2007 15:46:44 -0400 Subject: [tpm] Need someone to guard room for tomorrow's meeting Message-ID: <20071024154644.68b72ebe@caliope> Is anybody able to come early to tomorrow's meeting? We need someone to arrive in the room around 4:00 pm and stay there until the meeting starts (to make sure that the cleaners don't lock the room). The location is: Classroom 11 on the 8th floor Michael -- Michael Graham From arocker at vex.net Wed Oct 24 13:35:56 2007 From: arocker at vex.net (arocker at vex.net) Date: Wed, 24 Oct 2007 16:35:56 -0400 (EDT) Subject: [tpm] Need someone to guard room for tomorrow's meeting In-Reply-To: <20071024154644.68b72ebe@caliope> References: <20071024154644.68b72ebe@caliope> Message-ID: <41853.192.30.202.28.1193258156.squirrel@webmail.vex.net> > We need someone to arrive in the room around 4:00 pm and stay there > until the meeting starts (to make sure that the cleaners don't lock the > room). > If the room is locked when you arrive, get the key from LaVerne (on the 12th floor), unlock it, and guard it. From arocker at vex.net Wed Oct 24 13:38:03 2007 From: arocker at vex.net (arocker at vex.net) Date: Wed, 24 Oct 2007 16:38:03 -0400 (EDT) Subject: [tpm] Need someone to guard room for tomorrow's meeting In-Reply-To: <20071024154644.68b72ebe@caliope> References: <20071024154644.68b72ebe@caliope> Message-ID: <34098.192.30.202.29.1193258283.squirrel@webmail.vex.net> P.S. LaVerne goes home at 16:30, which is why you have to arrive before then. From magog at the-wire.com Thu Oct 25 13:02:33 2007 From: magog at the-wire.com (Michael Graham) Date: Thu, 25 Oct 2007 16:02:33 -0400 Subject: [tpm] Need someone to guard room for tomorrow's meeting In-Reply-To: <20071024154644.68b72ebe@caliope> References: <20071024154644.68b72ebe@caliope> Message-ID: <20071025160233.627152f1@caliope> Okay, I'm going to try to get there by 4:30. Michael On Wed, 24 Oct 2007 15:46:44 -0400 Michael Graham wrote: > > Is anybody able to come early to tomorrow's meeting? > > We need someone to arrive in the room around 4:00 pm and stay there > until the meeting starts (to make sure that the cleaners don't lock > the room). > > > The location is: Classroom 11 on the 8th floor > > > Michael > > > > > -- Michael Graham From magog at the-wire.com Thu Oct 25 13:48:34 2007 From: magog at the-wire.com (Michael Graham) Date: Thu, 25 Oct 2007 16:48:34 -0400 Subject: [tpm] Need someone to guard room for tomorrow's meeting In-Reply-To: <20071025160233.627152f1@caliope> References: <20071024154644.68b72ebe@caliope> <20071025160233.627152f1@caliope> Message-ID: <20071025164834.7442edbd@caliope> > Okay, I'm going to try to get there by 4:30. I'm here and guarding the room. All is well. Michael On Thu, 25 Oct 2007 16:02:33 -0400 Michael Graham wrote: > > Okay, I'm going to try to get there by 4:30. > > > Michael > > > > On Wed, 24 Oct 2007 15:46:44 -0400 > Michael Graham wrote: > > > > > Is anybody able to come early to tomorrow's meeting? > > > > We need someone to arrive in the room around 4:00 pm and stay there > > until the meeting starts (to make sure that the cleaners don't lock > > the room). > > > > > > The location is: Classroom 11 on the 8th floor > > > > > > Michael > > > > > > > > > > > > -- Michael Graham From jim.graham at jim-graham.net Fri Oct 26 08:12:13 2007 From: jim.graham at jim-graham.net (Jim Graham) Date: Fri, 26 Oct 2007 11:12:13 -0400 Subject: [tpm] Some links from last night's meeting Message-ID: Hi All, here are 2 links about things brought up at last night's meeting -- Steve Yegge's Keynote at OSCON 2007 about Open Source Marketing http://blip.tv/file/319044/ -- Reddit discussion of Lua benchmarks on Parrot. This was originally a link to the perl6 internals mailing list with Reddit comments. Most of the discussion comes back to 'completeness first, optimization second' http://programming.reddit.com/info/2z05a/comments/ Regards, Jim From fulko.hew at gmail.com Fri Oct 26 08:46:42 2007 From: fulko.hew at gmail.com (Fulko Hew) Date: Fri, 26 Oct 2007 11:46:42 -0400 Subject: [tpm] Some links from last night's meeting In-Reply-To: References: Message-ID: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> On 10/26/07, Jim Graham wrote: > > > -- Reddit discussion of Lua benchmarks on Parrot. This was originally a > link to the perl6 internals mailing list with Reddit comments. Most of the > discussion comes back to 'completeness first, optimization second' > > http://programming.reddit.com/info/2z05a/comments/ I read that stuff, and I know of Lua (in passing where its embedded in Wireshark) My comment on the Reddit discussion, (based on last night's discussion) is: ...Lua is optimized for Lua, ...Parrot is not optimized for Lua, ...Parrot is optimized for Parrot. So I'm not surprised that Lua code running on a highly (Lua) optimized 'system' is faster than Lua code compiled to run on Parrot. I would suspect there is a one to one mapping between Lua constructs and the Lua VM, whereas the Lua on Parrot compiler probably isn't designed with that in mind and hence isn't one to one. The corollary is that Lua probably doesn't have a one to one mapping of Perl constructs either, so that a perl compiler written in Lua probably won't run as fast as perl on parrot. "A screwdriver it great with screws, and can be used as a so-so chisel. A chisel is a great chisel, and can be used as a so-so screwdriver." Does that make screwdrivers inefficient? Does that make chisels inefficient? I'll leave that as a rhetorical question. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20071026/5dd52286/attachment.html From jkeen at verizon.net Fri Oct 26 18:35:24 2007 From: jkeen at verizon.net (James E Keenan) Date: Fri, 26 Oct 2007 21:35:24 -0400 Subject: [tpm] Some links from last night's meeting In-Reply-To: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> Message-ID: <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> On Oct 26, 2007, at 11:46 AM, Fulko Hew wrote: > > > On 10/26/07, Jim Graham wrote: > -- Reddit discussion of Lua benchmarks on Parrot. This was > originally a link to the perl6 internals mailing list with Reddit > comments. Most of the discussion comes back to 'completeness first, > optimization second' > > http://programming.reddit.com/info/2z05a/comments/ > > > I read that stuff, and I know of Lua (in passing where its embedded > in Wireshark) > > My comment on the Reddit discussion, (based on last night's > discussion) is: > ...Lua is optimized for Lua, > ...Parrot is not optimized for Lua, > ...Parrot is optimized for Parrot. > > So I'm not surprised that Lua code running on a highly > (Lua) optimized 'system' is faster than Lua code > compiled to run on Parrot. The Parrot project is always looking for developers who can help port languages other than Perl to Parrot. Any volunteers? jimk From psema4 at gmail.com Fri Oct 26 18:47:20 2007 From: psema4 at gmail.com (Scott Elcomb) Date: Fri, 26 Oct 2007 21:47:20 -0400 Subject: [tpm] Some links from last night's meeting In-Reply-To: <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> Message-ID: <99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> On 10/26/07, James E Keenan wrote: > The Parrot project is always looking for developers who can help port > languages other than Perl to Parrot. Out of curiousity, I was going to ask if javascript (er ecmascript) was being ported, but I see there is at least one implementation in the works, PJS. Instead, I'll have to ask if there's any work towards modifying Dr. Jack Crenshaw's USENET tutorial "Let's Build A Compiler" such that the compiler/interpretor being built works in Parrot? If not, I'll offer to do so - it'll likely be a couple months before I could start, but it'd be a wonderful project to work on. I started converting Dr. Crenshaw's tutorial to Perl 5.6 a year or two ago while experimenting with a curses-based IDE. -- Scott Elcomb http://www.psema4.com/ From arocker at vex.net Sat Oct 27 12:51:43 2007 From: arocker at vex.net (arocker at vex.net) Date: Sat, 27 Oct 2007 15:51:43 -0400 (EDT) Subject: [tpm] Some links from last night's meeting In-Reply-To: <99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> <99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> Message-ID: <38994.192.30.202.28.1193514703.squirrel@webmail.vex.net> "Scott Elcomb" , > > Out of curiousity, I was going to ask if javascript (er ecmascript) > was being ported, > A paper about a Javascript implementation on Parrot. The paper's in Dutch (I think), but the abstract's in English. http://users.fulladsl.be/spb1622/pjs/scriptie.pdf From indy at indigostar.com Wed Oct 31 16:53:44 2007 From: indy at indigostar.com (Indy Singh) Date: Wed, 31 Oct 2007 19:53:44 -0400 Subject: [tpm] Weird arrary reference bahaviour References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com><32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net><99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> <38994.192.30.202.28.1193514703.squirrel@webmail.vex.net> Message-ID: <018401c81c19$45dfe3c0$6401a8c0@roadhog> Hi Guys, Can anyone explain, why taking a reference to an array gives a different value on each iteration of this loop. This is the line of code: my $r = \@f; If I move the "my @a" declaration outside the loop I get the same value each time. It seems that on each iteration of the loop a new @f array is created. Does that make sense? Indy Singh IndigoSTAR Software -- www.indigostar.com my @foo = ("ford:ltd", "chevy:nova"); my $x; my @a; foreach $x (@foo) { my @f; @f = split(/:/, $x); my $r = \@f; print "r = $r\n"; push @a, $r; } my $item; foreach $item (@a) { print join(' ', @{$item}),"\n"; } From fulko.hew at gmail.com Wed Oct 31 17:13:55 2007 From: fulko.hew at gmail.com (Fulko Hew) Date: Wed, 31 Oct 2007 20:13:55 -0400 Subject: [tpm] Weird arrary reference bahaviour In-Reply-To: <018401c81c19$45dfe3c0$6401a8c0@roadhog> References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> <99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> <38994.192.30.202.28.1193514703.squirrel@webmail.vex.net> <018401c81c19$45dfe3c0$6401a8c0@roadhog> Message-ID: <8204a4fe0710311713x402507aej6f9e35a6e6eb704a@mail.gmail.com> On 10/31/07, Indy Singh wrote: > > Hi Guys, > Can anyone explain, why taking a reference to an array gives a different > value on each iteration of this loop. This is the line of code: > my $r = \@f; > > If I move the "my @a" declaration outside the loop I get the same value > each time. > > It seems that on each iteration of the loop a new @f array is created. > Does that make sense? ... snip ... foreach $x (@foo) { > my @f; ... snip ... Yes, this make sense because my @f is a variable declared every time the body of the foreach loop is executed. (for the same reason that the split is executed every time through the loop too.) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20071031/39c846ee/attachment.html From indy at indigostar.com Wed Oct 31 17:36:47 2007 From: indy at indigostar.com (Indy Singh) Date: Wed, 31 Oct 2007 20:36:47 -0400 Subject: [tpm] Weird arrary reference bahaviour References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com><32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net><99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com><38994.192.30.202.28.1193514703.squirrel@webmail.vex.net><018401c81c19$45dfe3c0$6401a8c0@roadhog> <8204a4fe0710311713x402507aej6f9e35a6e6eb704a@mail.gmail.com> Message-ID: <019b01c81c1f$49911d30$6401a8c0@roadhog> Ok, thanks, I believe you. I just didn't expect that. I was thinking in C++ terms, where that variable would be declared on the stack frame and would persist until the loop exits. ----- Original Message ----- From: Fulko Hew To: tpm at to.pm.org Sent: Wednesday, October 31, 2007 8:13 PM Subject: Re: [tpm] Weird arrary reference bahaviour On 10/31/07, Indy Singh wrote: Hi Guys, Can anyone explain, why taking a reference to an array gives a different value on each iteration of this loop. This is the line of code: my $r = \@f; If I move the "my @a" declaration outside the loop I get the same value each time. It seems that on each iteration of the loop a new @f array is created. Does that make sense? ... snip ... foreach $x (@foo) { my @f; ... snip ... Yes, this make sense because my @f is a variable declared every time the body of the foreach loop is executed. (for the same reason that the split is executed every time through the loop too.) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20071031/7d0df86d/attachment.html From ceeshek at gmail.com Wed Oct 31 18:20:00 2007 From: ceeshek at gmail.com (Cees Hek) Date: Thu, 1 Nov 2007 12:20:00 +1100 Subject: [tpm] Weird arrary reference bahaviour In-Reply-To: <018401c81c19$45dfe3c0$6401a8c0@roadhog> References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> <99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> <38994.192.30.202.28.1193514703.squirrel@webmail.vex.net> <018401c81c19$45dfe3c0$6401a8c0@roadhog> Message-ID: On 11/1/07, Indy Singh wrote: > Hi Guys, > Can anyone explain, why taking a reference to an array gives a different > value on each iteration of this loop. This is the line of code: > my $r = \@f; > > If I move the "my @a" declaration outside the loop I get the same value > each time. > > It seems that on each iteration of the loop a new @f array is created. > Does that make sense? > > Indy Singh > IndigoSTAR Software -- www.indigostar.com > > > my @foo = ("ford:ltd", "chevy:nova"); > my $x; > my @a; > > foreach $x (@foo) { > my @f; > @f = split(/:/, $x); > my $r = \@f; > print "r = $r\n"; > push @a, $r; > } At the end of each iteration of the loop, @f falls out of scope. But since you store away a reference to \@f, the data that @f refers to does not get garbage collected (ie it's refcount has not hit zero). So during the next iteration of the loop, the memory location that @f used during the previous iteration is not available to be re-used, so a new location is assigned to @f. if you didn't store that reference to @f, then the data would be garbage collected (ie @f goes out of scope at the end of the iteration, the refcount is zero and the memory is reclaimed), and Perl would re-use the same memory location for @f for each iteration. Cheers, Cees From indy at indigostar.com Wed Oct 31 18:42:32 2007 From: indy at indigostar.com (Indy Singh) Date: Wed, 31 Oct 2007 21:42:32 -0400 Subject: [tpm] Weird arrary reference bahaviour References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> <99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> <38994.192.30.202.28.1193514703.squirrel@webmail.vex.net> <018401c81c19$45dfe3c0$6401a8c0@roadhog> Message-ID: <01b101c81c28$78e96390$6401a8c0@roadhog> From: "Cees Hek" To: "Indy Singh" Cc: Sent: Wednesday, October 31, 2007 9:20 PM Subject: Re: [tpm] Weird arrary reference bahaviour > On 11/1/07, Indy Singh wrote: >> Hi Guys, >> Can anyone explain, why taking a reference to an array gives a >> different >> value on each iteration of this loop. This is the line of code: >> my $r = \@f; >> >> If I move the "my @a" declaration outside the loop I get the same >> value >> each time. >> >> It seems that on each iteration of the loop a new @f array is >> created. >> Does that make sense? >> >> Indy Singh >> IndigoSTAR Software -- www.indigostar.com >> >> >> my @foo = ("ford:ltd", "chevy:nova"); >> my $x; >> my @a; >> >> foreach $x (@foo) { >> my @f; >> @f = split(/:/, $x); >> my $r = \@f; >> print "r = $r\n"; >> push @a, $r; >> } > > At the end of each iteration of the loop, @f falls out of scope. But > since you store away a reference to \@f, the data that @f refers to > does not get garbage collected (ie it's refcount has not hit zero). > So during the next iteration of the loop, the memory location that @f > used during the previous iteration is not available to be re-used, so > a new location is assigned to @f. > > if you didn't store that reference to @f, then the data would be > garbage collected (ie @f goes out of scope at the end of the > iteration, the refcount is zero and the memory is reclaimed), and Perl > would re-use the same memory location for @f for each iteration. > > Cheers, > > Cees > At the end of each iteration of the loop, @f falls out of scope. I would have thought that @f falls out of scope _after_ the closing brace, not while still inside it. But you seem to be right. From uri at stemsystems.com Wed Oct 31 20:39:46 2007 From: uri at stemsystems.com (Uri Guttman) Date: Wed, 31 Oct 2007 22:39:46 -0500 Subject: [tpm] Weird arrary reference bahaviour In-Reply-To: <019b01c81c1f$49911d30$6401a8c0@roadhog> (Indy Singh's message of "Wed, 31 Oct 2007 20:36:47 -0400") References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> <99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> <38994.192.30.202.28.1193514703.squirrel@webmail.vex.net> <018401c81c19$45dfe3c0$6401a8c0@roadhog> <8204a4fe0710311713x402507aej6f9e35a6e6eb704a@mail.gmail.com> <019b01c81c1f$49911d30$6401a8c0@roadhog> Message-ID: >>>>> "IS" == Indy Singh writes: IS> Ok, thanks, I believe you. I just didn't expect that. I was IS> thinking in C++ terms, where that variable would be declared on IS> the stack frame and would persist until the loop exits. it is due to perl's reference counting. all lexicals are allocated from the heap (not the stack) and so they can have references to them that keeps them alive. my does both a compile time and run time stuff. the run time stuff includes allocating the variable storage. if my is executed again and there is are live references to that variable, it will allocate a new one. this is one way to create a new anon ref. these do the exact same thing: $k = [ 1, 3 ] ; $k = do{ my @k = (1, 3) ; \@k } ; and each time you execute those lines, a new anon array ref is created. your sub (or rather loop) does the same thing. saving a ref to the lexical array in that scope means the array will not be freed up after the loop iterates by hitting its end. so a new array and subsequently a new ref address are created the next time. by declaring the array before the loop, it never executes the my runtime part in the loop and so the ref stays the same as the array stays the same. uri -- Uri Guttman ------ uri at stemsystems.com -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org From liam at holoweb.net Wed Oct 31 22:53:59 2007 From: liam at holoweb.net (Liam R E Quin) Date: Thu, 01 Nov 2007 01:53:59 -0400 Subject: [tpm] Weird arrary reference bahaviour In-Reply-To: <01b101c81c28$78e96390$6401a8c0@roadhog> References: <8204a4fe0710260846w57722abciac302dca03150912@mail.gmail.com> <32042130-9EB1-41EC-B78C-CD139DEB575A@verizon.net> <99a6c38f0710261847h7975a9d6n224c618a30bbef78@mail.gmail.com> <38994.192.30.202.28.1193514703.squirrel@webmail.vex.net> <018401c81c19$45dfe3c0$6401a8c0@roadhog> <01b101c81c28$78e96390$6401a8c0@roadhog> Message-ID: <1193896439.28685.9.camel@dell.barefootcomputing.com> On Wed, 2007-10-31 at 21:42 -0400, Indy Singh wrote: > > At the end of each iteration of the loop, @f falls out of scope. > I would have thought that @f falls out of scope _after_ the closing > brace, not while still inside it. But you seem to be right. Perl is like C in this regard. for (i = 0; i < 7; i ++) { char *boy = strdup("Simon"); printf("%d %x\n", i, boy); } will give different addresses each time round the loop. The variable is created anew each time round (and in this case there's a memory leak, of course, because we never free the boy). for (i = 0; i < 7; i ++) { char *boy = strdup("Simon"); printf("%d %x\n", i, boy); free(boy); } will work better in C. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org www.advogato.org