Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] do (not the loop) with PATH

Expand Messages
  • erik.tank@bpxinternet.com
    If you are trying to run a routine in another file you can do the following: require script.pl ; # note that you do have to have correct path information
    Message 1 of 4 , Jul 5, 2001
    • 0 Attachment
      If you are trying to run a routine in another file you can do the following:
      require "script.pl"; # note that you do have to have correct path
      information

      function_within_scriptpl(); # calls a function that is located in script.pl

      If you are just trying to execute a whole other script I would simply wrap
      the entire file with a function.

      Hope that helps,

      Erik Tank
      602-817-4705
      erik.tank@...


      -----Original Message-----
      From: obrienta@... [mailto:obrienta@...]
      Sent: Thursday, July 05, 2001 7:47 AM
      To: perl-beginner@yahoogroups.com
      Subject: [PBML] do (not the loop) with PATH


      How can I make do "script.pl" locate script.pl within my path? I can get
      the main program to be found in PATH with no problem, but the only way I can
      get a called script from within a script to follow the path is to use a
      system("script.pl") call, and I really hate system calls. I've tried
      $ENV{PATH}=script location and that does not work.

      Tommy O




      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • obrienta@iserv.net
      It is an entire script, and I just don t want to wrap it! It sometimes needs to be run independantly, other times it is run from within another script. I
      Message 2 of 4 , Jul 5, 2001
      • 0 Attachment
        It is an entire script, and I just don't want to wrap it! It sometimes needs to be run independantly, other times it is run from within another script. I guess I'll just use system call, it's still only one line and Perl should run it internally anyways.

        Tommy O

        --- In perl-beginner@y..., erik.tank@b... wrote:
        > If you are trying to run a routine in another file you can do the following:
        > require "script.pl"; # note that you do have to have correct path
        > information
        >
        > function_within_scriptpl(); # calls a function that is located in script.pl
        >
        > If you are just trying to execute a whole other script I would simply wrap
        > the entire file with a function.
        >
        > Hope that helps,
        >
        > Erik Tank
        > 602-817-4705
        > erik.tank@b...
        >
        >
        > -----Original Message-----
        > From: obrienta@i... [mailto:obrienta@i...]
        > Sent: Thursday, July 05, 2001 7:47 AM
        > To: perl-beginner@y...
        > Subject: [PBML] do (not the loop) with PATH
        >
        >
        > How can I make do "script.pl" locate script.pl within my path? I can get
        > the main program to be found in PATH with no problem, but the only way I can
        > get a called script from within a script to follow the path is to use a
        > system("script.pl") call, and I really hate system calls. I've tried
        > $ENV{PATH}=script location and that does not work.
        >
        > Tommy O
        >
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      • erik.tank@bpxinternet.com
        This my be a little overkill, but it works. Make the script a library so to speak, again the part that you need to use is wrapped in a function. Then you can
        Message 3 of 4 , Jul 5, 2001
        • 0 Attachment
          This my be a little overkill, but it works. Make the script a library so to
          speak, again the part that you need to use is wrapped in a function. Then
          you can create another file which uses require to include you library file.
          Then you are able to call the new program from the command line. Again an
          overkill, but it is the basis of sharing code and gets you away from using
          the system call. Then you can require the file in the other program that
          you want to use it in.

          Hope that helps,

          Erik Tank
          602-817-4705
          erik.tank@...


          -----Original Message-----
          From: obrienta@... [mailto:obrienta@...]
          Sent: Thursday, July 05, 2001 10:14 AM
          To: perl-beginner@yahoogroups.com
          Subject: Re: [PBML] do (not the loop) with PATH


          It is an entire script, and I just don't want to wrap it! It sometimes
          needs to be run independantly, other times it is run from within another
          script. I guess I'll just use system call, it's still only one line and
          Perl should run it internally anyways.

          Tommy O

          --- In perl-beginner@y..., erik.tank@b... wrote:
          > If you are trying to run a routine in another file you can do the
          following:
          > require "script.pl"; # note that you do have to have correct path
          > information
          >
          > function_within_scriptpl(); # calls a function that is located in
          script.pl
          >
          > If you are just trying to execute a whole other script I would simply wrap
          > the entire file with a function.
          >
          > Hope that helps,
          >
          > Erik Tank
          > 602-817-4705
          > erik.tank@b...
          >
          >
          > -----Original Message-----
          > From: obrienta@i... [mailto:obrienta@i...]
          > Sent: Thursday, July 05, 2001 7:47 AM
          > To: perl-beginner@y...
          > Subject: [PBML] do (not the loop) with PATH
          >
          >
          > How can I make do "script.pl" locate script.pl within my path? I can get
          > the main program to be found in PATH with no problem, but the only way I
          can
          > get a called script from within a script to follow the path is to use a
          > system("script.pl") call, and I really hate system calls. I've tried
          > $ENV{PATH}=script location and that does not work.
          >
          > Tommy O
          >
          >
          >
          >
          > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        Your message has been successfully submitted and would be delivered to recipients shortly.