From megamic at gmail.com Tue Jun 3 02:00:51 2008 From: megamic at gmail.com (Michael Potter) Date: Tue, 3 Jun 2008 19:00:51 +1000 Subject: [Canberra-pm] Meetup June 7th Message-ID: <167f9c460806030200t2996e79tc69affea55827113@mail.gmail.com> Hi All In absence of much feedback regarding preferred times to meetup, I have decided to just book in a time and see what happens. It seems like a busy time for everyone (me included), but it would be great if people could get together for a drink at least. The details for the meet are: Meet for drinks: Date: 6th June 2008 Time: 18:00 - 18:30 Venue: Gus' Cafe (Same cafe we had drink last time) Directions: http://maps.google.com.au/maps?hl=en&safe=off&rlz=1B3GGGL_enAU203AU203&q=bunda%20st%20civic&um=1&ie=UTF-8&sa=N&tab=wl After this we can decide where to go for dinner. Hope to see you all there =) I can be contacted on 0423 467 325 if you need to chat directly. Cheers MichaelP -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080603/55dbe7a0/attachment.html From megamic at gmail.com Wed Jun 4 04:12:15 2008 From: megamic at gmail.com (Michael Potter) Date: Wed, 4 Jun 2008 21:12:15 +1000 Subject: [Canberra-pm] Clarification: Meetup is on Friday 6th June Message-ID: <167f9c460806040412i781c5453teab9d454c3ae9956@mail.gmail.com> In case anyone was confused by my previous email that had the 7th in the comment line =) Here are the details again: > > Meet for drinks: > Date: Friday, 6th June 2008 > Time: 18:00 - 18:30 > Venue: Gus' Cafe (Same cafe we had drink last time) > Directions: > > http://maps.google.com.au/maps?hl=en&safe=off&rlz=1B3GGGL_enAU203AU203&q=bunda%20st%20civic&um=1&ie=UTF-8&sa=N&tab=wl > > After this we can decide where to go for dinner. > > Hope to see you all there =) > > I can be contacted on 0423 467 325 if you need to chat directly. > > Cheers > MichaelP > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080604/6a97c09b/attachment.html From megamic at gmail.com Thu Jun 12 01:48:04 2008 From: megamic at gmail.com (Michael Potter) Date: Thu, 12 Jun 2008 18:48:04 +1000 Subject: [Canberra-pm] 6th June Meeting wrap-up Message-ID: <167f9c460806120148m5f6419f4pf927b37ab7e9d533@mail.gmail.com> Greetings, The last Canberra.PM meetup was held on 6th. Attendees were Michael, Guy and David. What we lacked in numbers we made up for in enthusiasm...=) This is the Perl.net.au posting: Brief: * Discussed the state of scripting languages in general, and Perl6 in particular. * Talked about how and why we use Perl, and what sets it apart. * Discussed the idea of a group Project. David brought along a great idea, which is to take an existing project he has been working on (a hospital rostering system), and convert it from Access/VBA to a database driven web-based system using Perl,AJAX and even Prolog for the decision engine. Outcomes: * Future meeting will be held monthly at most, and we will try and organize talks or special events. * The project group can continue on an independent path, so as not to exclude people from the meet-ups who aren't part of the project. * Michael and David seem keen to participate in the project. Guy has less time on his hands, but may be able to use his experience to offer guidance and support. *Some further details regarding the project that would have been extraneous on the web page:* All three of us agreed that the project proposal from David was a very good start. As Guy said, it covered all bases: utilizing a database back-end that will be interfaced with DBI; a solid middle layer containing some real decision making logic, possibly incorporating a Logic processing language (eg Prolog) to encode the logic rules and whatnot; and a dynamic, web-based front-end that utilizes some techniques Michael is very fond of...particularly using AJAJ (the last J stands for JSON ;) to enable complex data structures to be easily sent from Perl to JavaScript. We are now awaiting some samples of the existing application from David in order to begin designing and prototyping. Another point Michael was very keen to get across is that the project should be learning focused rather than outcome focused (or should I just say the outcome should be learning =/). That is to say, we shouldn't be overly concerned if we actually produce a complete, finished product or not, but rather what we learn along the way. Particular, some aspects of programming in general that are often overlooked: testing and test-driven development; benchmarking and optimization; quality POD based documentation; proper version control using SVN (Guy offered to help us on this one!); inside-out OO programming using Class::Std; generally try to adhere to as many points from Perl Best Practices as we can (or agree with); build Modules to CPAN standard using h2xs; etcetera etcetera... * Final Comments: *Paul W, if you are out there and still keen to join in, drop us an email! Cheers everyone, MP -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080612/f1887511/attachment.html From nick at remedios-cole.id.au Thu Jun 12 20:14:41 2008 From: nick at remedios-cole.id.au (Nick dos Remedios) Date: Fri, 13 Jun 2008 13:14:41 +1000 Subject: [Canberra-pm] Anyone looking for a Perl programmer in Canberra? Message-ID: <61DC84BB-E81E-49AC-B1E4-B9894457C06F@remedios-cole.id.au> Hi All, Sorry in advanced if my post is contrary to list rules (I couldn't find any)... I'm currently looking for work here in Canberra. I have 8+ years experience developing in Perl -- web apps, XML/XSLT and bioinformatics experience. Resume available on request. Cheers Nick -- Nick dos Remedios, PhD nick at remedios-cole.id.au From jarich at perltraining.com.au Thu Jun 12 20:29:58 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Fri, 13 Jun 2008 13:29:58 +1000 Subject: [Canberra-pm] Who's using Perl 5.10? Message-ID: <4851E9B6.5000706@perltraining.com.au> G'day! There are lots of good reasons to use Perl 5.10 (http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 ), but who's managed to get it on to their personal machine? development machines? testing? production? If you're not using 5.10 what versions are you using? This is an informal poll, but I'd love everyone who can to spend a couple of seconds responding. FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm not sure what I use on my laptop - probably 5.8.something - haven't looked recently. All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From pjf at perltraining.com.au Thu Jun 12 21:15:56 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Fri, 13 Jun 2008 14:15:56 +1000 Subject: [Canberra-pm] [Sydney-pm] Who's using Perl 5.10? In-Reply-To: <4851E9AC.7050800@perltraining.com.au> References: <4851E9AC.7050800@perltraining.com.au> Message-ID: <4851F47C.4050309@perltraining.com.au> G'day (?:Syd|Melb|Canberra).pm, Cross-posting, since Jacinta asked in a few different places. Jacinta Richardson wrote (paraphrased): > Who uses Perl 5.10? On Win32 native, I do. It's dead easy to install, just grab Strawberry or ActiveState Perl and double-click. It's also pretty important because my latest project[1] currently only runs under Perl 5.10. On Win32 Cygwin, I have 5.8.8 installed natively (it's what cygwin comes with), and 5.11/blead installed in my dev area. Unfortunately all my Unix boxes are still on 5.8, and all for pretty much the same reason as we've seen on some of the perl mongers lists already. Most of the unix distributions still come with 5.8, and doing my own packaging for 5.10 represents a huge amount of work. The notable exception to this is RedHat, I believe the latest Fedora Core comes with 5.10 as standard. I note that lenny (RedHat testing) is using 5.10. So I imagine that we'll see big 5.10 rollouts once Debian declare lenny to be stable. Adam's note on Sydney.pm showing the huge number of 5.10 installs vs 5.8 is probably quite indicative of Win32 leading the charge. Because there isn't a central package repository for Win32, it's easy to just grab the latest and greatest right now, rather than waiting for the packagers to catch up. Cheerio, Paul [1] autodie, see http://search.cpan.org/perldoc?autodie for documentation and download, and http://pjf.id.au/blog/?position=540 for the video. -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From grail at goldweb.com.au Thu Jun 12 21:27:12 2008 From: grail at goldweb.com.au (Alex Satrapa) Date: Fri, 13 Jun 2008 14:27:12 +1000 Subject: [Canberra-pm] Who's using Perl 5.10? In-Reply-To: <4851E9B6.5000706@perltraining.com.au> References: <4851E9B6.5000706@perltraining.com.au> Message-ID: <8136DBB2-6DEF-4FBD-B43F-EC8DB69C056A@goldweb.com.au> On 13/06/2008, at 13:29 , Jacinta Richardson wrote: > If you're not using 5.10 what versions are you using? Perl 5.8.8 as provided by Debian "stable" Perl 5.8.8 as provided by Apple with Mac OS X 10.5 Perl 5.8.6 as provided by Apple with Mac OS X 10.4 All of this to maintain a mere 30k lines of code Alex From megamic at gmail.com Fri Jun 13 18:20:45 2008 From: megamic at gmail.com (Michael Potter) Date: Sat, 14 Jun 2008 11:20:45 +1000 Subject: [Canberra-pm] employment related posts Message-ID: <167f9c460806131820y1d377158i5a0cc1bc31a01dc2@mail.gmail.com> Hi All Nick, in relation to posting 'work wanted' ads, your more than welcome, and this is probably a good place to do it! Employers are also free to place 'work available' ads, so long as they are general and are not directly soliciting individuals on the list (which is forbidden). Thanks for pointing out the lack of available rules, I will look into that. Cheers MP On Sat, Jun 14, 2008 at 5:00 AM, wrote: > Send Canberra-pm mailing list submissions to > canberra-pm at pm.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.pm.org/mailman/listinfo/canberra-pm > or, via email, send a message with subject or body 'help' to > canberra-pm-request at pm.org > > You can reach the person managing the list at > canberra-pm-owner at pm.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Canberra-pm digest..." > > > Today's Topics: > > 1. Anyone looking for a Perl programmer in Canberra? > (Nick dos Remedios) > 2. Who's using Perl 5.10? (Jacinta Richardson) > 3. Re: [Sydney-pm] Who's using Perl 5.10? (Paul Fenwick) > 4. Re: Who's using Perl 5.10? (Alex Satrapa) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 13 Jun 2008 13:14:41 +1000 > From: Nick dos Remedios > Subject: [Canberra-pm] Anyone looking for a Perl programmer in > Canberra? > To: canberra-pm at pm.org > Message-ID: <61DC84BB-E81E-49AC-B1E4-B9894457C06F at remedios-cole.id.au> > Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed > > Hi All, > > Sorry in advanced if my post is contrary to list rules (I couldn't > find any)... > > I'm currently looking for work here in Canberra. I have 8+ years > experience developing in Perl -- web apps, XML/XSLT and > bioinformatics experience. Resume available on request. > > Cheers > > Nick > -- > Nick dos Remedios, PhD > nick at remedios-cole.id.au > > > ------------------------------ > > Message: 2 > Date: Fri, 13 Jun 2008 13:29:58 +1000 > From: Jacinta Richardson > Subject: [Canberra-pm] Who's using Perl 5.10? > To: canberra-pm at pm.org > Message-ID: <4851E9B6.5000706 at perltraining.com.au> > Content-Type: text/plain; charset=ISO-8859-1 > > G'day! > > There are lots of good reasons to use Perl 5.10 > ( > http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? development > machines? testing? production? > > If you're not using 5.10 what versions are you using? > > This is an informal poll, but I'd love everyone who can to spend a couple > of > seconds responding. > > FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm not > sure > what I use on my laptop - probably 5.8.something - haven't looked recently. > > All the best, > > J > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > > > > ------------------------------ > > Message: 3 > Date: Fri, 13 Jun 2008 14:15:56 +1000 > From: Paul Fenwick > Subject: Re: [Canberra-pm] [Sydney-pm] Who's using Perl 5.10? > To: Sydney PM , Melbourne Perl Mongers > , canberra-pm at pm.org > Message-ID: <4851F47C.4050309 at perltraining.com.au> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > G'day (?:Syd|Melb|Canberra).pm, > > Cross-posting, since Jacinta asked in a few different places. > > Jacinta Richardson wrote (paraphrased): > > > Who uses Perl 5.10? > > On Win32 native, I do. It's dead easy to install, just grab Strawberry or > ActiveState Perl and double-click. It's also pretty important because my > latest project[1] currently only runs under Perl 5.10. > > On Win32 Cygwin, I have 5.8.8 installed natively (it's what cygwin comes > with), and 5.11/blead installed in my dev area. > > Unfortunately all my Unix boxes are still on 5.8, and all for pretty much > the same reason as we've seen on some of the perl mongers lists already. > Most of the unix distributions still come with 5.8, and doing my own > packaging for 5.10 represents a huge amount of work. > > The notable exception to this is RedHat, I believe the latest Fedora Core > comes with 5.10 as standard. I note that lenny (RedHat testing) is using > 5.10. So I imagine that we'll see big 5.10 rollouts once Debian declare > lenny to be stable. > > Adam's note on Sydney.pm showing the huge number of 5.10 installs vs 5.8 is > probably quite indicative of Win32 leading the charge. Because there isn't > a central package repository for Win32, it's easy to just grab the latest > and greatest right now, rather than waiting for the packagers to catch up. > > Cheerio, > > Paul > > [1] autodie, see http://search.cpan.org/perldoc?autodie for documentation > and download, and http://pjf.id.au/blog/?position=540 for the video. > > -- > Paul Fenwick | http://perltraining.com.au/ > Director of Training | Ph: +61 3 9354 6001 > Perl Training Australia | Fax: +61 3 9354 2681 > > > ------------------------------ > > Message: 4 > Date: Fri, 13 Jun 2008 14:27:12 +1000 > From: Alex Satrapa > Subject: Re: [Canberra-pm] Who's using Perl 5.10? > To: canberra-pm at pm.org > Message-ID: <8136DBB2-6DEF-4FBD-B43F-EC8DB69C056A at goldweb.com.au> > Content-Type: text/plain; charset=US-ASCII; format=flowed > > On 13/06/2008, at 13:29 , Jacinta Richardson wrote: > > > If you're not using 5.10 what versions are you using? > > Perl 5.8.8 as provided by Debian "stable" > Perl 5.8.8 as provided by Apple with Mac OS X 10.5 > Perl 5.8.6 as provided by Apple with Mac OS X 10.4 > > All of this to maintain a mere 30k lines of code > > Alex > > > > ------------------------------ > > _______________________________________________ > Canberra-pm mailing list > Canberra-pm at pm.org > http://mail.pm.org/mailman/listinfo/canberra-pm > > End of Canberra-pm Digest, Vol 39, Issue 4 > ****************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080614/9c3526c2/attachment.html From megamic at gmail.com Fri Jun 13 18:27:22 2008 From: megamic at gmail.com (Michael Potter) Date: Sat, 14 Jun 2008 11:27:22 +1000 Subject: [Canberra-pm] Who's using Perl 5.10? Message-ID: <167f9c460806131827v184335a7q1997756bc06ef7c7@mail.gmail.com> I use 5.10 at home under Cygwin and Debian (the // alone makes it all worthwhile) At work I am stuck with 5.6 under on an old SunOS box, and 5.8.4 under Solaris 10. I keep pestering the admin's about it, but they will only install official Sun packages (which apparently don't yet include 5.10). =( Cheerio -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080614/1a590284/attachment.html From stray at mac.com Fri Jun 13 19:20:05 2008 From: stray at mac.com (Matthew Sheppard) Date: Sat, 14 Jun 2008 12:20:05 +1000 Subject: [Canberra-pm] Canberra-pm Digest, Vol 39, Issue 4 In-Reply-To: References: Message-ID: <8AE8056C-06AC-4C20-8409-E465EB35800B@mac.com> > I'm currently looking for work here in Canberra. I have 8+ years > experience developing in Perl -- web apps, XML/XSLT and > bioinformatics experience. Resume available on request. Hi Nick, I don't know that they're currently looking for anyone, but it might be worth getting in touch with Funnelback (www.funnelback.com) - They're a search engine company who are based over near Black Mountain who use Perl pretty heavily. Matt From kim at holburn.net Sat Jun 14 01:15:38 2008 From: kim at holburn.net (Kim Holburn) Date: Sat, 14 Jun 2008 10:15:38 +0200 Subject: [Canberra-pm] how to tell if a library is available? Message-ID: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> I have a script which could use a library (Text::Autoformat) if it's available in the current libs or if it's in the directory the script is in. I'd like a simple test to tell this before I either try and use it or use a work-around. Is there any simple test for this? -- Kim Holburn IT Network & Security Consultant Ph: +39 06 855 4294 M: +39 3494957443 mailto:kim at holburn.net aim://kimholburn skype://kholburn - PGP Public Key on request Democracy imposed from without is the severest form of tyranny. -- Lloyd Biggle, Jr. Analog, Apr 1961 From jarich at perltraining.com.au Sat Jun 14 02:40:16 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sat, 14 Jun 2008 19:40:16 +1000 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> Message-ID: <48539200.1040504@perltraining.com.au> Kim Holburn wrote: > I have a script which could use a library (Text::Autoformat) if it's > available in the current libs or if it's in the directory the script > is in. I'd like a simple test to tell this before I either try and > use it or use a work-around. > > Is there any simple test for this? Try using it with a string eval and then check $@. For example: eval "use Foo;"; if($@) { print "Could not find Foo\n"; } eval "use Bar;"; if($@) { print "Could not find Bar: $@\n"; } print "Program completed\n"; with Foo.pm being: package Foo; print "Foo!\n"; 1; yields: jarich at teddybear:/tmp$ perl test.pl Foo! Could not find Bar: Can't locate Bar.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 .) at (eval 2) line 1. BEGIN failed--compilation aborted at (eval 2) line 1. Program completed If you choose to try to use a second module upon failing the first, remember to save $@ if you ever intend to use it: eval "use Foo;"; if(my $E = $@) { print "Could not find Foo, trying Bar\n"; eval "use Bar;"; # $@ has now changed! } I hope this helps. J From kim at holburn.net Mon Jun 16 10:30:46 2008 From: kim at holburn.net (Kim Holburn) Date: Mon, 16 Jun 2008 19:30:46 +0200 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <48539200.1040504@perltraining.com.au> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> Message-ID: OK, thanks, that's good but I have a problem. Maybe this is a dumb question but if I test for this and in one branch of the test I invoke the library with a use statement it works if the library is present but not if it's not there: eval "use Text::Autoformat" ; if (!$@) { use Text::Autoformat ; .... Can't locate Text/Autoformat.pm in @INC (@INC contains: ... ) at script.pl line 316. BEGIN failed--compilation aborted at script.pl line 316. Am I mistaken here? Do I need to have a "use" statement in addition to the eval? If I don't have the use statement I get lots of other errors (using -w). Kim On 2008/Jun/14, at 11:40 AM, Jacinta Richardson wrote: > Kim Holburn wrote: >> I have a script which could use a library (Text::Autoformat) if >> it's available in the current libs or if it's in the directory the >> script is in. I'd like a simple test to tell this before I either >> try and use it or use a work-around. >> Is there any simple test for this? > > Try using it with a string eval and then check $@. For example: > > eval "use Foo;"; > if($@) { > print "Could not find Foo\n"; > } > > eval "use Bar;"; > if($@) { > print "Could not find Bar: $@\n"; > } > > print "Program completed\n"; > > > with Foo.pm being: > > package Foo; > > print "Foo!\n"; > > 1; > > yields: > > jarich at teddybear:/tmp$ perl test.pl > Foo! > Could not find Bar: Can't locate Bar.pm in @INC (@INC contains: > /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 > /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 > /usr/share/perl/5.8 /usr/local/lib/site_perl > /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 .) at > (eval 2) line 1. > BEGIN failed--compilation aborted at (eval 2) line 1. > > Program completed > > If you choose to try to use a second module upon failing the first, > remember to save $@ if you ever intend to use it: > > eval "use Foo;"; > if(my $E = $@) { > print "Could not find Foo, trying Bar\n"; > eval "use Bar;"; > # $@ has now changed! > } > > I hope this helps. > > J -- Kim Holburn IT Network & Security Consultant Ph: +39 06 855 4294 M: +39 3494957443 mailto:kim at holburn.net aim://kimholburn skype://kholburn - PGP Public Key on request Democracy imposed from without is the severest form of tyranny. -- Lloyd Biggle, Jr. Analog, Apr 1961 From george.s.bills at gmail.com Mon Jun 16 20:07:07 2008 From: george.s.bills at gmail.com (George Bills) Date: Tue, 17 Jun 2008 13:07:07 +1000 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <8b7e18730806162005o64e20766i8675599028bcfac@mail.gmail.com> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> <8b7e18730806162005o64e20766i8675599028bcfac@mail.gmail.com> Message-ID: <8b7e18730806162007p5aadca83wb3683492a87c0a99@mail.gmail.com> Hi Kim, Text::Autoformat should already have been used in the eval, so you don't need to use it again inside the "if not eval error" block. I'm a little hazy here, so maybe someone should correct me, but I think that code there will try and "use Text::Autoformat" regardless of what happens in the eval - because that use statement is evaluated at compile time, before any other code (like the eval and the if statement). On Tue, Jun 17, 2008 at 3:30 AM, Kim Holburn wrote: > OK, thanks, that's good but I have a problem. Maybe this is a dumb > question but if I test for this and in one branch of the test I invoke > the library with a use statement it works if the library is present > but not if it's not there: > > eval "use Text::Autoformat" ; > if (!$@) { > use Text::Autoformat ; > .... > > Can't locate Text/Autoformat.pm in @INC (@INC contains: ... > ) at script.pl line 316. > BEGIN failed--compilation aborted at script.pl line 316. > > > Am I mistaken here? Do I need to have a "use" statement in addition > to the eval? > > If I don't have the use statement I get lots of other errors (using -w). > > Kim > > On 2008/Jun/14, at 11:40 AM, Jacinta Richardson wrote: > >> Kim Holburn wrote: >>> I have a script which could use a library (Text::Autoformat) if >>> it's available in the current libs or if it's in the directory the >>> script is in. I'd like a simple test to tell this before I either >>> try and use it or use a work-around. >>> Is there any simple test for this? >> >> Try using it with a string eval and then check $@. For example: >> >> eval "use Foo;"; >> if($@) { >> print "Could not find Foo\n"; >> } >> >> eval "use Bar;"; >> if($@) { >> print "Could not find Bar: $@\n"; >> } >> >> print "Program completed\n"; >> >> >> with Foo.pm being: >> >> package Foo; >> >> print "Foo!\n"; >> >> 1; >> >> yields: >> >> jarich at teddybear:/tmp$ perl test.pl >> Foo! >> Could not find Bar: Can't locate Bar.pm in @INC (@INC contains: >> /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 >> /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 >> /usr/share/perl/5.8 /usr/local/lib/site_perl >> /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 .) at >> (eval 2) line 1. >> BEGIN failed--compilation aborted at (eval 2) line 1. >> >> Program completed >> >> If you choose to try to use a second module upon failing the first, >> remember to save $@ if you ever intend to use it: >> >> eval "use Foo;"; >> if(my $E = $@) { >> print "Could not find Foo, trying Bar\n"; >> eval "use Bar;"; >> # $@ has now changed! >> } >> >> I hope this helps. >> >> J > > -- > Kim Holburn > IT Network & Security Consultant > Ph: +39 06 855 4294 M: +39 3494957443 > mailto:kim at holburn.net aim://kimholburn > skype://kholburn - PGP Public Key on request > > Democracy imposed from without is the severest form of tyranny. > -- Lloyd Biggle, Jr. Analog, Apr 1961 > > > > _______________________________________________ > Canberra-pm mailing list > Canberra-pm at pm.org > http://mail.pm.org/mailman/listinfo/canberra-pm > From pjf at perltraining.com.au Mon Jun 16 17:15:01 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Tue, 17 Jun 2008 10:15:01 +1000 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> Message-ID: <48570205.4080705@perltraining.com.au> G'day Kim / CPM, Kim Holburn wrote: > eval "use Text::Autoformat" ; > if (!$@) { > use Text::Autoformat ; > .... Aha! You've been caught by the fact that "use" statements happen at compile-time, and not run-time. This means that a "use" inside an if structure gets executed before perl even looks at the conditional. The string eval effectively delays loading of the module to run-time, as well as capturing the error if the module can't be find. Note that the eval *will* load the module if it's available. If it's not, it sets $@ with the reason why it could not be loaded (usually because it's not installed). This means your code can be written as: eval "use Text::Autoformat"; if ($@) { print "Drat, Text::Autoformat not available"; } else { print "We have Text::Autoformat loaded"; } All of this assumes that you want to use the module if it's available, which is usually the case. > If I don't have the use statement I get lots of other errors (using -w). I can only guess these are genuine warnings that relate to the rest of the code, but not the specific task of loading a module. Cheerio, Paul -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From kim at holburn.net Tue Jun 17 01:11:56 2008 From: kim at holburn.net (Kim Holburn) Date: Tue, 17 Jun 2008 10:11:56 +0200 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <48570205.4080705@perltraining.com.au> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> <48570205.4080705@perltraining.com.au> Message-ID: <614067CB-36C4-461E-ABA1-834330B3EACF@holburn.net> My problem is that I want to load and use the module if it's available but if it's not available I want the script to fall back to other strategies hopefully without setting off lots of warnings. I didn't realise that the use statement is a compile time directive. It obviously works at run time as in the eval but what exactly it does then I'm not sure. I think from the behaviour I'm seeing that the use in the eval is not determined at compile time because at compile time it's just a string. Therefore references to variables in the library are not linked at compile time unless a naked "use" or "require" statement appears somewhere. If the library isn't found then -w generates all sorts of warnings about strange variables that haven't been declared but I like having - w on. I guess what I'd like are some conditional compile directives but they don't exist. It seems the line in perl between compile directives and runtime commands is a bit blurry. On 2008/Jun/17, at 2:15 AM, Paul Fenwick wrote: > G'day Kim / CPM, > > Kim Holburn wrote: > >> eval "use Text::Autoformat" ; >> if (!$@) { >> use Text::Autoformat ; >> .... > > Aha! You've been caught by the fact that "use" statements happen at > compile-time, and not run-time. This means that a "use" inside an > if structure gets executed before perl even looks at the conditional. > > The string eval effectively delays loading of the module to run- > time, as well as capturing the error if the module can't be find. > > Note that the eval *will* load the module if it's available. If > it's not, it sets $@ with the reason why it could not be loaded > (usually because it's not installed). > > This means your code can be written as: > > eval "use Text::Autoformat"; > > if ($@) { > print "Drat, Text::Autoformat not available"; > } else { > print "We have Text::Autoformat loaded"; > } > > All of this assumes that you want to use the module if it's > available, which is usually the case. > >> If I don't have the use statement I get lots of other errors (using >> -w). > > I can only guess these are genuine warnings that relate to the rest > of the code, but not the specific task of loading a module. > > Cheerio, > > Paul > > -- > Paul Fenwick | http://perltraining.com.au/ > Director of Training | Ph: +61 3 9354 6001 > Perl Training Australia | Fax: +61 3 9354 2681 > -- Kim Holburn IT Network & Security Consultant Ph: +39 06 855 4294 M: +39 3494957443 mailto:kim at holburn.net aim://kimholburn skype://kholburn - PGP Public Key on request Democracy imposed from without is the severest form of tyranny. -- Lloyd Biggle, Jr. Analog, Apr 1961 From pjf at perltraining.com.au Tue Jun 17 01:39:28 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Tue, 17 Jun 2008 18:39:28 +1000 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <614067CB-36C4-461E-ABA1-834330B3EACF@holburn.net> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> <48570205.4080705@perltraining.com.au> <614067CB-36C4-461E-ABA1-834330B3EACF@holburn.net> Message-ID: <48577840.3080700@perltraining.com.au> G'day Kim / p5p, Kim Holburn wrote: > It obviously works at run time as in the eval but what exactly it does > then I'm not sure. I think from the behaviour I'm seeing that the use > in the eval is not determined at compile time because at compile time > it's just a string. Therefore references to variables in the library > are not linked at compile time unless a naked "use" or "require" > statement appears somewhere. Ah! You may want something like this: BEGIN { eval "use Text::Autoformat"; if ($@) { # Holy smokes Batman! Text::Autoformat isn't # available! Do something to set up the variables, # subroutines, and other things that Text::Autoformat # would normally provide for us } } By wrapping the code inside a BEGIN block, you force it to be executed at compile-time, before Perl tries to resolve the rest of the subroutines and variables in your code. If Text::Autoformat exists, then it gets loaded at compile time, and everything is fine. If it doesn't exist, then you'll need to do *something* to ensure that parts of your code trying to use Text::Autoformat have something to play with. I can't be more specific without seeing the warnings that's being generated; perhaps a piece of sample code may help here? > I guess what I'd like are some conditional compile directives but they > don't exist. If you want code that's simply not compiled at all if a module isn't installed, you can do something like this: BEGIN { eval "use Text::Autoformat"; } use constant AUTOFORMAT => $INC{'Text/Autoformat.pm'}; # Later, in your main code... if (AUTOFORMAT) { # Do something that uses Text::AutoFormat... } else { # Do something else. } What we're doing here is checking for the module at compile-time, setting a constant based upon whether it's been found and loaded, and then conditionally compiling code based upon that constant. Because Perl knows that constants can't change, it can completely prune unwanted code from the parse tree at compile-time. The text that was pruned won't give you warnings, because as far as Perl is concerned, it wasn't there. ;) Of course, if you have to start pulling tricks like this, you'll probably find it becomes *much* easier to simply insist the modules you want are installed, or using PAR (the Perl Archiver) to bundle them up with your program. You can find our tutorial on that at: http://perltraining.com.au/tips/2008-05-23.html Cheerio, Paul -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From kim at holburn.net Tue Jun 17 06:11:15 2008 From: kim at holburn.net (Kim Holburn) Date: Tue, 17 Jun 2008 15:11:15 +0200 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <48577840.3080700@perltraining.com.au> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> <48570205.4080705@perltraining.com.au> <614067CB-36C4-461E-ABA1-834330B3EACF@holburn.net> <48577840.3080700@perltraining.com.au> Message-ID: <460361FB-6F2B-4D2E-BCF1-A210E2CECED3@holburn.net> Thanks, that looks good, I'll try it. On 2008/Jun/17, at 10:39 AM, Paul Fenwick wrote: > G'day Kim / p5p, > > Kim Holburn wrote: > >> It obviously works at run time as in the eval but what exactly it >> does then I'm not sure. I think from the behaviour I'm seeing >> that the use in the eval is not determined at compile time because >> at compile time it's just a string. Therefore references to >> variables in the library are not linked at compile time unless a >> naked "use" or "require" statement appears somewhere. > > Ah! You may want something like this: > > BEGIN { > eval "use Text::Autoformat"; > if ($@) { > # Holy smokes Batman! Text::Autoformat isn't > # available! Do something to set up the variables, > # subroutines, and other things that Text::Autoformat > # would normally provide for us > } > } > > By wrapping the code inside a BEGIN block, you force it to be > executed at compile-time, before Perl tries to resolve the rest of > the subroutines and variables in your code. If Text::Autoformat > exists, then it gets loaded at compile time, and everything is > fine. If it doesn't exist, then you'll need to do *something* to > ensure that parts of your code trying to use Text::Autoformat have > something to play with. I can't be more specific without seeing the > warnings that's being generated; perhaps a piece of sample code may > help here? > > > I guess what I'd like are some conditional compile directives but > they > > don't exist. > > If you want code that's simply not compiled at all if a module isn't > installed, you can do something like this: > > BEGIN { eval "use Text::Autoformat"; } > > use constant AUTOFORMAT => $INC{'Text/Autoformat.pm'}; > > # Later, in your main code... > > if (AUTOFORMAT) { > # Do something that uses Text::AutoFormat... > } else { > # Do something else. > } > > What we're doing here is checking for the module at compile-time, > setting a constant based upon whether it's been found and loaded, > and then conditionally compiling code based upon that constant. > Because Perl knows that constants can't change, it can completely > prune unwanted code from the parse tree at compile-time. The text > that was pruned won't give you warnings, because as far as Perl is > concerned, it wasn't there. ;) > > Of course, if you have to start pulling tricks like this, you'll > probably find it becomes *much* easier to simply insist the modules > you want are installed, or using PAR (the Perl Archiver) to bundle > them up with your program. You can find our tutorial on that at: > > http://perltraining.com.au/tips/2008-05-23.html > > Cheerio, > > Paul > > -- > Paul Fenwick | http://perltraining.com.au/ > Director of Training | Ph: +61 3 9354 6001 > Perl Training Australia | Fax: +61 3 9354 2681 -- Kim Holburn IT Network & Security Consultant Ph: +39 06 855 4294 M: +39 3494957443 mailto:kim at holburn.net aim://kimholburn skype://kholburn - PGP Public Key on request Democracy imposed from without is the severest form of tyranny. -- Lloyd Biggle, Jr. Analog, Apr 1961 From kim at holburn.net Wed Jun 18 02:26:03 2008 From: kim at holburn.net (Kim Holburn) Date: Wed, 18 Jun 2008 11:26:03 +0200 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <48577840.3080700@perltraining.com.au> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> <48570205.4080705@perltraining.com.au> <614067CB-36C4-461E-ABA1-834330B3EACF@holburn.net> <48577840.3080700@perltraining.com.au> Message-ID: <64A6684D-F1D2-456D-B742-A00DF5A17EF9@holburn.net> Hi Paul, Thanks very much for your reply. I still have a niggle. I tried your constant solution. It works fine when it can find the library but produces a strange error when it can't. So there still appears to be some compiling going on. $ perl test3.pl Useless use of single ref constructor in void context at test3.pl line 19. no Here is my script: #!/usr/bin/perl -w BEGIN { eval "use Text::Autoformat"; } use constant AUTOFORMAT => $INC{'Text/Autoformat.pm'}; my $data = <<'EOM'; >> That bundle of copyrights relates to the very considerable >> investment required to make a succession of feature films. It's a kind of circular argument. People make an investment in a movie in order to make a profit because they know they have these copyrights and a bunch of people who earn their living helping them protect those copyrights. EOM if (AUTOFORMAT) { my $width = 72; $data = autoformat $data, { right=>$width } ; print "yes\n"; print $data; } else { print "no\n"; } On 2008/Jun/17, at 10:39 AM, Paul Fenwick wrote: > G'day Kim / p5p, > > Kim Holburn wrote: > >> It obviously works at run time as in the eval but what exactly it >> does then I'm not sure. I think from the behaviour I'm seeing >> that the use in the eval is not determined at compile time because >> at compile time it's just a string. Therefore references to >> variables in the library are not linked at compile time unless a >> naked "use" or "require" statement appears somewhere. > > Ah! You may want something like this: > > BEGIN { > eval "use Text::Autoformat"; > if ($@) { > # Holy smokes Batman! Text::Autoformat isn't > # available! Do something to set up the variables, > # subroutines, and other things that Text::Autoformat > # would normally provide for us > } > } > > By wrapping the code inside a BEGIN block, you force it to be > executed at compile-time, before Perl tries to resolve the rest of > the subroutines and variables in your code. If Text::Autoformat > exists, then it gets loaded at compile time, and everything is > fine. If it doesn't exist, then you'll need to do *something* to > ensure that parts of your code trying to use Text::Autoformat have > something to play with. I can't be more specific without seeing the > warnings that's being generated; perhaps a piece of sample code may > help here? > > > I guess what I'd like are some conditional compile directives but > they > > don't exist. > > If you want code that's simply not compiled at all if a module isn't > installed, you can do something like this: > > BEGIN { eval "use Text::Autoformat"; } > > use constant AUTOFORMAT => $INC{'Text/Autoformat.pm'}; > > # Later, in your main code... > > if (AUTOFORMAT) { > # Do something that uses Text::AutoFormat... > } else { > # Do something else. > } > > What we're doing here is checking for the module at compile-time, > setting a constant based upon whether it's been found and loaded, > and then conditionally compiling code based upon that constant. > Because Perl knows that constants can't change, it can completely > prune unwanted code from the parse tree at compile-time. The text > that was pruned won't give you warnings, because as far as Perl is > concerned, it wasn't there. ;) > > Of course, if you have to start pulling tricks like this, you'll > probably find it becomes *much* easier to simply insist the modules > you want are installed, or using PAR (the Perl Archiver) to bundle > them up with your program. You can find our tutorial on that at: > > http://perltraining.com.au/tips/2008-05-23.html > > Cheerio, > > Paul > > -- > Paul Fenwick | http://perltraining.com.au/ > Director of Training | Ph: +61 3 9354 6001 > Perl Training Australia | Fax: +61 3 9354 2681 -- Kim Holburn IT Network & Security Consultant Ph: +39 06 855 4294 M: +39 3494957443 mailto:kim at holburn.net aim://kimholburn skype://kholburn - PGP Public Key on request Democracy imposed from without is the severest form of tyranny. -- Lloyd Biggle, Jr. Analog, Apr 1961 From jarich at perltraining.com.au Wed Jun 18 03:06:51 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Wed, 18 Jun 2008 20:06:51 +1000 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <64A6684D-F1D2-456D-B742-A00DF5A17EF9@holburn.net> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> <48570205.4080705@perltraining.com.au> <614067CB-36C4-461E-ABA1-834330B3EACF@holburn.net> <48577840.3080700@perltraining.com.au> <64A6684D-F1D2-456D-B742-A00DF5A17EF9@holburn.net> Message-ID: <4858DE3B.5020001@perltraining.com.au> Kim Holburn wrote: > I tried your constant solution. It works fine when it can find the > library but produces a strange error when it can't. So there still > appears to be some compiling going on. There is. I think it occurs when perl attempts to identify the code blocks. The end result of compiling is: perl -MO=Deparse test.pl BEGIN { $^W = 1; } sub BEGIN { eval 'use Text::Autoformat'; } use constant ('AUTOFORMAT', $INC{'Text/Autoformat.pm'}); my $data = "\n >> That bundle of copyrights relates to the very considerable\n >> investment required to make a succession of feature films.\n\nIt's a kind of circular argument. People make an investment in a\nmovie in order to make a profit because they know they have these\ncopyrights and a bunch of people who earn their living helping them\nprotect those copyrights.\n\n"; do { print "no\n" }; test.pl syntax OK Which is what we're expecting, but the warning happens before it finishes the compile. The problem line is this one: > $data = autoformat $data, { right=>$width } ; Perl's telling you that - at first glance - this looks wrong. Perhaps it's interpreting it as: ($data = autoformat $data), { right => $width }; I don't know exactly what it's doing, but it's seeing your hash reference as a constructor in void context. You can make this error go away, just by giving Perl another hint of what you mean: $data = autoformat( $data, { right=>$width } ); Now there's no error. :) I always recommend using parentheses around your arguments for all non-core subroutines. It makes hitting this kind of warning pretty much impossible. All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From kim at holburn.net Wed Jun 18 03:42:18 2008 From: kim at holburn.net (Kim Holburn) Date: Wed, 18 Jun 2008 12:42:18 +0200 Subject: [Canberra-pm] how to tell if a library is available? In-Reply-To: <4858DE3B.5020001@perltraining.com.au> References: <5C0100D2-A5CB-4DC7-B218-41BAC8AA27FC@holburn.net> <48539200.1040504@perltraining.com.au> <48570205.4080705@perltraining.com.au> <614067CB-36C4-461E-ABA1-834330B3EACF@holburn.net> <48577840.3080700@perltraining.com.au> <64A6684D-F1D2-456D-B742-A00DF5A17EF9@holburn.net> <4858DE3B.5020001@perltraining.com.au> Message-ID: <6189DD1D-B0AD-4BD5-A307-68EEC0E5B9C1@holburn.net> Yeah, I got to that point just after sending my previous email ;-) and my next email to the list bounced ;-( I think I just copied that line from the man page. Normally I try follow Perl Best Practises - sort of ;-) On 2008/Jun/18, at 12:06 PM, Jacinta Richardson wrote: > Kim Holburn wrote: > >> I tried your constant solution. It works fine when it can find the >> library but produces a strange error when it can't. So there still >> appears to be some compiling going on. > > There is. I think it occurs when perl attempts to identify the code > blocks. > The end result of compiling is: > > perl -MO=Deparse test.pl > BEGIN { $^W = 1; } > sub BEGIN { > eval 'use Text::Autoformat'; > } > use constant ('AUTOFORMAT', $INC{'Text/Autoformat.pm'}); > my $data = "\n >> That bundle of copyrights relates to the very > considerable\n >>> investment required to make a succession of feature films.\n\nIt's >>> a kind of > circular argument. People make an investment in a\nmovie in order > to make a > profit because they know they have these\ncopyrights and a bunch of > people who > earn their living helping them\nprotect those copyrights.\n\n"; > do { > print "no\n" > }; > test.pl syntax OK > > > Which is what we're expecting, but the warning happens before it > finishes the > compile. The problem line is this one: > >> $data = autoformat $data, { right=>$width } ; > > Perl's telling you that - at first glance - this looks wrong. > Perhaps it's > interpreting it as: > > ($data = autoformat $data), { right => $width }; > > I don't know exactly what it's doing, but it's seeing your hash > reference as a > constructor in void context. You can make this error go away, just > by giving > Perl another hint of what you mean: > > $data = autoformat( $data, { right=>$width } ); > > Now there's no error. :) I always recommend using parentheses > around your > arguments for all non-core subroutines. It makes hitting this kind > of warning > pretty much impossible. > > All the best, > > J > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | -- Kim Holburn IT Network & Security Consultant Ph: +39 06 855 4294 M: +39 3494957443 mailto:kim at holburn.net aim://kimholburn skype://kholburn - PGP Public Key on request Democracy imposed from without is the severest form of tyranny. -- Lloyd Biggle, Jr. Analog, Apr 1961 From akievsky at yahoo.com.au Thu Jun 19 14:59:55 2008 From: akievsky at yahoo.com.au (Andres Kievsky) Date: Thu, 19 Jun 2008 14:59:55 -0700 (PDT) Subject: [Canberra-pm] how to tell if a library is available? Message-ID: <667444.11134.qm@web63212.mail.re1.yahoo.com> Kim, As you noticed, the problem is that perl is still compiling the code inside the if() block. I don't know of any way to stop perl from compiling it; It has to be valid perl, and when it's checked, the autoformat() sub has not been defined. You can circunvent this problem by adding parenthesis: autoformat($data. {...}); instead of autoformat $data. {...}; However, I think it'd be nicer to wrap the AUTOFORMAT sections in a plug-in that hides all this complexity and provides a single entry point for all code that might need to get its data formatted. Or why not just bundle Autoformat.pm? From what I can see, it's a single .pm file that can be copied to your source tree. - ank ----- Original Message ---- From: Kim Holburn To: Paul Fenwick Cc: canberra-pm at pm.org Sent: Wednesday, 18 June, 2008 7:26:03 PM Subject: Re: [Canberra-pm] how to tell if a library is available? Hi Paul, Thanks very much for your reply. I still have a niggle. I tried your constant solution. It works fine when it can find the library but produces a strange error when it can't. So there still appears to be some compiling going on. $ perl test3.pl Useless use of single ref constructor in void context at test3.pl line 19. no Here is my script: #!/usr/bin/perl -w BEGIN { eval "use Text::Autoformat"; } use constant AUTOFORMAT => $INC{'Text/Autoformat.pm'}; my $data = <<'EOM'; >> That bundle of copyrights relates to the very considerable >> investment required to make a succession of feature films. It's a kind of circular argument. People make an investment in a movie in order to make a profit because they know they have these copyrights and a bunch of people who earn their living helping them protect those copyrights. EOM if (AUTOFORMAT) { my $width = 72; $data = autoformat $data, { right=>$width } ; print "yes\n"; print $data; } else { print "no\n"; } On 2008/Jun/17, at 10:39 AM, Paul Fenwick wrote: > G'day Kim / p5p, > > Kim Holburn wrote: > >> It obviously works at run time as in the eval but what exactly it >> does then I'm not sure. I think from the behaviour I'm seeing >> that the use in the eval is not determined at compile time because >> at compile time it's just a string. Therefore references to >> variables in the library are not linked at compile time unless a >> naked "use" or "require" statement appears somewhere. > > Ah! You may want something like this: > > BEGIN { > eval "use Text::Autoformat"; > if ($@) { > # Holy smokes Batman! Text::Autoformat isn't > # available! Do something to set up the variables, > # subroutines, and other things that Text::Autoformat > # would normally provide for us > } > } > > By wrapping the code inside a BEGIN block, you force it to be > executed at compile-time, before Perl tries to resolve the rest of > the subroutines and variables in your code. If Text::Autoformat > exists, then it gets loaded at compile time, and everything is > fine. If it doesn't exist, then you'll need to do *something* to > ensure that parts of your code trying to use Text::Autoformat have > something to play with. I can't be more specific without seeing the > warnings that's being generated; perhaps a piece of sample code may > help here? > > > I guess what I'd like are some conditional compile directives but > they > > don't exist. > > If you want code that's simply not compiled at all if a module isn't > installed, you can do something like this: > > BEGIN { eval "use Text::Autoformat"; } > > use constant AUTOFORMAT => $INC{'Text/Autoformat.pm'}; > > # Later, in your main code... > > if (AUTOFORMAT) { > # Do something that uses Text::AutoFormat... > } else { > # Do something else. > } > > What we're doing here is checking for the module at compile-time, > setting a constant based upon whether it's been found and loaded, > and then conditionally compiling code based upon that constant. > Because Perl knows that constants can't change, it can completely > prune unwanted code from the parse tree at compile-time. The text > that was pruned won't give you warnings, because as far as Perl is > concerned, it wasn't there. ;) > > Of course, if you have to start pulling tricks like this, you'll > probably find it becomes *much* easier to simply insist the modules > you want are installed, or using PAR (the Perl Archiver) to bundle > them up with your program. You can find our tutorial on that at: > > http://perltraining.com.au/tips/2008-05-23.html > > Cheerio, > > Paul > > -- > Paul Fenwick | http://perltraining.com.au/ > Director of Training | Ph: +61 3 9354 6001 > Perl Training Australia | Fax: +61 3 9354 2681 -- Kim Holburn IT Network & Security Consultant Ph: +39 06 855 4294 M: +39 3494957443 mailto:kim at holburn.net aim://kimholburn skype://kholburn - PGP Public Key on request Democracy imposed from without is the severest form of tyranny. -- Lloyd Biggle, Jr. Analog, Apr 1961 _______________________________________________ Canberra-pm mailing list Canberra-pm at pm.org http://mail.pm.org/mailman/listinfo/canberra-pm Get the name you always wanted with the new y7mail email address. www.yahoo7.com.au/mail From jarich at perltraining.com.au Sat Jun 21 21:36:41 2008 From: jarich at perltraining.com.au (jarich at perltraining.com.au) Date: Sun, 22 Jun 2008 14:36:41 +1000 (EST) Subject: [Canberra-pm] SAGE-AU 2008 Early bird registrations now open Message-ID: <20080622043641.DED83A811F@teddybear.perltraining.com.au> Dear Canberra PM members, [Please forward this invitation to anyone you feel would be interested] Registration for the sixteenth annual Australian System Administrators' conference (SAGE-AU 2008) are now open. Book before Friday July 4th to receive a 15% discount. http://www.sage-au.org.au/display/conf/Registration Key information: 4th July: Early Bird Date 11th - 13th August: Training Program 14th - 15th August: Technical Program Holiday Inn Adelaide 65 Hindley Street Adelaide South Australia SAGE-AU is the System Administration industry body in Australia. It exists to support all Australian system administrators, raise awareness of the profession and provide education in technical and professional issues. Our yearly conference provides a forum for System Administrators of all platforms and levels of experience to gather together and share their experiences. Further it provides an excellent opportunity to meet and network with acknowledged experts in the field. We have 10 training sessions for our three day training program in addition to 26 great sessions for our technical program. This year focusses on a mix of management and security topics with an emphasis on sharing techniques and ideas rather than selling products. This year's conference will be broken up into two streams of concurrent talks, giving you more choice in the topics you want to see. To see our program visit: http://www.sage-au.org.au/display/conf/Technical+Program You can help make this conference be the best system administrators' conference ever, just by turning up and participating. We look forward to sharing this great conference with you. Many thanks go to our Platinum Sponsors: Internode and Tas, our Gold Sponsor: Ironport our Silver Sponsor: RedHat and our terminal room sponsors: Apple and Sun. Jacinta Richardson SAGE-AU Program Coordinator From jarich at perltraining.com.au Sun Jun 22 17:29:12 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 23 Jun 2008 10:29:12 +1000 Subject: [Canberra-pm] OSDC 2008 CFP closes on Monday, 30 June 2008 Message-ID: <485EEE58.7080204@perltraining.com.au> There is less than two weeks to get your paper proposal in for the opportunity to speak and attend Australia's Open Source Developers' Conference! The deadline for proposals is 30th June 2008. The Open Source Developers' Conference is an Australian conference designed for developers, by developers. Papers on Open Source languages, technologies, projects, tools and well as topics of interest to Open Source developers are being solicited for submission to OSDC 2008. So if you are an Open Source maintainer, developer or user, the organising committee would encourage you to submit a talk proposal on the open source tools, solutions, languages or technologies you are working with. The conference will be held at SMC Conference venue in the Sydney CBD, New South Wales, from the 2nd to the 5th of December, 2008. We have had some great proposals submitted already, but this is your chance to give the open source thing you are passionate about more exposure. Being a speaker at OSDC 2008, has it's privileges. As well as having your paper published in the conference proceedings, you will get a free admission to the 3 days of the main conference and the conference dinner. If you have any questions, or have never submitted a paper proposal before, please read our FAQ page at http://www.osdc.com.au/2008/faq/ If you don't find an answer there, please contact program osdc.com.au To submit a proposal, follow the instructions at http://www.osdc.com.au/2008/papers/cfp.html -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From P.Sheahan at bom.gov.au Sun Jun 22 19:38:47 2008 From: P.Sheahan at bom.gov.au (Paul Sheahan) Date: Mon, 23 Jun 2008 12:38:47 +1000 Subject: [Canberra-pm] Perl programmer availability [SEC=UNCLASSIFIED] Message-ID: Hi All, I am new to this group. I am interested in gaining an understanding on Perl programmer availability in Canberra. The immediate work is time series and meta data ingestion from a large number of national contributors. We have an immediate short term requirement and probably an ongoing requirement for Canberra based Perl programmers. Agency approaches have not yielded suitable applicants. Is any one able to give me a feel for programmer resource availability in Canberra and suggested methods of connecting with the resource (more targeted than new paper advertising)? Thanks Paul ________________________________________________________________________ _____________________ Paul Sheahan Bureau of Meteorology Water Division Australian Water Resource Information System (AWRIS) Project p.sheahan at bom.gov.au -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080623/abbd9b0b/attachment.html From jarich at perltraining.com.au Sun Jun 22 20:35:26 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 23 Jun 2008 13:35:26 +1000 Subject: [Canberra-pm] Perl programmer availability [SEC=UNCLASSIFIED] In-Reply-To: References: Message-ID: <485F19FE.1000803@perltraining.com.au> Paul Sheahan wrote: > Is any one able to give me a feel for programmer resource availability > in Canberra and suggested methods of connecting with the resource (more > targeted than new paper advertising)? Host a Perl mongers meeting and provide pizza? Get someone to speak on some Perl related topic, provide enough notice and invite Canberra Perl Mongers, CLUGGers and any other programming related groups to come. The vast majority of those who turn up will be Perl programmers, so you'll have your targeted group. Tell them at the meeting what you're looking for and see who's interested. If you provide sufficient notice, I might also be able to include the meeting in our ACT mailing list newsletter which goes to past students of ours. J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From megamic at gmail.com Mon Jun 23 15:02:30 2008 From: megamic at gmail.com (Michael Potter) Date: Tue, 24 Jun 2008 08:02:30 +1000 Subject: [Canberra-pm] Perl programmer availability Message-ID: <167f9c460806231502l7bdc34adwfbab12b07a9a4582@mail.gmail.com> Hi Paul I am the organizer of the (small) Canberra PM group, and I would be more than happy to assist in organizing any kind of event to bring some Perl programmers together for you to meet. Jacinta posted some excellent suggestions (thanks J!), and I suggest you use those as a starting point - I know many Canberra PM members have only expressed interest in attending meets for Speakers or special events. While you rarely see Perl positions advertised in Canberra, I think it is far more widely used than most people assume- it may well be the standard putty used to fill cracks and holes in large government enterprise systems. I work in Data Warehousing for a big government agency - and we use Perl heavily to solve a range of problems that aren't covered by standard corporate tools. It really is our "Swiss-Army chainsaw"! Cheers MP -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080624/28fdb36b/attachment.html From megamic at gmail.com Mon Jun 23 15:02:30 2008 From: megamic at gmail.com (Michael Potter) Date: Tue, 24 Jun 2008 08:02:30 +1000 Subject: [Canberra-pm] Perl programmer availability Message-ID: <167f9c460806231502l7bdc34adwfbab12b07a9a4582@mail.gmail.com> Hi Paul I am the organizer of the (small) Canberra PM group, and I would be more than happy to assist in organizing any kind of event to bring some Perl programmers together for you to meet. Jacinta posted some excellent suggestions (thanks J!), and I suggest you use those as a starting point - I know many Canberra PM members have only expressed interest in attending meets for Speakers or special events. While you rarely see Perl positions advertised in Canberra, I think it is far more widely used than most people assume- it may well be the standard putty used to fill cracks and holes in large government enterprise systems. I work in Data Warehousing for a big government agency - and we use Perl heavily to solve a range of problems that aren't covered by standard corporate tools. It really is our "Swiss-Army chainsaw"! Cheers MP -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080624/28fdb36b/attachment-0001.html From megamic at gmail.com Mon Jun 23 15:02:30 2008 From: megamic at gmail.com (Michael Potter) Date: Tue, 24 Jun 2008 08:02:30 +1000 Subject: [Canberra-pm] Perl programmer availability Message-ID: <167f9c460806231502l7bdc34adwfbab12b07a9a4582@mail.gmail.com> Hi Paul I am the organizer of the (small) Canberra PM group, and I would be more than happy to assist in organizing any kind of event to bring some Perl programmers together for you to meet. Jacinta posted some excellent suggestions (thanks J!), and I suggest you use those as a starting point - I know many Canberra PM members have only expressed interest in attending meets for Speakers or special events. While you rarely see Perl positions advertised in Canberra, I think it is far more widely used than most people assume- it may well be the standard putty used to fill cracks and holes in large government enterprise systems. I work in Data Warehousing for a big government agency - and we use Perl heavily to solve a range of problems that aren't covered by standard corporate tools. It really is our "Swiss-Army chainsaw"! Cheers MP -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/canberra-pm/attachments/20080624/28fdb36b/attachment-0002.html