From jvogt at houston.oilfield.slb.com Mon Dec 5 18:46:54 2005 From: jvogt at houston.oilfield.slb.com (Jay Vogt) Date: Mon, 05 Dec 2005 20:46:54 -0600 Subject: [pm-h] How to update @INC from within a script? References: <20051113212206.3b39baf0@sovvan> Message-ID: <4394FB9E.8000507@houston.oilfield.slb.com> All, When I point to a particular Perl executable the @INC array points to non-existent directories. I've tried to update @INC within my script to point to the directories which do contain DBI using the unshift technique found in the O'Reilly books (whether in a BEGIN statement or elsewhere in the script before I execute "use DBI"). Printing the contents of @INC (by commenting out "use DBI") shows that the array is modified, but when including "use DBI" I get an error that DBI.pm is not in @INC and it lists only those non-existent directories. The "use DBI" statement seems to be processed at script compilation time and not following the BEGIN block. The only way my script sees the DBI module is if I set the environment variable PERL5LIB in an xterm before running the script. Setting $ENV{PERL5LIB} within my script does not work. Any suggestions on how to modify @INC from within a script so that it is actually read? Thanks, Jay Vogt From kristoferhoch at yahoo.com Tue Dec 6 02:45:41 2005 From: kristoferhoch at yahoo.com (Kristofer Hoch) Date: Tue, 6 Dec 2005 02:45:41 -0800 (PST) Subject: [pm-h] How to update @INC from within a script? In-Reply-To: <4394FB9E.8000507@houston.oilfield.slb.com> Message-ID: <20051206104541.76453.qmail@web33309.mail.mud.yahoo.com> Jay, Try this at the very top of your script #!/path/to/perl BEGIN { push(@INC, '/path/to/DBI/directory'); } Jay Vogt wrote: All, When I point to a particular Perl executable the @INC array points to non-existent directories. I've tried to update @INC within my script to point to the directories which do contain DBI using the unshift technique found in the O'Reilly books (whether in a BEGIN statement or elsewhere in the script before I execute "use DBI"). Printing the contents of @INC (by commenting out "use DBI") shows that the array is modified, but when including "use DBI" I get an error that DBI.pm is not in @INC and it lists only those non-existent directories. The "use DBI" statement seems to be processed at script compilation time and not following the BEGIN block. The only way my script sees the DBI module is if I set the environment variable PERL5LIB in an xterm before running the script. Setting $ENV{PERL5LIB} within my script does not work. Any suggestions on how to modify @INC from within a script so that it is actually read? Thanks, Jay Vogt _______________________________________________ Houston mailing list Houston at pm.org http://mail.pm.org/mailman/listinfo/houston -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GIT d s+:++ a C++ UL++ US+ P+++ L++ W+++ w PS PE t++ b+ G e r+++ z++++ ------END GEEK CODE BLOCK------ --------------------------------- Yahoo! DSL Something to write home about. Just $16.99/mo. or less -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/mailman/private/houston/attachments/20051206/533493b5/attachment.html From sisk at mojotoad.com Tue Dec 6 03:10:02 2005 From: sisk at mojotoad.com (Matt Sisk) Date: Tue, 06 Dec 2005 06:10:02 -0500 Subject: [pm-h] How to update @INC from within a script? In-Reply-To: <20051206104541.76453.qmail@web33309.mail.mud.yahoo.com> References: <20051206104541.76453.qmail@web33309.mail.mud.yahoo.com> Message-ID: <20051206061002.435wkss0g84s0o4w@webmail.spamcop.net> Quoting Kristofer Hoch : > Try this at the very top of your script > > #!/path/to/perl > BEGIN { push(@INC, '/path/to/DBI/directory'); } Most recent versions of perl (I'm not sure when it was added, but definitely present in the 5.8 series) allow the 'lib' pragma: #!/path/to/perl use lib '/path/to/DBI/dir'; Aside from not having to type BEGIN blocks, this also automatically adds $dir/$archname/auto directories if they are present so that you include your XS components if present. Cheers, Matt From sisk at mojotoad.com Tue Dec 6 03:10:02 2005 From: sisk at mojotoad.com (Matt Sisk) Date: Tue, 06 Dec 2005 06:10:02 -0500 Subject: [pm-h] How to update @INC from within a script? In-Reply-To: <20051206104541.76453.qmail@web33309.mail.mud.yahoo.com> References: <20051206104541.76453.qmail@web33309.mail.mud.yahoo.com> Message-ID: <20051206061002.435wkss0g84s0o4w@webmail.spamcop.net> Quoting Kristofer Hoch : > Try this at the very top of your script > > #!/path/to/perl > BEGIN { push(@INC, '/path/to/DBI/directory'); } Most recent versions of perl (I'm not sure when it was added, but definitely present in the 5.8 series) allow the 'lib' pragma: #!/path/to/perl use lib '/path/to/DBI/dir'; Aside from not having to type BEGIN blocks, this also automatically adds $dir/$archname/auto directories if they are present so that you include your XS components if present. Cheers, Matt From gwadej at anomaly.org Tue Dec 6 05:10:04 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Tue, 6 Dec 2005 07:10:04 -0600 Subject: [pm-h] How to update @INC from within a script? In-Reply-To: <4394FB9E.8000507@houston.oilfield.slb.com> References: <20051113212206.3b39baf0@sovvan> <4394FB9E.8000507@houston.oilfield.slb.com> Message-ID: <20051206071004.0ad64eed@sovvan> As suggested by several people the "use lib" and begin block techniques should both solve yuor problem. I would be concerned about 'the @INC array points to non-existent directories'. This normally means one of two things: 1. Someone built the Perl distribution for one location, and then moved the directory structure to a different location. 2. Someone downloaded a binary Perl distribution and installed it in a different location than it was built for. You need to check with whoever installed your Perl and get them to correct this. Depending on what all is missing you may not be able to 'use lib' or even 'use strict'. Recompiling Perl for a particular location is pretty straight-forward (at least under Unix). Under Windows, the ActiveState installer sets everything up correctly, so there should be no need to move the directories. G. Wade On Mon, 05 Dec 2005 20:46:54 -0600 Jay Vogt wrote: > All, > > When I point to a particular Perl executable the @INC array > points to non-existent directories. I've tried to update @INC > within my script to point to the directories which do contain DBI > using the unshift technique found in the O'Reilly books (whether > in a BEGIN statement or elsewhere in the script before > I execute "use DBI"). Printing the contents of @INC (by commenting > out "use DBI") shows that the array is modified, but when including > "use DBI" I get an error that DBI.pm is not in @INC and it lists > only those non-existent directories. > > The "use DBI" statement seems to be processed at script compilation > time and not following the BEGIN block. The only way my script > sees the DBI module is if I set the environment variable PERL5LIB > in an xterm before running the script. Setting $ENV{PERL5LIB} > within my script does not work. > > Any suggestions on how to modify @INC from within a script > so that it is actually read? > > Thanks, > > Jay Vogt > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston -- I've been living on the edge too long, where the winds of limbo roar. -- "Veteran of Psychic Wars", Blue Oyster Cult From jvogt at houston.oilfield.slb.com Tue Dec 6 16:23:21 2005 From: jvogt at houston.oilfield.slb.com (Jay Vogt) Date: Tue, 06 Dec 2005 18:23:21 -0600 Subject: [pm-h] How to update @INC from within a script? References: <20051206104541.76453.qmail@web33309.mail.mud.yahoo.com> Message-ID: <43962B79.10504@houston.oilfield.slb.com> All, Thanks for the suggestions. Error came from a mistaken belief that the BEGIN statement would be executed first regardless of its position in the script. All worked fine once I move the BEGIN block to the very beginning of the script as Kristofer indicated. Not sure where I go the notion that BEGIN statement did not have to be at the start of the script. Wade - the reason for the perl with non-existent directories for @INC is because it is sent to clients who can install in any directory they want. I don't suppose that @INC can point to directories with relative paths or variables in them. Thanks, Jay Vogt Kristofer Hoch wrote: > Jay, > Try this at the very top of your script > > #!/path/to/perl > BEGIN { push(@INC, '/path/to/DBI/directory'); } > > > Jay Vogt wrote: > > All, > > When I point to a particular Perl executable the @INC array > points to non-existent directories. I've tried to update @INC > within my script to point to the directories which do contain DBI > using the unshift technique found in the O'Reilly books (whether > in a BEGIN statement or elsewhere in the script before > I execute "use DBI"). Printing the contents of @INC (by commenting > out "use DBI") shows that the array is modified, but when including > "use DBI" I get an error that DBI.pm is not in @INC and it lists > only those non-existent directories. > > The "use DBI" statement seems to be processed a t script compilation > time and not following the BEGIN block. The only way my script > sees the DBI module is if I set the environment variable PERL5LIB > in an xterm before running the script. Setting $ENV{PERL5LIB} > within my script does not work. > > Any suggestions on how to modify @INC from within a script > so that it is actually read? > > Thanks, > > Jay Vogt > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > > > > > -----BEGIN GEEK CODE BLOCK----- > Version: 3.12 > GIT d s+:++ a C++ UL++ US+ P+++ L++ > W+++ w PS PE t++ b+ G e r+++ z++++ > ------END GEEK CODE BLOCK------ > > ------------------------------------------------------------------------ > Yahoo! DSL > > Something to write home about. Just $16.99/mo. or less > >------------------------------------------------------------------------ > >_______________________________________________ >Houston mailing list >Houston at pm.org >http://mail.pm.org/mailman/listinfo/houston > > -- ___________________________________________________________________________________________________ Jay Vogt Schlumberger Information Solutions GeoFrame Portfolio Product Champion 713 513 2335 Houston, TX -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/mailman/private/houston/attachments/20051207/78fd4914/attachment.html From kristoferhoch at yahoo.com Tue Dec 6 16:57:35 2005 From: kristoferhoch at yahoo.com (Kristofer Hoch) Date: Tue, 6 Dec 2005 16:57:35 -0800 (PST) Subject: [pm-h] How to update @INC from within a script? In-Reply-To: <43962B79.10504@houston.oilfield.slb.com> Message-ID: <20051207005735.29875.qmail@web33307.mail.mud.yahoo.com> Jay, That BEGIN trick is commonly used to create a singleton design pattern. It is very misleading, and you really have read the Perl documentation to understand what to do and when. Glad to help, Kristofer Jay Vogt wrote: All, Thanks for the suggestions. Error came from a mistaken belief that the BEGIN statement would be executed first regardless of its position in the script. All worked fine once I move the BEGIN block to the very beginning of the script as Kristofer indicated. Not sure where I go the notion that BEGIN statement did not have to be at the start of the script. Wade - the reason for the perl with non-existent directories for @INC is because it is sent to clients who can install in any directory they want. I don't suppose that @INC can point to directories with relative paths or variables in them. Thanks, Jay Vogt Kristofer Hoch wrote: Jay, Try this at the very top of your script #!/path/to/perl BEGIN { push(@INC, '/path/to/DBI/directory'); } Jay Vogt wrote: All, When I point to a particular Perl executable the @INC array points to non-existent directories. I've tried to update @INC within my script to point to the directories which do contain DBI using the unshift technique found in the O'Reilly books (whether in a BEGIN statement or elsewhere in the script before I execute "use DBI"). Printing the contents of @INC (by commenting out "use DBI") shows that the array is modified, but when including "use DBI" I get an error that DBI.pm is not in @INC and it lists only those non-existent directories. The "use DBI" statement seems to be processed a t script compilation time and not following the BEGIN block. The only way my script sees the DBI module is if I set the environment variable PERL5LIB in an xterm before running the script. Setting $ENV{PERL5LIB} within my script does not work. Any suggestions on how to modify @INC from within a script so that it is actually read? Thanks, Jay Vogt _______________________________________________ Houston mailing list Houston at pm.org http://mail.pm.org/mailman/listinfo/houston -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GIT d s+:++ a C++ UL++ US+ P+++ L++ W+++ w PS PE t++ b+ G e r+++ z++++ ------END GEEK CODE BLOCK------ --------------------------------- Yahoo! DSL Something to write home about. Just $16.99/mo. or less --------------------------------- _______________________________________________ Houston mailing list Houston at pm.org http://mail.pm.org/mailman/listinfo/houston -- ___________________________________________________________________________________________________ Jay Vogt Schlumberger Information Solutions GeoFrame Portfolio Product Champion 713 513 2335 Houston, TX _______________________________________________ Houston mailing list Houston at pm.org http://mail.pm.org/mailman/listinfo/houston -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GIT d s+:++ a C++ UL++ US+ P+++ L++ W+++ w PS PE t++ b+ G e r+++ z++++ ------END GEEK CODE BLOCK------ --------------------------------- Yahoo! Personals Single? There's someone we'd like you to meet. Lots of someones, actually. Yahoo! Personals -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/mailman/private/houston/attachments/20051207/f289cd2d/attachment.html From gwadej at anomaly.org Tue Dec 6 17:21:14 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Tue, 6 Dec 2005 19:21:14 -0600 Subject: [pm-h] How to update @INC from within a script? In-Reply-To: <43962B79.10504@houston.oilfield.slb.com> References: <20051206104541.76453.qmail@web33309.mail.mud.yahoo.com> <43962B79.10504@houston.oilfield.slb.com> Message-ID: <20051206192114.2a50d4ef@sovvan> On Tue, 06 Dec 2005 18:23:21 -0600 Jay Vogt wrote: [snip] > Wade - the reason for the perl with non-existent directories for @INC > is because it is sent to clients who can install in any directory they > want. I don't suppose that @INC can point to directories with > relative paths or variables in them. If the libraries you are trying to access are part of your program, a standard approach combines "use lib" with the FindBin module. 1. Put your libraries in a lib subdirectory of the directory where your script will live (as part of the install). 2. At the top of your script add the following: use FindBin; use lib "$FindBin::Bin/lib"; Now any modules you include will also reference the lib subdirectory of your installation. The $FindBin::Bin variable contains the directory your script executed from. The path in the 'use lib' can be any path relative to that. (including using .. to go to parent directory, etc.) I've found this useful in a few installations. I believe FindBin is available back through Perl 5.6. G. Wade -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth From gwadej at anomaly.org Wed Dec 7 04:57:11 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 7 Dec 2005 06:57:11 -0600 Subject: [pm-h] Survey question Message-ID: <20051207065711.39c5987a@sovvan> In an effort to get an idea of who is in the group, I thought I'd ask: Which version of Perl are you using? I'm using 5.8.3 under Linux and 5.8.4 (ActiveState) under Windows. Anyone else? G. Wade -- Why do your people ask if someone's ready right before you are going to do something massively unwise? -- Delenn - "The War without End" From gwadej at anomaly.org Wed Dec 7 05:19:49 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 7 Dec 2005 07:19:49 -0600 Subject: [pm-h] Perl Advent Calendar Message-ID: <20051207071949.04fccb33@sovvan> It appears that Mark Fowler is not doing the Perl Advent calendar this year. However, if you need your fix, we have Yet An Perl Advent Calendar at http://web.mit.edu/belg4mit/www/ G. Wade -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth From mikeflan at earthlink.net Wed Dec 7 05:20:50 2005 From: mikeflan at earthlink.net (Mike Flannigan) Date: Wed, 07 Dec 2005 07:20:50 -0600 Subject: [pm-h] Survey question References: <20051207065711.39c5987a@sovvan> Message-ID: <4396E1B2.F6669E10@earthlink.net> I use 5.8.0 under Windows. For those that don't know, the way to find out is perl -V at the command prompt Mike "G. Wade Johnson" wrote: > In an effort to get an idea of who is in the group, I thought I'd ask: > > Which version of Perl are you using? > > I'm using 5.8.3 under Linux and 5.8.4 (ActiveState) under Windows. > > Anyone else? > > G. Wade From kristoferhoch at yahoo.com Wed Dec 7 05:26:35 2005 From: kristoferhoch at yahoo.com (Kristofer Hoch) Date: Wed, 7 Dec 2005 05:26:35 -0800 (PST) Subject: [pm-h] Survey question In-Reply-To: <4396E1B2.F6669E10@earthlink.net> Message-ID: <20051207132635.97886.qmail@web33306.mail.mud.yahoo.com> At work I use 5.6.1.638. At home I use Active State 5.8.3, and the same on my web server (www.heraldsofazeroth.net). Most of that site is PhP because I can't get the admins to install mod_perl :( Mike Flannigan wrote: I use 5.8.0 under Windows. For those that don't know, the way to find out is perl -V at the command prompt Mike "G. Wade Johnson" wrote: > In an effort to get an idea of who is in the group, I thought I'd ask: > > Which version of Perl are you using? > > I'm using 5.8.3 under Linux and 5.8.4 (ActiveState) under Windows. > > Anyone else? > > G. Wade _______________________________________________ Houston mailing list Houston at pm.org http://mail.pm.org/mailman/listinfo/houston -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GIT d s+:++ a C++ UL++ US+ P+++ L++ W+++ w PS PE t++ b+ G e r+++ z++++ ------END GEEK CODE BLOCK------ --------------------------------- Yahoo! Personals Let fate take it's course directly to your email. See who's waiting for you Yahoo! Personals -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/mailman/private/houston/attachments/20051207/3a4422cd/attachment.html From gwadej at anomaly.org Wed Dec 7 05:30:37 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 7 Dec 2005 07:30:37 -0600 Subject: [pm-h] Survey question In-Reply-To: <4396E1B2.F6669E10@earthlink.net> References: <20051207065711.39c5987a@sovvan> <4396E1B2.F6669E10@earthlink.net> Message-ID: <20051207073037.7361cea9@sovvan> On Wed, 07 Dec 2005 07:20:50 -0600 Mike Flannigan wrote: > > I use 5.8.0 under Windows. > > For those that don't know, the way to find out is > perl -V > at the command prompt Thanks for pointing that out, Mike. perl -v Gives just the version and license information. perl -V Gives those and other goodies, like the list of your include directories. G. Wade -- To vacillate or not to vacillate, that is the question ... or is it? From jvogt at houston.oilfield.slb.com Wed Dec 7 12:05:22 2005 From: jvogt at houston.oilfield.slb.com (Jay Vogt) Date: Wed, 07 Dec 2005 14:05:22 -0600 Subject: [pm-h] Survey question References: <20051207065711.39c5987a@sovvan> Message-ID: <43974082.3080500@houston.oilfield.slb.com> I use the installations we have at my office: 5.6.1 for UNIX Solaris 8 5.8.5 for UNIX Solaris 8 and Linux RH3 Update 4. Jay Vogt G. Wade Johnson wrote: >In an effort to get an idea of who is in the group, I thought I'd ask: > >Which version of Perl are you using? > >I'm using 5.8.3 under Linux and 5.8.4 (ActiveState) under Windows. > >Anyone else? > >G. Wade > > From James.Abel at halliburton.com Wed Dec 7 12:09:19 2005 From: James.Abel at halliburton.com (James Abel) Date: Wed, 7 Dec 2005 14:09:19 -0600 Subject: [pm-h] Houston Digest, Vol 13, Issue 3 Message-ID: <0D59B72121BD4442ADD21AF16280179B02B85F81@houexch301.corp.kbr.com> Looks like I am running ActiveState 5.8.6 on all of my machines here at work. Suspect the same at home. James Abel ---------------------------------------------------------------------- This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message. From gwadej at anomaly.org Tue Dec 13 04:41:46 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Tue, 13 Dec 2005 06:41:46 -0600 Subject: [pm-h] No Meeting Tonight Message-ID: <20051213064146.0389d495@sovvan> Sorry I didn't send this out sooner. As we said earlier, there is no December meeting tonight. Happy Holidays, everyone. G. Wade -- "No Boom today. Boom tomorrow, There's always a boom tomorrow." -- Ivanova, "Grail" From gwadej at anomaly.org Tue Dec 13 18:17:10 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Tue, 13 Dec 2005 20:17:10 -0600 Subject: [pm-h] Perl Mongers Census Message-ID: <20051213201710.2cf4e549@sovvan> The official Perl Mongers groups census is out. We show as active, but not very. See how we compare to others. http://www.pm.org/census/2005/list.html G. Wade -- Always hold a grudge. Keeps the memory sharp. -- Hagar the Horrible From mikeflan at earthlink.net Tue Dec 13 18:51:56 2005 From: mikeflan at earthlink.net (Mike Flannigan) Date: Tue, 13 Dec 2005 20:51:56 -0600 Subject: [pm-h] Perl Mongers Census References: <20051213201710.2cf4e549@sovvan> Message-ID: <439F88CC.14DEA9@earthlink.net> >From what I saw, at least we have one of the better websites :-) Mike "G. Wade Johnson" wrote: > The official Perl Mongers groups census is out. > We show as active, but not very. See how we compare to others. > > http://www.pm.org/census/2005/list.html > > G. Wade From gwadej at anomaly.org Sun Dec 18 19:46:03 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Sun, 18 Dec 2005 21:46:03 -0600 Subject: [pm-h] Perl's Birthday Message-ID: <20051218214603.0c306609@sovvan> If my notes are correct, today (12/18) was the Anniversary of the first version of Perl. G. Wade -- Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius, and a lot of courage, to move in the opposite direction. -- Albert Einstein From gwadej at anomaly.org Wed Dec 28 21:52:05 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 28 Dec 2005 23:52:05 -0600 Subject: [pm-h] January's Meeting Topic Message-ID: <20051228235205.34ffb375@sovvan> Unfortunately, Paul Archer and I have not made as much progress on our GUI library comparisons as planned. Paul has volunteered to lead a programming session on accessing a USB device that he has been working on. Hopefully, we will be able to do the GUI comparison in February. G. Wade -- "No Boom today. Boom tomorrow, There's always a boom tomorrow." -- Ivanova, "Grail" From gwadej at anomaly.org Wed Dec 28 21:52:05 2005 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 28 Dec 2005 23:52:05 -0600 Subject: [pm-h] January's Meeting Topic Message-ID: <20051228235205.34ffb375@sovvan> Unfortunately, Paul Archer and I have not made as much progress on our GUI library comparisons as planned. Paul has volunteered to lead a programming session on accessing a USB device that he has been working on. Hopefully, we will be able to do the GUI comparison in February. G. Wade -- "No Boom today. Boom tomorrow, There's always a boom tomorrow." -- Ivanova, "Grail"