Question

getting following error while running my perl scirpt.

Can't locate Date/Parse.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.16.1/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.16.1 /opt/local/lib/perl5/vendor_perl/5.16.1/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.16.1 /opt/local/lib/perl5/5.16.1/darwin-thread-multi-2level /opt/local/lib/perl5/5.16.1 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl .) at ../../tools/replace_tenant_json_data.pl line 27. BEGIN failed--compilation aborted at ../../tools/replace_tenant_json_data.pl line 27.

From above error I infer perl looks into wrong dir for modules. The right directory is /System/Library/Perl/5.16

command env –I perl –V is different form perl –V

`env –I perl –V
 @INC:
/Library/Perl/5.16/darwin-thread-multi-2level
/Library/Perl/5.16
/Network/Library/Perl/5.16/darwin-thread-multi-2level
/Network/Library/Perl/5.16
/Library/Perl/Updates/5.16.2
/System/Library/Perl/5.16/darwin-thread-multi-2level
/System/Library/Perl/5.16
/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.16

perl –V
@INC:
/opt/local/lib/perl5/site_perl/5.16.1/darwin-thread-multi-2level
/opt/local/lib/perl5/site_perl/5.16.1
/opt/local/lib/perl5/vendor_perl/5.16.1/darwin-thread-multi-2level
/opt/local/lib/perl5/vendor_perl/5.16.1
/opt/local/lib/perl5/5.16.1/darwin-thread-multi-2level
/opt/local/lib/perl5/5.16.1
/opt/local/lib/perl5/site_perl
/opt/local/lib/perl5/vendor_perl`
Was it helpful?

Solution

@NigoroJr gave the right hint in the comment under the main question (cpan Date::Parse) but I'll expound upon the differences in the perl -V outputs.

From the Darwin man page for env:

SYNOPSIS
     env [-i] [name=value ...] [utility [argument ...]]

DESCRIPTION
     env executes utility after modifying the environment as specified on the command line.  The option
     name=value specifies an environmental variable, name, with a value of value.  The option '-i' causes
     env to completely ignore the environment it inherits.

So, when you run env -i perl -V, you get a blank/default environment, which is picking up the system-installed perl. When you run just `perl -V', you get the version you're actually using, which looks like something you installed.

BTW, it looks like your active Perl is an older rev than the one the system provides, so maybe you should consider switching back to the system-provided Perl.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top