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.
| [reply] [Watch: Dir/Any] |
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.
| [reply] [Watch: Dir/Any] [d/l] [select] |