Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: are installed modules relocatable?

by aquarium (Curate)
on Nov 09, 2010 at 02:40 UTC ( [id://870231]=note: print w/replies, xml ) Need Help??


in reply to Re^3: are installed modules relocatable?
in thread are installed modules relocatable?

i used mechanize.pm as an example. so if scripts have "use www::mechanize" it would break if you move mechanize.pm into another directory not named www. the point (if any) i was trying to make is that moving installed modules can break scripts if the module is a sub-module. so you can't just move any/every module without some possible little problems. And if you do move (for example) mechanize.pm into a directory not named www and try to "use mechanize" instead, hopefully it still works and doesn't break ISA?
the hardest line to type correctly is: stty erase ^H

Replies are listed 'Best First'.
Re^5: are installed modules relocatable?
by Corion (Patriarch) on Nov 09, 2010 at 08:10 UTC

    If you really, really want to do this (and I'm not saying that this is a good idea), read about how use and require work. Then it's easy to either manually replicate what they do, with appropriate changes, or to do further reading about @INC and to unshift your own handler onto it.

Re^5: are installed modules relocatable?
by ikegami (Patriarch) on Nov 09, 2010 at 03:29 UTC

    i used mechanize.pm as an example

    Then you're seeking a generic answer and I had already given that.

    it would break if you move mechanize.pm into another directory not named www

    Correct, you are not free to change the directory structure, just to copy or move it. (At least, not without making additional changes.) Your library directory is .../lib/, not .../lib/WWW/.

    And if you do move (for example) mechanize.pm into a directory not named www and try to "use mechanize" instead, hopefully it still works and doesn't break ISA?

    In general, this won't work because the module's import won't get found. Again, you are not free to change the directory structure, just move it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-03-19 06:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found