Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / February 2007



Tip: Looking for answers? Try searching our database.

@INC problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vic Norton - 22 Feb 2007 23:21 GMT
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
Sherm Pendley - 23 Feb 2007 00:27 GMT
> Apple suggested I install something the other day. (Java or  
> something like that.) I did it. Now I discover that many of my Perl  
[quoted text clipped - 13 lines]
>    /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
[quoted text clipped - 4 lines]
>    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
Vic Norton - 23 Feb 2007 01:22 GMT
> 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
Doug McNutt - 23 Feb 2007 00:33 GMT
>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.
Signature


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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.