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

Using Win System Variables??

Expand Messages
  • Denham Eva
    Hello Folks, Trying to write a program which will be run on a number of different machines, each configured differently. Hence I would like to create a
    Message 1 of 8 , Sep 6, 2002
    • 0 Attachment
      Hello Folks,

      Trying to write a program which will be run on a number of different
      machines, each configured differently.
      Hence I would like to create a user/system variable which points to the
      location of a file on the system. ie %ORABCK% ( An oracle backup location)
      Is there a way that I can use this variable in my perl program?
      Otherwise I'll have to be forced to use a external file or edit the program
      for each machine. I have looked at the perldoc but it has not been very
      helpful, perhaps I asking it the wrong questions.

      Any help will be much appreciated!
      Regards
      Denham Eva
      Oracle DBA
      In UNIX Land
      On a quiet Night, you can hear the Windows machines reboot.


      ____________________________________________________________________________________________
      DISCLAIMER
      This message is for the named person's use only. It may contain confidential,
      proprietary or legally privileged information. No confidentiality or privilege
      is waived or lost by any mistransmission. If you receive this message in error,
      please immediately delete it and all copies of it from your system, destroy any
      hard copies of it and notify the sender. You must not, directly or indirectly,
      use, disclose, distribute, print, or copy any part of this message if you are not
      the intended recipient. TFMC, its holding company, and any of its subsidiaries each reserve
      the right to monitor and manage all e-mail communications through its networks.

      Any views expressed in this message are those of the individual sender, except where
      the message states otherwise and the sender is authorized to state them to be the
      views of any such entity.
      ____________________________________________________________________________________________

      _____________________________________________________________________________________
      This e-mail message has been scanned for Viruses and Content and cleared
      by MailMarshal

      For more information please visit www.marshalsoftware.com
      _____________________________________________________________________________________

      ____________________________________________________________________________________________
      DISCLAIMER
      This message is for the named person's use only. It may contain confidential,
      proprietary or legally privileged information. No confidentiality or privilege
      is waived or lost by any mistransmission. If you receive this message in error,
      please immediately delete it and all copies of it from your system, destroy any
      hard copies of it and notify the sender. You must not, directly or indirectly,
      use, disclose, distribute, print, or copy any part of this message if you are not
      the intended recipient. Contract Forwarding, its holding company, and any of its
      subsidiaries each reserve the right to monitor and manage all e-mail communications through
      its networks.

      Any views expressed in this message are those of the individual sender, except where
      the message states otherwise and the sender is authorized to state them to be the
      views of any such entity.
      ____________________________________________________________________________________________

      _____________________________________________________________________________________
      This e-mail message has been scanned for Viruses and Content and cleared
      by MailMarshal

      For more information please visit www.marshalsoftware.com
      _____________________________________________________________________________________


      [Non-text portions of this message have been removed]
    • daymobrew
      ... the ... location) ... program ... very ... You can use $ENV{ ORABCK } if ( defined $ENV{ ORABCK } ) { print Oracle Backup Location is:
      Message 2 of 8 , Sep 6, 2002
      • 0 Attachment
        --- In perl-beginner@y..., Denham Eva <evad@t...> wrote:
        > Hello Folks,
        >
        > Trying to write a program which will be run on a number of different
        > machines, each configured differently.
        > Hence I would like to create a user/system variable which points to
        the
        > location of a file on the system. ie %ORABCK% ( An oracle backup
        location)
        > Is there a way that I can use this variable in my perl program?
        > Otherwise I'll have to be forced to use a external file or edit the
        program
        > for each machine. I have looked at the perldoc but it has not been
        very
        > helpful, perhaps I asking it the wrong questions.
        >
        > Any help will be much appreciated!
        > Regards
        > Denham Eva
        > Oracle DBA
        > In UNIX Land
        > On a quiet Night, you can hear the Windows machines reboot.

        You can use $ENV{ 'ORABCK' }

        if ( defined $ENV{ 'ORABCK' } )
        {
        print "Oracle Backup Location is: $ENV{'ORABCK'}";
        }

        The single quotes are optional but they remove any ambiguity.
        An alternative might be to use command line parameters to specify the
        information. That way you don't have to modify the environment to run
        the program.
        Either way be sure to validate the data i.e. that the directory
        exists.
      • arthur@profsys.iasi.rdsnet.ro
        Hello! I have a little problem with regular expressions and I was wondering if someone could help me: I need to extract C-like strings from a line. The pattern
        Message 3 of 8 , Sep 6, 2002
        • 0 Attachment
          Hello!
          I have a little problem with regular expressions and I was wondering if
          someone could help me:

          I need to extract C-like strings from a line.
          The pattern I used is /"[^"]"/, but this pattern doesn't match strings with "
          inside , like "something \" something else".

          What pattern should I use to cover this case?

          Thanks,
          Arthur

          Professional Systems Romania
          35 Moara de Foc, 6600, Iasi
          Phone: ++40-232-219907
          Fax : ++40-232-219907
          Web : http://profsys.iasi.rdsnet.ro
          Help : support@...
        • Jeff 'japhy' Pinyan
          ... You want to use something like this: / ([^ ]*(?: .[^ ]*)*) /s Let me expand that: m{ # the opening ( # capture this: [^ ]*
          Message 4 of 8 , Sep 6, 2002
          • 0 Attachment
            On Sep 6, arthur@... said:

            >I need to extract C-like strings from a line.
            >The pattern I used is /"[^"]"/, but this pattern doesn't match strings with "
            >inside , like "something \" something else".
            >
            >What pattern should I use to cover this case?

            You want to use something like this:

            /"([^"\\]*(?:\\.[^"\\]*)*)"/s

            Let me expand that:

            m{
            " # the opening "
            ( # capture this:
            [^"\\]* # 0 or more non-" non-\ chars
            (?: # this chunk...
            \\. # a \ followed by any character
            [^"\\]* # then 0 or more non-" non-\ chars
            )* # ... 0 or more times
            ) # to $1
            " # the closing "
            }xs

            --
            Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
            RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
            ** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
            <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
            [ I'm looking for programming work. If you like my work, let me know. ]
          • Jeff Eggen
            ... This exact topic is covered in Mastering Regular Expressions. Capturing a quoted string, including escaped quotes, is done with:
            Message 5 of 8 , Sep 6, 2002
            • 0 Attachment
              >>> arthur@... 09/06/02 07:16am >>>
              >Hello!
              > I have a little problem with regular expressions and I was wondering if
              >someone could help me:

              >I need to extract C-like strings from a line.
              >The pattern I used is /"[^"]"/, but this pattern doesn't match strings with "
              >inside , like "something \" something else".

              >What pattern should I use to cover this case?

              This exact topic is covered in Mastering Regular Expressions. Capturing a quoted string, including escaped quotes, is done with:

              /"([^"\\]*(\\.[^"\\]*)*)"/

              I'm no regex expert, but let's see if I can't break it down somewhat:

              /"( ==> match a double-quote, then start capturing
              [^"\\]* ==> any character but double-quotes and backslashes 0 or more times
              (\\. ==> followed by a backslash and any character **1**
              [^"\\]* ==> followed by anything but a doublequote or backslash 0 or more times
              )* ==> from **1** to here 0 or more times
              )"/ ==> end capture, a double-quote, and end the pattern

              And as an end result, $1 after the match contains the contents of the double-quoted string.

              Clear as mud? Good. I probably explained it incorrectly, and if so hopefully one of the gurus will steer me straight.

              Hope this helps,

              Jeff Eggen
              IT Programmer Analyst
              Saskatchewan Government Insurance
              Ph (306) 751-1795
              email jeggen@...
            • Jeff Eggen
              ... Darn, beat me to it :-) So, as my pattern was missing the ?: in the inner parenthesis, it would have wasted resources doing a capture instead of a
              Message 6 of 8 , Sep 6, 2002
              • 0 Attachment
                >>> japhy@... 09/06/02 07:35am >>>
                >You want to use something like this:

                > /"([^"\\]*(?:\\.[^"\\]*)*)"/s

                Darn, beat me to it :-)

                So, as my pattern was missing the ?: in the inner parenthesis, it would have wasted resources doing a capture instead of a cluster-only. Is this correct?

                Thanks,

                Jeff Eggen
                IT Programmer Analyst
                Saskatchewan Government Insurance
                Ph (306) 751-1795
                email jeggen@...
              • arthur@profsys.iasi.rdsnet.ro
                ... It works, thanks for helping me. Arthur Harabula Professional Systems Romania 35 Moara de Foc, 6600, Iasi Phone: ++40-232-219907 Fax : ++40-232-219907 Web
                Message 7 of 8 , Sep 6, 2002
                • 0 Attachment
                  Quoting Jeff 'japhy' Pinyan <japhy@...>:

                  > You want to use something like this:
                  > /"([^"\\]*(?:\\.[^"\\]*)*)"/s


                  It works, thanks for helping me.


                  Arthur Harabula


                  Professional Systems Romania
                  35 Moara de Foc, 6600, Iasi
                  Phone: ++40-232-219907
                  Fax : ++40-232-219907
                  Web : http://profsys.iasi.rdsnet.ro
                  Help : support@...
                • Jeff 'japhy' Pinyan
                  ... Yeah, but that s probably not something to cry about. ;) It s just the fact that capturing that internal cluster isn t very useful. -- Jeff japhy Pinyan
                  Message 8 of 8 , Sep 6, 2002
                  • 0 Attachment
                    On Sep 6, Jeff Eggen said:

                    >>>> japhy@... 09/06/02 07:35am >>>
                    >>You want to use something like this:
                    >
                    >> /"([^"\\]*(?:\\.[^"\\]*)*)"/s
                    >
                    >Darn, beat me to it :-)
                    >
                    >So, as my pattern was missing the ?: in the inner parenthesis, it would
                    >have wasted resources doing a capture instead of a cluster-only. Is this
                    >correct?

                    Yeah, but that's probably not something to cry about. ;) It's just the
                    fact that capturing that internal cluster isn't very useful.

                    --
                    Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
                    RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
                    ** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
                    <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
                    [ I'm looking for programming work. If you like my work, let me know. ]
                  Your message has been successfully submitted and would be delivered to recipients shortly.