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

Re^2: Executing a program from within a Perl Module in a non-standard path ($PATH/%PATH%)

by GoldElite (Sexton)
on Mar 20, 2013 at 11:45 UTC ( #1024500=note: print w/replies, xml ) Need Help??


in reply to Re: Executing a program from within a Perl Module in a non-standard path ($PATH/%PATH%)
in thread Executing a program from within a Perl Module in a non-standard path

Hmmm. It feels a little heavy-handed to modify the PATH for each potential script/executable after a recursive search, considering I technically know where they are stored (in the directory of the calling project/script, given a heirarchy of projects).

On top of that, since I don't know it explicitly (that's pretty much the entire problem here!), $startdir will always be the cwd, too (or at least $FindBin::Bin), which would be redundant if PathStuffer is used multiple times (the search is probably a negligable impact in this day and age, but still. ;) ).

Also, it's not always the case that a file will be a script (note that 'rdiff' is an executable binary), so just searching for ".pl" doesn't quite cover all use cases. Since *nix binaries don't really have naming conventions (and hence I'd have to search for ".*"), I'd necessarily be including every directory into the path to include it, which just makes me feel dirty. (It probably wasn't obvious that I'm using *nix boxes here, but I'd like to keep the code portable either way)

 

That said, this is certainly still a viable option that I wouldn't have considered otherwise :)

  • Comment on Re^2: Executing a program from within a Perl Module in a non-standard path ($PATH/%PATH%)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024500]
help
Chatterbox?
[LanX]: davies: same problem
[Corion]: It had been approved as a Perl Monks Discussion. It should now be approvable into SoPW
[choroba]: Approved
[LanX]: hmm aproval doesn't stick after move? Or was it a race condition
[Corion]: I think you need at least one reload after moving before you can approve in the correct section
[GotToBTru]: it was approved . but isnt now

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2017-01-16 15:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (151 votes). Check out past polls.