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

Re: [PBML] Passing variable to second file (cross posted to 'beginners@perl.org

Expand Messages
  • Mike Southern
    PS: I assumed that you were writing a program running outside of a website environment - like a file or text processor. If what you are doing is web page form
    Message 1 of 4 , May 3 6:07 PM
    • 0 Attachment
      PS: I assumed that you were writing a program running outside of a website
      environment - like a file or text processor.

      If what you are doing is web page form processing then not much of what I
      wrote applies (except to encourage good design :) )

      HTML form get/post methods of course are built entirely to pass data between
      different handling scripts.




      > Hi,
      >
      > I have a script that is divided into 2 files for manageability. Each
      > is
      > about 700 lines in length and the second file is called from the
      > first
      > using the 'Require' method.
      >
      > Is there an easy way of passing a variable from the first file to the
      > second? Or should I be looking at using @Export or something similar?
      >
      > Thanks
      > John
    • johnbr123zzz
      Hi Thanks everyone for your comments. I have taken note of the advice re better programming practices. This was my first Perl script and the aim was to just
      Message 2 of 4 , May 3 7:10 PM
      • 0 Attachment
        Hi

        Thanks everyone for your comments. I have taken note of the advice re
        better programming practices.

        This was my first Perl script and the aim was to just get something
        that ran reliably and learn perl at the same time. It runs as a unix
        Cron job (outside of a website) on our network doing daily number
        crunching and then emails the results.

        Wanting to pass variables between the two files has only come about
        since trying to do a recent change. For ease of testing I wanted the
        script to know whether its running in the production or testing
        environment.

        In the long term I will probably rewrite it. I am thinking it might
        be a good exercise to put a lot of the subs into a module, for reuse.

        Thanks, John

        --- In perl-beginner@yahoogroups.com, Mike Southern <gb1198@c...>
        wrote:
        > PS: I assumed that you were writing a program running outside of a
        website
        > environment - like a file or text processor.
        >
        > If what you are doing is web page form processing then not much of
        what I
        > wrote applies (except to encourage good design :) )
        >
        > HTML form get/post methods of course are built entirely to pass
        data between
        > different handling scripts.
        >
        >
        >
        >
        > > Hi,
        > >
        > > I have a script that is divided into 2 files for manageability.
        Each
        > > is
        > > about 700 lines in length and the second file is called from the
        > > first
        > > using the 'Require' method.
        > >
        > > Is there an easy way of passing a variable from the first file to
        the
        > > second? Or should I be looking at using @Export or something
        similar?
        > >
        > > Thanks
        > > John
      Your message has been successfully submitted and would be delivered to recipients shortly.