Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Module forwarding

by Anonymous Monk
on Feb 06, 2012 at 14:49 UTC ( [id://952095]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Perl Monks, I have a set of libraries that my team would like to shares, (e.g., myLib/1.0/myLib.pm). The trouble is that we want a "symlink" in a standard location to myLib.pm -- BUT: symlinks are not supported in the present environment. I would like to create a shell .pm that does the linking. Something like
myLib.pm: use <long_path_to_real_location/myLib.pm>;
I am fairly certain that the above won't work because of namespace issues. Is there a module import forwarder? (oh and what should one call such a thing?) I could just copy the file, but that means patches have to get applied in two places... Any help is appreciated!

Replies are listed 'Best First'.
Re: Module forwarding
by Corion (Patriarch) on Feb 06, 2012 at 14:58 UTC

    Have you looked at use? It shows how use works and that should give you enough hints on how to do your "module loader" as well.

    Also, maybe you want to look at perlvar regarding @INC instead of doing manual module loading?

      As far as using @INC: We want to do that with a single repository... Our format is that each lib lives in its own versioned directory -- and each directory is owned by a team member, and we have about 30 such directories... So having them individually in the path is inconvenient. We could centralize the mechanism to create @INC -- which should reduce headaches when a file upgrade occurs. Indeed, that's the motivation for centralizing them via symlinks. Each module is also run-able to provide self-tests and documentation. I had hope there was a standard CPAN solution for this... at the moment mucking around with require/import/do to see if I can hack it out......

        That concept lacks an installer. Perl has standard mechanisms for installing modules, ExtUtils::MakeMaker is the oldest one, Module::Build is newer, several others attempt to improve various details. But the best: All of these can be used by the various CPAN modules to install modules from a repository into a running system.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        .. this isn't looking very easy... My problem is that it seems to depend on whether the forwarded module uses "export" or not....
Re: Module forwarding
by MidLifeXis (Monsignor) on Feb 06, 2012 at 15:24 UTC

    In addition to what Corion mentioned above, see also the environment PERLLIB or PERL5LIB.

    --MidLifeXis

Re: Module forwarding
by InfiniteSilence (Curate) on Feb 06, 2012 at 15:29 UTC

    My intuition tells me to try to use minicpan for a central server, put all of my modules there, and then write a script to periodically update modules on client computers, but as I see this has been apparently though of before by people smarter than myself. In Szabgab's follow up post he points to several modules by brian d foy that I haven't researched yet which may do the job.

    Celebrate Intellectual Diversity

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-23 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found