Here is my code snippet that is driving me crazy: //// #!/usr/local/bin/perl printf "Hello World\n"; printf "ERRNO: %d\n", $!; # use lib "$ENV{RTM_HOME}/rtm/src/vtm"; # printf "ERRNO: %d\n", $!; //// $ t Hello World ERRNO: 0
//// #!/usr/local/bin/perl printf "Hello World\n"; printf "ERRNO: %d\n", $!; use lib "$ENV{RTM_HOME}/rtm/src/vtm"; printf "ERRNO: %d\n", $!; //// $ t Hello World ERRNO: 2 ERRNO: 2 $ENV{RTM_HOME}/rtm/src/vtm is a good path, why would ERRNO get set to 2 BEFORE and after the 'use lib' call? Thanks again, Jason -----Original Message----- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 1:58 PM To: Allison, Jason (JALLISON) Cc: '[EMAIL PROTECTED]' Subject: Re: ERRNO ... What am I missing On Aug 7, Allison, Jason (JALLISON) said: >Can someone explain the interaction of POSIX ERRNO and PERL scripts? >When does ERRNO get set and is it set with each PERL call? I cant seem >to track when '$!' is set. Sometimes it will be set to 0, and others >2. I am having difficultly nailing its behavior down. > >If there is good reading I am missing, please let me know. $! is set whenever there is an error from the system, more or less. This can happen after a failed chmod() or mkdir() or open() or unlink() call. $! will only have a meaningful value when there's a failure, which is why you should only check it if the function being used returns false: chmod(...) or warn "chmod error: $!"; open(...) or warn "can't open xxx: $!"; unlink(...) or warn "can't unlink xxx: $!"; $! is also magical. It can be used as a number AND as a string. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ <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. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]