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

RE: [PBML] Loading variables from a file.

Expand Messages
  • Kevin Patterson
    Thanks. I read the require option and it works great for me.. Other people wont need to edit these variables.. I just got tired of writing the same variable in
    Message 1 of 10 , Mar 26, 2008
    • 0 Attachment
      Thanks.



      I read the require option and it works great for me..

      Other people wont need to edit these variables..

      I just got tired of writing the same variable in 10 different programs..



      _____

      From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com]
      On Behalf Of Jenda Krynicky
      Sent: Tuesday, March 25, 2008 3:33 PM
      To: perl-beginner@yahoogroups.com
      Subject: Re: [PBML] Loading variables from a file.



      From: "Kevin Patterson" <kpatters@berkeley. <mailto:kpatters%40berkeley.edu>
      edu>
      > Is there a way to place all of your variables in a file then load the
      > variables into your program from that file???

      You should NOT place all your variables anywhere. Most of the
      variables within your program should have a fairly small scope (the
      part of the program where they exist) and it makes no sense
      whatsoever to put them anywhere.

      If you want to store some DATA outside the program you may have a
      look at some of the Config:: modules on CPAN, or the XML:: modules or
      YAML. You may also specify the data in the "perl format" and load
      them using "use", "require" or "do" (look up those statements in the
      Perl documentation) but quite often this is not the best thing to do.
      Especially if you need other people to be able to edit the files.

      Jenda
      ===== Jenda@Krynicky. <mailto:Jenda%40Krynicky.cz> cz === http://Jenda.
      <http://Jenda.Krynicky.cz> Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery





      [Non-text portions of this message have been removed]
    • Gergely Brautigam
      I m just curious. What did you decide to use? A perl file full of variables, then use it… Or the config file / xml / config module? From:
      Message 2 of 10 , Mar 26, 2008
      • 0 Attachment
        I'm just curious. What did you decide to use? A perl file full of variables, then use it… Or the config file / xml / config module?



        From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Kevin Patterson
        Sent: Wednesday, March 26, 2008 1:08 PM
        To: perl-beginner@yahoogroups.com
        Subject: RE: [PBML] Loading variables from a file.



        Thanks.

        I read the require option and it works great for me..

        Other people wont need to edit these variables..

        I just got tired of writing the same variable in 10 different programs..

        _____

        From: perl-beginner@yahoogroups.com <mailto:perl-beginner%40yahoogroups.com> [mailto:perl-beginner@yahoogroups.com <mailto:perl-beginner%40yahoogroups.com> ]
        On Behalf Of Jenda Krynicky
        Sent: Tuesday, March 25, 2008 3:33 PM
        To: perl-beginner@yahoogroups.com <mailto:perl-beginner%40yahoogroups.com>
        Subject: Re: [PBML] Loading variables from a file.

        From: "Kevin Patterson" <kpatters@berkeley. <mailto:kpatters%40berkeley.edu>
        edu>
        > Is there a way to place all of your variables in a file then load the
        > variables into your program from that file???

        You should NOT place all your variables anywhere. Most of the
        variables within your program should have a fairly small scope (the
        part of the program where they exist) and it makes no sense
        whatsoever to put them anywhere.

        If you want to store some DATA outside the program you may have a
        look at some of the Config:: modules on CPAN, or the XML:: modules or
        YAML. You may also specify the data in the "perl format" and load
        them using "use", "require" or "do" (look up those statements in the
        Perl documentation) but quite often this is not the best thing to do.
        Especially if you need other people to be able to edit the files.

        Jenda
        ===== Jenda@Krynicky. <mailto:Jenda%40Krynicky.cz> cz === http://Jenda.
        <http://Jenda.Krynicky.cz> Krynicky.cz =====
        When it comes to wine, women and song, wizards are allowed
        to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery

        [Non-text portions of this message have been removed]





        [Non-text portions of this message have been removed]
      • Kevin Patterson
        I just used a files called perlvars.txt I may have to rethink the require option tho. I found out that the require used the variable on the first notice of a
        Message 3 of 10 , Mar 27, 2008
        • 0 Attachment
          I just used a files called perlvars.txt



          I may have to rethink the require option tho.



          I found out that the require used the variable on the first notice of a
          variable.

          But if the same variable is used later on in the code, it did not recognize
          it..



          _____

          From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com]
          On Behalf Of Gergely Brautigam
          Sent: Wednesday, March 26, 2008 5:14 AM
          To: perl-beginner@yahoogroups.com
          Subject: RE: [PBML] Loading variables from a file.



          I'm just curious. What did you decide to use? A perl file full of variables,
          then use it. Or the config file / xml / config module?



          From: perl-beginner@ <mailto:perl-beginner%40yahoogroups.com>
          yahoogroups.com [mailto:perl-beginner@
          <mailto:perl-beginner%40yahoogroups.com> yahoogroups.com] On Behalf Of Kevin
          Patterson
          Sent: Wednesday, March 26, 2008 1:08 PM
          To: perl-beginner@ <mailto:perl-beginner%40yahoogroups.com> yahoogroups.com
          Subject: RE: [PBML] Loading variables from a file.



          Thanks.

          I read the require option and it works great for me..

          Other people wont need to edit these variables..

          I just got tired of writing the same variable in 10 different programs..

          _____

          From: perl-beginner@ <mailto:perl-beginner%40yahoogroups.com>
          yahoogroups.com <mailto:perl-beginner%40yahoogroups.com>
          [mailto:perl-beginner@ <mailto:perl-beginner%40yahoogroups.com>
          yahoogroups.com <mailto:perl-beginner%40yahoogroups.com> ]
          On Behalf Of Jenda Krynicky
          Sent: Tuesday, March 25, 2008 3:33 PM
          To: perl-beginner@ <mailto:perl-beginner%40yahoogroups.com> yahoogroups.com
          <mailto:perl-beginner%40yahoogroups.com>
          Subject: Re: [PBML] Loading variables from a file.

          From: "Kevin Patterson" <kpatters@berkeley. <mailto:kpatters%40berkeley.edu>
          edu>
          > Is there a way to place all of your variables in a file then load the
          > variables into your program from that file???

          You should NOT place all your variables anywhere. Most of the
          variables within your program should have a fairly small scope (the
          part of the program where they exist) and it makes no sense
          whatsoever to put them anywhere.

          If you want to store some DATA outside the program you may have a
          look at some of the Config:: modules on CPAN, or the XML:: modules or
          YAML. You may also specify the data in the "perl format" and load
          them using "use", "require" or "do" (look up those statements in the
          Perl documentation) but quite often this is not the best thing to do.
          Especially if you need other people to be able to edit the files.

          Jenda
          ===== Jenda@Krynicky. <mailto:Jenda%40Krynicky.cz> cz === http://Jenda.
          <http://Jenda. <http://Jenda.Krynicky.cz> Krynicky.cz> Krynicky.cz =====
          When it comes to wine, women and song, wizards are allowed
          to get drunk and croon as much as they like.
          -- Terry Pratchett in Sourcery

          [Non-text portions of this message have been removed]




          [Non-text portions of this message have been removed]





          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.