Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi Folks,

I'm on a PC running Windows 7 and I am using ActivePerl. Once I work out the bugs the script this sub lives in will run on a Windows Server 2008 SP1 machine. Not sure which of that info might be needed/helpful, but there it is!

I have read about the ENV module, but I don't think it does what I need it to. I don't want the env variables in existence when the script is first run, I would like that errorlevel env var that is set (hopefully) when the script I call from inside my Perl script is run. To that end, I have a couple of questions.

1. If I call another script (a BeyondCompare3 script in this case) with a system call in backticks from a Perl script, is the DOS errorlevel environment variable set? I believe that's what I understand from all the reading I've been doing on it, but I wondered if anyone could confirm that.

2. If it is set, is my $errorLevel = %ERRORLEVEL; the proper way to access that value in my Perl script?

This is what my mock-up sub looks like so far:

sub FoldersIdentical(){ my $identical = 1; ($firstFile, $secondFile) = @_; `\"$BComp\" /closescript \@\"cacheCompareScript2.txt\" \"$firstFil +e\" \"$secondFile\"`; my $errorLevel = %ERRORLEVEL; print " \n\$errorLevel is $errorLevel\n"; if ($errorLevel == 0){ $identical = 0; } return identical; }

I know it's pretty obvious from looking at it, but the goal is to verify that the contents of the two folders are identical. Not so obvious probably is that nothing else needs to match - date modified, permissions, etc - only the contents of the folders need to be identical. I've run my script a few times, but I don't think I'm getting what I am looking for. For example, the installers in the deliveries and caching folder don't match today and here is the result I get in the console window when I run my Perl script $errorLevel is 0I know that the errorlevel is being set in response to that command running because when I intentionally mess up a folder name I do get a different code.

I've put a lot of work into this at this point so I'd like to make it work and would really like advice to that end, but I am also open to hearing about Perlish way to accomplish this folder comparison. It has to be heavy duty though because these folders are huge.

Thank you in advance for any advice. So grateful to have you all to ask.

Jennie

Update

I realize I didn't make it clear that I have looked up Perlish way to accomplish this and found this link at StackOverflow, but you need to download modules to make it work and I wasn't sure how safe that was. I'm on my work computer and so I can't be cavalier about naughty things getting in. Sorry if the StackOverflow reference is taboo. Just didn't want you all to think I came expecting you to do all the work for me.


In reply to accessing an environment variable dynamically by JennieInMI

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-25 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found