Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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.

    yet another biologist hacking perl....

    • Comment on Re: Avoiding Hardcoded path of Perl.exe in coding
  • Replies are listed 'Best First'.
    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.


      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?

    What's my password?
    Create A New User
    Node Status?
    node history
    Node Type: note [id://815976]
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (5)
    As of 2018-06-21 01:29 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (117 votes). Check out past polls.