Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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 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

Replies are listed 'Best First'.
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 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1057777]
Approved by kcott
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2018-06-18 08:36 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.