Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Avoiding Hardcoded path of Perl.exe in coding

by MadraghRua (Vicar)
on Jan 06, 2010 at 20:19 UTC ( #815976=note: print w/ replies, xml ) Need Help??


in reply to Avoiding Hardcoded path of Perl.exe in coding

You could try a few things:

  • Use system to run Perl -v and use that to figure out where Perl's libraries are. You could then walk up the library locations to test for a bin directory. For instance ActiveState Perl has a pretty standard installation, I'm sure other Perls do as well;
  • Use a standardized installation for Perl on all recipient machines - that way you known where it is always going to be. Make sure perl is part of your PATH variables. For instance if you run set through a system or cmd call, you can grep for PATH and then grep for the instance of your Perl installation. That's something you may have to organize with your IT department;
  • Use a packaging program to bundle up Perl with the associated program and modules you need to run your stuff. I use ActiveState's PDK PerlApp for this. Its pretty robust and I know I can create something that other IT groups can install on a large number of computers.

    Of course if you can run the app through the web you can avoid installation issues...

    Hope that helps.

    MadraghRua
    yet another biologist hacking perl....


  • Comment on Re: Avoiding Hardcoded path of Perl.exe in coding
    Re^2: Avoiding Hardcoded path of Perl.exe in coding
    by toastbread (Novice) on Jan 06, 2010 at 21:51 UTC

      Thanks to your replies! =)

      "$^X" is working fine in my code. Now I can remove the part that uses "ftype perl". I did a file manipulation and Regex when I used ftype command just to get the path. And it took more lines.

      Thanks to suggestions of MadraghRua. I might use those someday when I run my own network of computers and do a large application using perl. Currently I'm a perl newbie but I think I could improve a lot from this site. This is my first pose and I've got what I want. Thanks again for your replies.

      -toastbread

      P. S.
      At first, I nearly stop proceeding from this site because its hard to locate links and read texts. It's just purely text, lines and borders. I need to enlarge the fonts with the mouse just to read easily some text lines especially the codes since they are very small. But I'm becoming used to it. Still, it's more comfortable if it has nice design. Could I request to the elder monks to add some design and user interfaces to the pages?
        P. S. ...

        I'd suggest that you re-post your PS as a new node in PerlMonks Discussion. It might not get noticed by the right people tucked away down here.

        Someone will likely be able to tell you how to add some CSS to your settings to increase the font size(s) used.

    Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (10)
    As of 2014-12-21 09:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (104 votes), past polls