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

Verifying data change

by Anonymous Monk
on Aug 15, 2002 at 12:48 UTC ( #190382=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Currently I am fetching executable files from a web site. I only fetch when part of the executable name is changed. This has worked for the past year but now they changed the whole name. So I wanted to add to my script a part to notify me if they changed the whole name of the executable so I dont try and fetch some name that doesnt exist.

here is my current part of my script with the new name change:
my ($var) = $content =~ /(.{3}\-a99\-9)/; $var = $1;
Now here is what I propose to add to my script so I am notified about a complete new filename:
if (not defined $var) { print "The whole name was changed so no match found. You need to +change your reg expression.\n"; exit 0; #Since no match then exit the script. }
I want advise on if this is the correct way to handle this?? Also "exit 0" means good exit? Or do I use "exit 1"??

Comment on Verifying data change
Select or Download Code
Re: Verifying data change
by adrianh (Chancellor) on Aug 15, 2002 at 21:22 UTC

    Yes, "0" is the exit code for success. I'm not sure what else you're asking... can you expand on the problem you''re having (if any?)

      I think he's asking how he can detect the "whole filename changed", although he almost provided the answer: use a pattern describing what you're expecting to see and match the filename against that. If the filename doens't match, it changed beyond your expectations ("the whole filename changed").

      Two nits: you don't need the capturing (to do this, at least) and you'd want to anchor the pattern to the beginning and end of the filename.

      — Arien

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://190382]
Approved by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-09-23 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls