in reply to convert iso8601 to epoch time without using additional module

our UNIX admin is not willing to install any module

The question then becomes: are you willing to install a module? Since administrative privileges are not required in order to install a module, anyone with a user account on the server can install one there. Yes, even you can use CPAN so there's no need to go reinventing any wheels.

Good luck!

  • Comment on Re: convert iso8601 to epoch time without using additional module

Replies are listed 'Best First'.
Re^2: convert iso8601 to epoch time without using additional module
by swissknife (Sexton) on Mar 13, 2014 at 15:48 UTC

    BEGIN PASTE

    The first step was learning how to install modules without root. Though I generally have root authority on my boxes, I found it informative and it actually has become the basis for some of my other work. The key has been to set PERL5LIB to include the path you're using to install to, e.g., $ENV{PERL5LIB} = "$ENV{HOME}/lib/perl5:$ENV{HOME}/lib" (I think some of the modules install differently when it's ~/lib instead of, say, ~/myperllib, so I found I had to add both) and then pass in the correct parameters to the .PL script the module comes with, e.g.: $^X -I$ENV{HOME}/lib Build.PL --install_base $ENV{HOME}/lib or $^X -I$ENV{HOME}/lib Makefile.PL LIB=$ENV{HOME}/lib PREFIX=$ENV{HOME}. The -I flag may be optional - but I like being explicit. Once you have everything extracted and then the Makefile or Build files created, go ahead as normal, as if you had root. You just need to ensure PERL5LIB stays set, or that your scripts do a use lib ... properly before trying to use or require anything installed privately like this.

    END PASTE

    Does not work for me. I got the below error when running $ENV{PERL5LIB} = "$ENV{HOME}/lib/perl5:$ENV{HOME}/lib".

    /home/swissknife/ .kshrc{PERL5LIB}: not found

    also i think it will give error when i execute further $^X -I$ENV{HOME}/lib Build.PL --install_base $ENV{HOME}/lib. is ^X is valid here?

      Those are commands to run from inside perl, not directly at shell level. $^X is the name of the current perl executable, for example, as mentioned in perlvar. Don't run them at the shell prompt as they will make no sense there.

      HTH