[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] UNIX Perl Driving Me Mad



That was the actual code, except that I used "die" instead of my custom
error routine "Error()" so that there would be no confusion over the
routine. In so doing I forgot to correct the parentheses.

__BEGIN__
 $tc = "2000.04.16";        # so that variable is defined...

 # This command works--i.e. doesn't die
 open TC, "timecard/$tc" or die( "Unable to open $tc: $!" );
 
 # This command fails--i.e. doesn't die
 die "I CAN read timecard/$tc!" if( -r "timecard/$tc" );
 
 # This fails--i.e. dies when it shouldn't because file exists.
 die "No such file timecard/$tc???" if( ! -e "timecard/$tc" );

__END__

-K

"To argue with a man who has renounced his reason is like giving medicine to
the dead."
    - Thomas Paine

> From: Ronald J Kimball <rjk@linguist.dartmouth.edu>
> Date: Fri, 21 Apr 2000 16:42:35 -0400
> To: Keary Suska <aksuska@insideflyer.com>
> Cc: MacPerl_List <macperl@macperl.org>
> Subject: Re: [MacPerl] UNIX Perl Driving Me Mad
> 
> On Fri, Apr 21, 2000 at 02:04:19PM -0600, Keary Suska wrote:
>> Here's another funny bit--it works from the command line (i.e. perl -e
>> 'print "OK!\n" if -e "timecard/2000.04.16"'), but doesn't work even when I
>> run the script from the command line. Can the file test operators be
>> overwritten or overloaded? The only module I use is Time::Local and Lib
>> directive.
>> 
>> BTW, the error message I get verifies that the $tc variable _is_
>> interpolating correctly, and there are no funny characters in it.
>> 
> 
> Can you post some actual code that demonstrates the problem?  The samples
> you initially provided had a typo and wouldn't compile.
> 
> Ronald


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org