Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Simple perl question

by karlgoethebier (Monsignor)
on Nov 08, 2012 at 19:31 UTC ( #1002965=note: print w/replies, xml ) Need Help??

in reply to Simple perl question

Another approach to this issue:

Isn't Date::Calc in core? It should be available with your standard perl installation, regardless you use Linux or M$-Dog or something else.

If it is not there for any strange reasons consider this (after download in the unpacked src directory of Date::Calc):

perl Makefile.PL PREFIX=/path/to/your/lib

Say then:

 make && make test && make install

Then, in your app say:

use lib q(/path/to/your/lib); use Date::Calc;

And i can't see any security problems installing modules as root. How else should this be done in the default places?. E.g. on my Mac:

Karls-Mac-mini:~ karl$ perl -e 'print join(qq(\n), @INC);' /sw/lib/perl5 /sw/lib/perl5/darwin /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 # and many more...


Karls-Mac-mini:~ karl$ ls -hlrt /Library/Perl/5.12 total 216 -r--r--r-- 1 root wheel 31K 26 Feb 2011 -rw-r--r-- 1 root wheel 33B 11 Okt 2011 AppendToPath -r--r--r-- 1 root wheel 543B 4 Apr 2012 -r--r--r-- 1 root wheel 20K 18 Jun 13:32 -r--r--r-- 1 root wheel 8,9K 9 Sep 03:15 -r--r--r-- 1 root wheel 946B 11 Sep 20:24 -r--r--r-- 1 root wheel 23K 23 Okt 17:27 drwxr-xr-x 3 root wheel 102B 27 Okt 13:46 B drwxr-xr-x 7 root wheel 238B 27 Okt 13:48 DateTime # and many more...

As you can see everything belongs to root:wheel but the rest can use it anyway. This is the default: Stuff belongs to root:wheel in that directories but is used under your UID if you call it.

A thing one might think about is: I don't want to mess up my default @INC. Then use PREFIX as described above.

BTW: Consider to take a look at Datetime. And trust toolic.

As always, i hope i didn't miss something.

Regards, Karl

P.S.: I did something wrong, s***t. If installing as root, make install as root , or root does it himself, sorry for that - sink before you type ;-)

Replies are listed 'Best First'.
Re^2: Simple perl question
by toolic (Bishop) on Nov 08, 2012 at 19:54 UTC
    Isn't Date::Calc in core?
    No (as of perl 5.14):
    corelist Date::Calc Date::Calc was not in CORE (or so I think)

      ...right for my Mac too using v5.12.3:

      Karls-Mac-mini:~ karl$ corelist Date::Calc Date::Calc was not in CORE (or so I think)

      I installed it and forgot about...

        Just to keep my mental health:

        Karls-Mac-mini:Date-Calc-6.3 karl$ perl Makefile.PL PREFIX=/Users/karl +/lib #... Karls-Mac-mini:Date-Calc-6.3 karl$ make && make test && make install #... Karls-Mac-mini:Date-Calc-6.3 karl$ cd Karls-Mac-mini:~ karl$ ls -hlrt lib/ total 0 drwxr-xr-x 3 karl karl 102B 8 Nov 21:57 share drwxr-xr-x 3 karl karl 102B 8 Nov 21:57 lib drwxr-xr-x 3 karl karl 102B 8 Nov 21:57 Library karls-Mac-mini:Date-Calc-6.3 karl$ perl -I/Users/karl/lib/ -MDate::Cal +c -MData::Dumper -e 'print Dumper(Date::Calc::Today_and_Now()).join(q +q(\n),@INC);' $VAR1 = 2012; $VAR2 = 11; $VAR3 = 8; $VAR4 = 22; $VAR5 = 44; $VAR6 = 27; /Users/karl/lib/ /sw/lib/perl5 /sw/lib/perl5/darwin /Library/Perl/5.12/darwin-thread-multi-2level #... karls-Mac-mini:Date-Calc-6.3 karl$ perl -MDate::Calc -MData::Dumper -e + 'print Dumper(Date::Calc::Today_and_Now()).join(qq(\n),@INC);' $VAR1 = 2012; $VAR2 = 11; $VAR3 = 8; $VAR4 = 22; $VAR5 = 42; $VAR6 = 48; /sw/lib/perl5 /sw/lib/perl5/darwin /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 #...

        Seems it finds the right one. Regards, Karl

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002965]
and a soft breeze sighs...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2018-05-24 23:35 GMT
Find Nodes?
    Voting Booth?