From cowanb at mindspring.com Tue Feb 3 13:20:29 2009 From: cowanb at mindspring.com (Bill Cowan) Date: Tue, 03 Feb 2009 16:20:29 -0500 Subject: [Raleigh-talk] Amazon S3 and SimpleDB Modules? Message-ID: <4988B51D.6030809@mindspring.com> An HTML attachment was scrubbed... URL: From jason at purdy.info Tue Feb 3 14:40:01 2009 From: jason at purdy.info (Jason Purdy) Date: Tue, 3 Feb 2009 17:40:01 -0500 Subject: [Raleigh-talk] Amazon S3 and SimpleDB Modules? In-Reply-To: <4988B51D.6030809@mindspring.com> References: <4988B51D.6030809@mindspring.com> Message-ID: <3c4d9f1f0902031440o28420c2fnc88d691f251f97@mail.gmail.com> I don't have *hands-on experience *for SimpleDB (though I'm excited about the tech. and think it's cool stuff), but from the last YAPC, I'd point you to Timothy Appnel - he was working on some sort of AWS bundle and he also has the SimpleDB perl module, too. Amazon has a free tier for SimpleDB usageuntil May or so. Keep in mind that SimpleDB is totally different than your typical relational database system ... it's a big mindset-shift! As for S3, I have some experience w/ that (uploading stuff to buckets) and I'm using Net::Amazon::S3- works great. :) Cheers, Jason On Tue, Feb 3, 2009 at 4:20 PM, Bill Cowan wrote: > I am investigating CPAN modules for S3 and SimpleDB, but there are > different ones on CPAN. (I also read the Perl.com article on this topic.) > Does anyone have suggestions based on their own *hands-on experience*? > > Thanks, Bill. > > ----------------------------------------------------------------------- > Bill Cowan > Email: cowanb at mindspring.com > Phone: 919.210.4910 > > > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From trevormg19 at gmail.com Wed Feb 4 11:28:01 2009 From: trevormg19 at gmail.com (Trevor Little) Date: Wed, 04 Feb 2009 14:28:01 -0500 Subject: [Raleigh-talk] Testing Message-ID: I was wondering how many of you write tests for your code on a regular basis. What modules do you use to make that easier? I'm familiar with the Test::{Simple,More,Deep,...} family, but are there others anyone has used and likes? Does anyone work in a place were unit testing is enforced or at least strongly encouraged? I guess I'm just trying to figure out how other companies/people approach this kind of unit testing. Thanks, Trevor From james.oden at gmail.com Wed Feb 4 11:47:14 2009 From: james.oden at gmail.com (James Olin Oden) Date: Wed, 4 Feb 2009 14:47:14 -0500 Subject: [Raleigh-talk] Testing In-Reply-To: References: Message-ID: On Wed, Feb 4, 2009 at 2:28 PM, Trevor Little wrote: > I was wondering how many of you write tests for your code on a regular > basis. What modules do you use to make that easier? I'm familiar with the > Test::{Simple,More,Deep,...} family, but are there others anyone has used > and likes? Does anyone work in a place were unit testing is enforced or at > least strongly encouraged? I guess I'm just trying to figure out how other > companies/people approach this kind of unit testing. > We use Test::More presently. Tests are encouraged but I would say strongly. Mostly, tests get created because code can become increasingly difficult to maintain if we don't write tests. This is especially true of our perl modules, as they can be used in so many different ways, its important to have something that does a reasonable regression across all of the libraries functionality. Presently, when we build packages we automatically generate test subpackage for that package. These tests all get installed under some known directory tree. We have no engine though, yet, to automate the running of all the tests in our distribution. BTW, I find that Test::More seems to work great for testing CLI's too, or really perl works well in this regard in that its more than capable of spawning processes, checking file contents and with Perl::Expect(3pm), controlling interactive programs or doing screen scraping. We don't do anything with web interface testing yet. Cheers...james From james.oden at gmail.com Wed Feb 4 11:31:22 2009 From: james.oden at gmail.com (James Olin Oden) Date: Wed, 4 Feb 2009 14:31:22 -0500 Subject: [Raleigh-talk] Integrating newer version of a perl module into the perl distribution... Message-ID: HI All, Does anyone understand the source tree of a typical perl distribution? I'm trying to figure out how to integrate a newer module into an existing perl distribution (i.e. into its source tree) but I'm finding whereas the cpan module is self contained under one directory the sources in the perl distribution are not, splitting some files under the ext directory and some under the lib directory. Ultimately, I'm just trying to figure out how the the perl distribution build works in regards to perl modules. Does anyone understand this and/or know of documentation that would help with this. Thanks...james From jason at purdy.info Wed Feb 4 11:59:40 2009 From: jason at purdy.info (Jason Purdy) Date: Wed, 4 Feb 2009 14:59:40 -0500 Subject: [Raleigh-talk] Testing In-Reply-To: References: Message-ID: <3c4d9f1f0902041159v1192435aya759aac750fdc83@mail.gmail.com> Testing is awesome - that's what I'm actually in the middle of right now. My boss decided to take one of our applications and make it available on another site. Since I wrote several test scripts for the original application, I was able to move it over to the other site and adapt the test scripts and over these last few days, I've been able to hammer out the bugs and have great confidence that the application on the new site will be pretty well-QA'd. We develop web applications and those are tough to test entirely from Perl. So we (I ;) ) split test cases into client-side (I've used Selenium and YUITest) to test javascript code and then Test::More (I just dabbled w/ Test::HTML::Content today and love it ... really can't go wrong w/ anything Test::* can you? ;)) to test the web application code (written w/ CGI::Application). I touched a little bit about my approach in my use.perl journal . Cheers, Jason On Wed, Feb 4, 2009 at 2:28 PM, Trevor Little wrote: > I was wondering how many of you write tests for your code on a regular > basis. What modules do you use to make that easier? I'm familiar with the > Test::{Simple,More,Deep,...} family, but are there others anyone has used > and likes? Does anyone work in a place were unit testing is enforced or at > least strongly encouraged? I guess I'm just trying to figure out how other > companies/people approach this kind of unit testing. > > Thanks, > Trevor > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jason at purdy.info Wed Feb 4 12:06:44 2009 From: jason at purdy.info (Jason Purdy) Date: Wed, 4 Feb 2009 15:06:44 -0500 Subject: [Raleigh-talk] Integrating newer version of a perl module into the perl distribution... In-Reply-To: References: Message-ID: <3c4d9f1f0902041206g3dabe698kba55227fb91a1542@mail.gmail.com> I feel pretty meek saying this, given you probably already know this, James, but my approach would be to leave the source tree sacrosanct and put your newer module in some other place and then make sure that other place is higher up in the @INC list. In the past, I've been banging my head in trying to build debian packages for more up-to-date perl modules (it's sad how out-of-date they can get) and Cees Hek finally hammered cpan (cpanplus, really) into me where it won't mess w/ the debian "core." So when I want to get a Perl module, I *cpanp* it and it installs somewhere else (/usr/local/share/perl/5.8.8), overriding the out-of-date version that Debian has. Cheers, Jason On Wed, Feb 4, 2009 at 2:31 PM, James Olin Oden wrote: > HI All, > > Does anyone understand the source tree of a typical perl distribution? > I'm trying to figure out how to integrate a newer module into an > existing perl distribution (i.e. into its source tree) but I'm finding > whereas the cpan module is self contained under one directory the > sources in the perl distribution are not, splitting some files under > the ext directory and some under the lib directory. Ultimately, I'm > just trying to figure out how the the perl distribution build works in > regards to perl modules. Does anyone understand this and/or know of > documentation that would help with this. > > Thanks...james > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nwalls at ismedia.org Wed Feb 4 12:18:36 2009 From: nwalls at ismedia.org (Nathan L. Walls) Date: Wed, 4 Feb 2009 15:18:36 -0500 Subject: [Raleigh-talk] Testing In-Reply-To: <3c4d9f1f0902041159v1192435aya759aac750fdc83@mail.gmail.com> References: <3c4d9f1f0902041159v1192435aya759aac750fdc83@mail.gmail.com> Message-ID: Timely! My shop is looking at Test::More / prove after a couple years of bypassing tests in most of our Perl code. We've used Test::Unit, but consensus is there's too little benefit for creating/running harnesses for Test::Unit vs. using prove. Nathan -- http://wallscorp.us/ On Feb 4, 2009, at 2:59 PM, Jason Purdy wrote: > Testing is awesome - that's what I'm actually in the middle of right > now. My boss decided to take one of our applications and make it > available on another site. Since I wrote several test scripts for > the original application, I was able to move it over to the other > site and adapt the test scripts and over these last few days, I've > been able to hammer out the bugs and have great confidence that the > application on the new site will be pretty well-QA'd. > > We develop web applications and those are tough to test entirely > from Perl. So we (I ;) ) split test cases into client-side (I've > used Selenium and YUITest) to test javascript code and then > Test::More (I just dabbled w/ Test::HTML::Content today and love > it ... really can't go wrong w/ anything Test::* can you? ;)) to > test the web application code (written w/ CGI::Application). > > I touched a little bit about my approach in my use.perl journal. > > Cheers, > > Jason > > On Wed, Feb 4, 2009 at 2:28 PM, Trevor Little > wrote: > I was wondering how many of you write tests for your code on a > regular basis. What modules do you use to make that easier? I'm > familiar with the Test::{Simple,More,Deep,...} family, but are there > others anyone has used and likes? Does anyone work in a place were > unit testing is enforced or at least strongly encouraged? I guess > I'm just trying to figure out how other companies/people approach > this kind of unit testing. > > Thanks, > Trevor > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk > > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk From mpeters at plusthree.com Wed Feb 4 12:50:46 2009 From: mpeters at plusthree.com (Michael Peters) Date: Wed, 04 Feb 2009 15:50:46 -0500 Subject: [Raleigh-talk] Testing In-Reply-To: References: Message-ID: <4989FFA6.40201@plusthree.com> Trevor Little wrote: > I was wondering how many of you write tests for your code on a regular > basis. All the time, for everything I do! After you drink the kool-aid you'll be amazed at how much easier it makes your life for even moderately complicated projects. Not only does it help you verify that you've fixed bugs and make it easier to add new features, but you can completely change the internals of things without having to worry that you've broken everything. An example: I was talking to a friend of mine who used to work for PlusThree about some of the new things we were doing in the current release of our main product. And I told him about how we were fixing the big naming mess that our database tables and columns had gotten in to just because the product grew organically. He said something to the effect of "Yeah, we could never do that at $new_job. We have no test suite." > What modules do you use to make that easier? I'm familiar with > the Test::{Simple,More,Deep,...} family, but are there others anyone has > used and likes? My favorite test modules are: Test::WWW::Mechanize Test::HTML::Content Test::LongString Test::Class Test::Differences Test::File Test::Exception > Does anyone work in a place were unit testing is > enforced or at least strongly encouraged? We don't beat you with bamboo if you don't write tests, but we always build in time for writing tests when we're making estimates and timelines for projects. > I guess I'm just trying to > figure out how other companies/people approach this kind of unit testing. Our main project has (at the time of this email) 21,262 tests in 251 test files it's a beast to run the whole test suite (now takes over 1:15 on my development machine). So developers just have to make sure to run tests they think are related to the feature/bug they are working on. And we have a smoke box + smolder setup to tell us when anything else breaks. I run the same basic setup for the Parrot project too (http://smolder.plusthree.com/app/public_projects/smoke_reports/8) -- Michael Peters Plus Three, LP From mpeters at plusthree.com Wed Feb 4 12:57:00 2009 From: mpeters at plusthree.com (Michael Peters) Date: Wed, 04 Feb 2009 15:57:00 -0500 Subject: [Raleigh-talk] Testing In-Reply-To: References: <3c4d9f1f0902041159v1192435aya759aac750fdc83@mail.gmail.com> Message-ID: <498A011C.3010009@plusthree.com> Nathan L. Walls wrote: > We've used Test::Unit, but consensus is there's too little benefit for > creating/running harnesses for Test::Unit vs. using prove. Yeah, Test::Unit is a dead project. The Perl world is pretty heavily in bed with TAP (http://en.wikipedia.org/wiki/Test_Anything_Protocol) which is fine by me. Instead of the harness running the tests directly, it's a protocol which allows the tests and the harness to communicate about what happened. It's a nice decoupling because it means you can test other things besides just Perl scripts, like a web API or a database (there's pgTAP for PostgreSQL). If you want the same basic organization of xUnit style tests, I'd recommend Test::Class. It gives you the same setup/teardown/, startup/shutdown hooks as well as letting you group related tests into methods. And it outputs TAP so it works with the rest of the Perl testing infrastructure. -- Michael Peters Plus Three, LP From james.oden at gmail.com Wed Feb 4 12:38:53 2009 From: james.oden at gmail.com (James Olin Oden) Date: Wed, 4 Feb 2009 15:38:53 -0500 Subject: [Raleigh-talk] Integrating newer version of a perl module into the perl distribution... In-Reply-To: <3c4d9f1f0902041206g3dabe698kba55227fb91a1542@mail.gmail.com> References: <3c4d9f1f0902041206g3dabe698kba55227fb91a1542@mail.gmail.com> Message-ID: On Wed, Feb 4, 2009 at 3:06 PM, Jason Purdy wrote: > I feel pretty meek saying this, given you probably already know this, James, > but my approach would be to leave the source tree sacrosanct and put your > newer module in some other place and then make sure that other place is > higher up in the @INC list. > At least on RedHat 4.x perl is built with its own install dirs first in @INC. I played around with setting the INSTALLDIRS option to site, but this didn't help as perl still looked in its own dirs first. Installing it somewhere completely different and then setting PERL5LIB is not really that desirable, as I'd rather have scripts just use the new one if possible. The worse part is this is down some deep dive into dependency hell as I'm trying to use WSRF::Lite, but one of its deps, deps, deps needs a newer Cwd(3pm), which now come in PathUtils distribution containing both Cwd and File::Spec. Worse the new distro does not use MakeMaker. In the perl distro that I'm using the sources seem to use MakeMaker (I don't know its build even supports Build.PL for building internal libs), and it has, as I had mentioned the sources for Cwd across two directories. Its just a build though, but it would be nice if perl's source distribution structure was documented somewhere (and maybe it is...I just haven't found it). Oh in all of this, I failed to mention that this going into an internal Linux distro and everything has to be packaged up cleanly (no two packages owning the same files). But, really, thanks for the input...I may do what you said as right now we only have one app using WSRF::Lite, and I control it so I can of course make sure it looks for its own libraries where it ought to look. > In the past, I've been banging my head in trying to build debian packages > for more up-to-date perl modules (it's sad how out-of-date they can get) and > Cees Hek finally hammered cpan (cpanplus, really) into me where it won't > mess w/ the debian "core." So when I want to get a Perl module, I cpanp it > and it installs somewhere else (/usr/local/share/perl/5.8.8), overriding the > out-of-date version that Debian has. Yeah, if they had perl's @INC go site_perl, vender_perl, and then perl, I'd be good. BTW, my little dependency hell I've been going through expanded into 25 packages/cpan modules. Thanks again...james From nwalls at ismedia.org Wed Feb 4 13:10:31 2009 From: nwalls at ismedia.org (Nathan L. Walls) Date: Wed, 4 Feb 2009 16:10:31 -0500 Subject: [Raleigh-talk] Testing In-Reply-To: <498A011C.3010009@plusthree.com> References: <3c4d9f1f0902041159v1192435aya759aac750fdc83@mail.gmail.com> <498A011C.3010009@plusthree.com> Message-ID: <09DF5474-6839-4E76-96B1-C31791A75416@ismedia.org> On Feb 4, 2009, at 3:57 PM, Michael Peters wrote: > Nathan L. Walls wrote: > >> We've used Test::Unit, but consensus is there's too little benefit >> for creating/running harnesses for Test::Unit vs. using prove. > > Yeah, Test::Unit is a dead project. The Perl world is pretty heavily > in bed with TAP (http://en.wikipedia.org/wiki/ > Test_Anything_Protocol) which is fine by me. Instead of the harness > running the tests directly, it's a protocol which allows the tests > and the harness to communicate about what happened. It's a nice > decoupling because it means you can test other things besides just > Perl scripts, like a web API or a database (there's pgTAP for > PostgreSQL). > > If you want the same basic organization of xUnit style tests, I'd > recommend Test::Class. It gives you the same setup/teardown/, > startup/shutdown hooks as well as letting you group related tests > into methods. And it outputs TAP so it works with the rest of the > Perl testing infrastructure. Ah, good to know. It's been that long since I've even looked at writing Test::Unit tests. We had a detour into Ruby and rspec before returning to part of our Perl codebase. Our love for unit testing developed during that time is just catching up with us again. Nathan From trevormg19 at gmail.com Wed Feb 11 14:11:39 2009 From: trevormg19 at gmail.com (Trevor Little) Date: Wed, 11 Feb 2009 17:11:39 -0500 Subject: [Raleigh-talk] life without use strict Message-ID: Consider the following code: 1 #!/usr/bin/perl 2 3 #NOPE!#use strict; 4 5 my $var; 6 $var = 1; 7 $var->{key} = '123456789'; 8 9 print $var . "\n"; 10 print $var->{key} . "\n"; After line 7, does $var hold a hashref, or the number 1? If you turn back on use strict, you get the following error: Can't use string ("1") as a HASH ref while "strict refs" in use at creepy.pl line 7. So it looks like perl is storing the number 1, but with strict off the output is: 1 123456789 What's going on here? I'm running perl 5.8.8. It seems like something should either be a hasref or not. I didn't realize perl would be this context sensitive, even with strict off. -- Trevor From mpeters at plusthree.com Wed Feb 11 14:20:07 2009 From: mpeters at plusthree.com (Michael Peters) Date: Wed, 11 Feb 2009 17:20:07 -0500 Subject: [Raleigh-talk] life without use strict In-Reply-To: References: Message-ID: <49934F17.6040905@plusthree.com> Trevor Little wrote: > So it looks like perl is storing the number 1, but with strict off the > output is: > > 1 > 123456789 > > What's going on here? I'm running perl 5.8.8. It seems like something > should either be a hasref or not. I didn't realize perl would be this > context sensitive, even with strict off. Very strange. Sounds like a question for StackOverflow :) -- Michael Peters Plus Three, LP From iank at cpan.org Wed Feb 11 14:51:05 2009 From: iank at cpan.org (Ian Kilgore) Date: Wed, 11 Feb 2009 17:51:05 -0500 Subject: [Raleigh-talk] life without use strict In-Reply-To: References: Message-ID: <20090211225105.GF21046@iank.org> On Wed, Feb 11, 2009 at 05:11:39PM -0500, Trevor Little wrote: > Consider the following code: > > 1 #!/usr/bin/perl > 2 > 3 #NOPE!#use strict; > 4 > 5 my $var; > 6 $var = 1; > 7 $var->{key} = '123456789'; > 8 > 9 print $var . "\n"; > 10 print $var->{key} . "\n"; > [...] > > What's going on here? I'm running perl 5.8.8. It seems like something > should either be a hasref or not. I didn't realize perl would be this > context sensitive, even with strict off. > > -- > Trevor without strict, it's using "1" as a symbolic ref. Try this: $var = "1"; $var->{foo} = 'bar'; $foo = "1"; print $foo->{foo}; You ought to get 'bar'. With strict 'refs', it will refuse to use symbolic references, so it won't use "1" as a reference, and you don't get that far. -- Ian Kilgore -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From trevormg19 at gmail.com Thu Feb 12 05:19:55 2009 From: trevormg19 at gmail.com (Trevor Little) Date: Thu, 12 Feb 2009 08:19:55 -0500 Subject: [Raleigh-talk] life without use strict In-Reply-To: <20090211225105.GF21046@iank.org> References: <20090211225105.GF21046@iank.org> Message-ID: Ian, You're absolutely right. I knew it was using a symbolic reference, but somehow I didn't put all the pieces together. In the code where I found this the var was getting passed several methods deep before being dereferenced and I think that got me confused. Anyway, that's for setting me straight. Trevor On Wed, 11 Feb 2009 17:51:05 -0500, Ian Kilgore wrote: > On Wed, Feb 11, 2009 at 05:11:39PM -0500, Trevor Little wrote: >> Consider the following code: >> >> 1 #!/usr/bin/perl >> 2 >> 3 #NOPE!#use strict; >> 4 >> 5 my $var; >> 6 $var = 1; >> 7 $var->{key} = '123456789'; >> 8 >> 9 print $var . "\n"; >> 10 print $var->{key} . "\n"; >> > > [...] > >> >> What's going on here? I'm running perl 5.8.8. It seems like something >> should either be a hasref or not. I didn't realize perl would be this >> context sensitive, even with strict off. >> >> -- >> Trevor > > without strict, it's using "1" as a symbolic ref. Try this: > > $var = "1"; > $var->{foo} = 'bar'; > > $foo = "1"; > print $foo->{foo}; > > You ought to get 'bar'. > > With strict 'refs', it will refuse to use symbolic references, so it > won't use "1" as a reference, and you don't get that far. From msouth at gmail.com Thu Feb 12 09:24:56 2009 From: msouth at gmail.com (Mike South) Date: Thu, 12 Feb 2009 11:24:56 -0600 Subject: [Raleigh-talk] life without use strict In-Reply-To: References: <20090211225105.GF21046@iank.org> Message-ID: On Thu, Feb 12, 2009 at 7:19 AM, Trevor Little wrote: > Ian, > You're absolutely right. I knew it was using a symbolic reference, but > somehow I didn't put all the pieces together. In the code where I found this > the var was getting passed several methods deep before being dereferenced > and I think that got me confused. Anyway, that's for setting me straight. Something to keep in mind with code like this is that if, say, $var gets incremented, your next deref will be of a completely different variable: #!/usr/bin/perl my $var; $var = 1; $var->{key} = '123456789'; print "$var->{key} is what it is now, but \$var->{key} after \$var is ++'d: (giving [". ++$var . "]) is [$var->{key}]\n"; gives "123456789 is what it is now, but $var->{key} after $var is ++'d: (giving [2]) is []" mike > > Trevor > > On Wed, 11 Feb 2009 17:51:05 -0500, Ian Kilgore wrote: > >> On Wed, Feb 11, 2009 at 05:11:39PM -0500, Trevor Little wrote: >>> >>> Consider the following code: >>> >>> 1 #!/usr/bin/perl >>> 2 >>> 3 #NOPE!#use strict; >>> 4 >>> 5 my $var; >>> 6 $var = 1; >>> 7 $var->{key} = '123456789'; >>> 8 >>> 9 print $var . "\n"; >>> 10 print $var->{key} . "\n"; >>> >> >> [...] >> >>> >>> What's going on here? I'm running perl 5.8.8. It seems like something >>> should either be a hasref or not. I didn't realize perl would be this >>> context sensitive, even with strict off. >>> >>> -- >>> Trevor >> >> without strict, it's using "1" as a symbolic ref. Try this: >> >> $var = "1"; >> $var->{foo} = 'bar'; >> >> $foo = "1"; >> print $foo->{foo}; >> >> You ought to get 'bar'. >> >> With strict 'refs', it will refuse to use symbolic references, so it >> won't use "1" as a reference, and you don't get that far. > > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk > From trevormg19 at gmail.com Thu Feb 12 10:02:56 2009 From: trevormg19 at gmail.com (Trevor Little) Date: Thu, 12 Feb 2009 13:02:56 -0500 Subject: [Raleigh-talk] life without use strict In-Reply-To: References: <20090211225105.GF21046@iank.org> Message-ID: Yeah, The example I e-mailed out was a minimalistic version of what I found in live code. In the real code the '1' was passed through several subroutines until finally getting dereferenced. The fact that we were still getting the data we wanted at that point was sheer luck. Much could have gone wrong. Anyway, thanks again for the help everybody. I guess this goes into the "that's why my mother always told me to use strict" pile. Trevor On Thu, 12 Feb 2009 12:24:56 -0500, Mike South wrote: > On Thu, Feb 12, 2009 at 7:19 AM, Trevor Little > wrote: >> Ian, >> You're absolutely right. I knew it was using a symbolic reference, but >> somehow I didn't put all the pieces together. In the code where I found >> this >> the var was getting passed several methods deep before being >> dereferenced >> and I think that got me confused. Anyway, that's for setting me >> straight. > > Something to keep in mind with code like this is that if, say, $var > gets incremented, your next deref will be of a completely different > variable: > > #!/usr/bin/perl > > my $var; > $var = 1; > $var->{key} = '123456789'; > > print "$var->{key} is what it is now, but \$var->{key} after \$var is > ++'d: (giving [". ++$var . "]) is [$var->{key}]\n"; > > gives "123456789 is what it is now, but $var->{key} after $var is > ++'d: (giving [2]) is []" > > mike >> >> Trevor >> >> On Wed, 11 Feb 2009 17:51:05 -0500, Ian Kilgore wrote: >> >>> On Wed, Feb 11, 2009 at 05:11:39PM -0500, Trevor Little wrote: >>>> >>>> Consider the following code: >>>> >>>> 1 #!/usr/bin/perl >>>> 2 >>>> 3 #NOPE!#use strict; >>>> 4 >>>> 5 my $var; >>>> 6 $var = 1; >>>> 7 $var->{key} = '123456789'; >>>> 8 >>>> 9 print $var . "\n"; >>>> 10 print $var->{key} . "\n"; >>>> >>> >>> [...] >>> >>>> >>>> What's going on here? I'm running perl 5.8.8. It seems like something >>>> should either be a hasref or not. I didn't realize perl would be this >>>> context sensitive, even with strict off. >>>> >>>> -- >>>> Trevor >>> >>> without strict, it's using "1" as a symbolic ref. Try this: >>> >>> $var = "1"; >>> $var->{foo} = 'bar'; >>> >>> $foo = "1"; >>> print $foo->{foo}; >>> >>> You ought to get 'bar'. >>> >>> With strict 'refs', it will refuse to use symbolic references, so it >>> won't use "1" as a reference, and you don't get that far. >> >> _______________________________________________ >> Raleigh-talk mailing list >> Raleigh-talk at pm.org >> http://mail.pm.org/mailman/listinfo/raleigh-talk >> > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk -- Trevor From iank at cpan.org Thu Feb 12 11:08:01 2009 From: iank at cpan.org (Ian Kilgore) Date: Thu, 12 Feb 2009 14:08:01 -0500 Subject: [Raleigh-talk] life without use strict In-Reply-To: References: <20090211225105.GF21046@iank.org> Message-ID: <20090212190801.GA16777@iank.org> On Thu, Feb 12, 2009 at 01:02:56PM -0500, Trevor Little wrote: > Yeah, > The example I e-mailed out was a minimalistic version of what I found > in live code. In the real code the '1' was passed through several > subroutines until finally getting dereferenced. The fact that we were > still getting the data we wanted at that point was sheer luck. Much could > have gone wrong. Anyway, thanks again for the help everybody. I guess this > goes into the "that's why my mother always told me to use strict" pile. > > Trevor > > -- > Trevor Why was strict 'refs' off in live code? -- Ian Kilgore print/42; # n/,"Just another Perl hacker,\n" -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From trevormg19 at gmail.com Thu Feb 12 11:44:31 2009 From: trevormg19 at gmail.com (Trevor Little) Date: Thu, 12 Feb 2009 14:44:31 -0500 Subject: [Raleigh-talk] life without use strict In-Reply-To: <20090212190801.GA16777@iank.org> References: <20090211225105.GF21046@iank.org> <20090212190801.GA16777@iank.org> Message-ID: On accident. use strict was placed inside a BEGIN {} block. So it was only in affect in that block, not the rest of the module. On Thu, 12 Feb 2009 14:08:01 -0500, Ian Kilgore wrote: > On Thu, Feb 12, 2009 at 01:02:56PM -0500, Trevor Little wrote: >> Yeah, >> The example I e-mailed out was a minimalistic version of what I found >> in live code. In the real code the '1' was passed through several >> subroutines until finally getting dereferenced. The fact that we were >> still getting the data we wanted at that point was sheer luck. Much >> could >> have gone wrong. Anyway, thanks again for the help everybody. I guess >> this >> goes into the "that's why my mother always told me to use strict" pile. >> >> Trevor >> >> -- >> Trevor > > Why was strict 'refs' off in live code? -- Trevor From trevormg19 at gmail.com Mon Feb 23 08:13:44 2009 From: trevormg19 at gmail.com (Trevor Little) Date: Mon, 23 Feb 2009 11:13:44 -0500 Subject: [Raleigh-talk] Code review Message-ID: Do you guys do code reviews where you work? Are there any good tools out there to make this easier? -- Trevor From james.oden at gmail.com Mon Feb 23 09:42:28 2009 From: james.oden at gmail.com (James Olin Oden) Date: Mon, 23 Feb 2009 12:42:28 -0500 Subject: [Raleigh-talk] Code review In-Reply-To: References: Message-ID: We use code collaberator. It seems to be pretty good, with some minor annoyances, at least they are minor from my perspective....james On Mon, Feb 23, 2009 at 11:13 AM, Trevor Little wrote: > Do you guys do code reviews where you work? Are there any good tools out > there to make this easier? > > -- > Trevor > _______________________________________________ > Raleigh-talk mailing list > Raleigh-talk at pm.org > http://mail.pm.org/mailman/listinfo/raleigh-talk >