@INC problem

2007-02-22 Thread Vic Norton
Apple suggested I install something the other day. (Java or something like 
that.) I did it. Now I discover that many of my Perl scripts don't work.

The problem is with @INC. It appears to have been upgraded to Perl 5.8.8. For 
example, when I try
   use Date::Parse qw(str2time);
I get the message
   /Volumes/VTN Docs/ My Perl/Tests/test5.pl:6: Can't locate Date/Parse.pm in 
@INC
followed by a list of what @INC contains:
   /Volumes/VTN Docs/ My Perl/Tests
   /usr/local/lib/perl5/5.8.8/darwin-2level
   /usr/local/lib/perl5/5.8.8
   /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level
   /usr/local/lib/perl5/site_perl/5.8.8
   /usr/local/lib/

The package Date/Parse.pm is right where it has always been, along with a 
whole pile of other stuff, in
   /Library/Perl/5.8.6

So this is my question. How do I add /Library/Perl/5.8.6 to @INC, without 
having to add
   use lib /Library/Perl/5.8.6;
to every script ?

Regards,

Vic


Re: @INC problem

2007-02-22 Thread Sherm Pendley

On Feb 22, 2007, at 6:21 PM, Vic Norton wrote:

Apple suggested I install something the other day. (Java or  
something like that.) I did it. Now I discover that many of my Perl  
scripts don't work.


The problem is with @INC. It appears to have been upgraded to Perl  
5.8.8. For example, when I try

   use Date::Parse qw(str2time);
I get the message
   /Volumes/VTN Docs/ My Perl/Tests/test5.pl:6: Can't locate Date/ 
Parse.pm in @INC

followed by a list of what @INC contains:
   /Volumes/VTN Docs/ My Perl/Tests
   /usr/local/lib/perl5/5.8.8/darwin-2level
   /usr/local/lib/perl5/5.8.8
   /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level
   /usr/local/lib/perl5/site_perl/5.8.8
   /usr/local/lib/


That's not Apple's Perl, or anything that resulted from the recent  
Apple update. I've looked through the recent Apple update receipts,  
and didn't find anything Perl-related. You can use lsbom to check the  
contents of anything installed from .pkg or .mpkg packages, which  
includes Apple updates. The receipts are in /Library/Receipts, so to  
find the.boms for packages installed in the last 7 days:


find /Library/Receipts -newerct '7 days ago' -name '*.bom'

Then, to browse the list of files installed by a package using the  
less command:


	lsbom /Library/Receipts/JavaForMacOSX10.4Release5.pkg/Contents/ 
Archive.bom | less


The package Date/Parse.pm is right where it has always been,  
along with a whole pile of other stuff, in

   /Library/Perl/5.8.6

So this is my question. How do I add /Library/Perl/5.8.6 to @INC,  
without having to add

   use lib /Library/Perl/5.8.6;
to every script ?


Possibly, someone replaced all your scripts #!/usr/bin/perl with #!/ 
usr/local/bin/perl. Maybe you did that to test them against the newer  
Perl and forgot to change it back, or maybe someone in your house has  
a strange sense of humor. :-)


If your scripts still say #!/usr/bin/perl, then something has removed  
the original /usr/bin/perl and replaced it with a link to /usr/local/ 
bin/perl. You can check that with /usr/bin/perl -v.


Fortunately, the original is also a link, to /usr/bin/perl5.8.6, so  
if it was disturbed, it's easy to make things right:


sudo rm /usr/bin/perl
sudo ln /usr/bin/perl5.8.6 /usr/bin/perl

sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net




Re: @INC problem

2007-02-22 Thread Doug McNutt
At 18:21 -0500 2/22/07, Vic Norton wrote:
So this is my question. How do I add /Library/Perl/5.8.6 to @INC, without 
having to add
   use lib /Library/Perl/5.8.6;
to every script ?

It's likely that there is abetter way, but. . .

If you define the environment variable PERL5LIB in your 
$HOME/.MacOSX/environment.plist file you can add directories to @INC which will 
be present no matter what shell or scripting language you are using. There is 
an Apple-provided app note about environment.plist.

What I worry about is the older functions in 5.8.6 may not work.
-- 

-- From the U S of A, the only socialist country that refuses to admit it. --


Re: @INC problem

2007-02-22 Thread Vic Norton
On 2/22/07, at 7:27 PM -0500, Sherm Pendley wrote:
 Possibly, someone replaced all your scripts #!/usr/bin/perl with #!/ 
 usr/local/bin/perl. Maybe you did that to test them against the newer  
 Perl and forgot to change it back, or maybe someone in your house has  
 a strange sense of humor. :-)

I don't have that strange a sense of humor, Sherm, and I'm the only one in the 
house who works with Perl. The bang lines on my problematic test routines all 
read #!/usr/local/bin/perl and the bang lines on good routines read 
#!/usr/bin/perl. I think my computer may be infected with gremlins.

I've changed everything to read #!/usr/bin/perl and now everything works. 
Thanks so much for your help! Unfortunately most of this system stuff is a 
mystery to me.

Regards,

Vic