Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Importing Dependency Version

by perldc (Initiate)
on Oct 10, 2013 at 21:21 UTC ( #1057777=perlquestion: print w/ replies, xml ) Need Help??
perldc has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Email::Date::Format version 1/004 which has a dependency on Exporter 5.57. My server only has an older Exporter 5.562. I downloaded the latest version of Exporter which is currently 5.58 and I put it in my lib directory for my current project. Is there a way that I can tell the Email::Date::Format module to use the version of Exporter in my lib folder? In my main script i'm currently using
use lib qw{./lib/Exporter}; use Exporter 5.68;
I've even tried editing Format.pm and changing
use Exporter 5.57 'import'; to use lib qw{./lib/Exporter}; use Exporter 5.68 'import'; #thinking maybe if i specific the exact ve +rsion it may find it

Comment on Importing Dependency Version
Select or Download Code
Re: Importing Dependency Version (on Exporter)
by Anonymous Monk on Oct 10, 2013 at 21:53 UTC

    Is there a way that I can tell the Email::Date::Format module to use the version of Exporter in my lib folder?

    Yes, by telling perl from your script

    use lib '/absolute/path/to/my/lib'; use Email::Date::Format;

    I've event tried editing Format.pm and changing

    In that case try replacing  use Exporter 5.57 'import'; only with  use Exporter ; and nothing else

    use lib...; only belongs in scripts

    OTOH, 5.6.1, the perl you seem to have, is 12 decades old (120 years), you can install a newer perl like citrusperl in your home directory, or use perlbrew or perlall to do the same from sources

Re: Importing Dependency Version
by Khen1950fx (Canon) on Oct 11, 2013 at 03:17 UTC
    FWIW, the parameter for lib must be a directory and not a file. Here's what I tried with Exporter-5.67:
    #!/usr/bin/perl -l BEGIN { unshift @INC, '/root/mylib/lib'; } use strict; use warnings; require Exporter; use Email::Date::Format; use lib '/root/mylib/lib'; print "Email::Date::Format: ", $Email::Date::Format::VERSION; print "Exporter: ", $Exporter::VERSION;
      That script seems to work and use the Exporter in my projects lib directory. I'm not sure why but I was using:
      use strict; use warnings; use lib qw{./lib}; print "Email::Date::Format: ", $Email::Date::Format::VERSION; print "Exporter: ", $Exporter::VERSION;
      which did not work. Simply moving the use warnings; to the end does work.
      use strict; use lib qw{./lib}; use warnings; print "Email::Date::Format: ", $Email::Date::Format::VERSION; print "Exporter: ", $Exporter::VERSION;
      Apparently there is a special order to for "use" which I did not know about.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1057777]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2014-07-26 13:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (177 votes), past polls