Re: FVWM: FvwmPerl problem

From: Scott McWhirter <scott_at_xede.org>
Date: Mon, 19 Jan 2004 21:30:37 +0000

On Mon, Jan 19, 2004 at 09:04:16PM +0000, Mikhael Goikhman wrote:
Sorry, i'm going to do a short perl rant...

> Never write:
>
> open(...);
>
> If you want to catch problems, write something like:
>
> open(...) or die "Can't open file $fileName: $!\n";
If he doesn't understand the syntax why should he write it? There are
lots of people that say... do it this way... but don't explain why. If
you say to someone, you should do it this way... explain why and what the
syntax means.

For reference,
open(MOO,$file) or die "Barf on $file: $!\n";

If the open fails for some reason (permissions?) it will run the code
after the "or". So in this case it would die and give the message
supplied. $! in perl is a special variable containing any error messages
from external sources (ie: the file open).

blah... hhhmmm... MJD-ish


-- 
-Scott McWhirter- | -kungfuftr-
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Mon Jan 19 2004 - 15:32:40 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:56 BST