[Chicago-talk] OK< *real* stupid Q time...

Jay Strauss me at heyjay.com
Tue Sep 16 21:08:07 CDT 2003


Check out the -X tests at:

http://www.perldoc.com/perl5.6/pod/func/X.html


----- Original Message -----
From: "Walter Torres" <walter at torres.ws>
To: "Chicago.pm chatter" <chicago-talk at mail.pm.org>
Sent: Tuesday, September 16, 2003 5:09 PM
Subject: [Chicago-talk] OK< *real* stupid Q time...


> OK, I have this piece that opens a file or dies trying with a little error
> sent to STOUT.
>
>    open( TEMP, ">>./$outFile ")
>       or die "No Way! \n$!\n$outFile \n";
>
> But, I have this in a loop of file names to parse.
>
> So I need to have this try and open that file, and if it fails, send a
call
> to a function (that logs stuff) and tell the FOR loop to go on to the next
> in the list.
>
> I figure that there must be a way to test if a file can be opened before
> actually opening it and then have conditionals around that....
>
>    if (! open $outFile)
>    {
>       &to_log ("$outFile Error: $errCode");
>       continue;
>    }
>
> I know I've done this before, but my brain dead head can't remember this,
> nor have I been able to find any URL via GOGGLE that helps me.
>
> Thanks for your patience through these basic questions.
>
> That's what I get for not working in Perl for way too long!
>
> Walter
>
>
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
>




More information about the Chicago-talk mailing list