[JaxPM] && usage?

Steve Lane sml at zfx.com
Sat Jan 5 17:44:40 CST 2002


On the jacksonville-pm-list; Jax.PM'er Steve Lane <sml at zfx.com> wrote -

Bill Jones wrote:
> On the jacksonville-pm-list; Jax.PM'er Bill Jones <sneex at mac.com> wrote -
> 
> OK, having thought some more about it, I feel that "&&" or "and"
> are pretty close to if() in length -- so what we are really talking
> about is "clarity" (like Steve said  :)

well it's pretty much in the eye of the beholder.
i am pretty sure that stuff like "A && B unless C"
is not a good idea, but the rest is what you and
your fellow programmers think.  with that said,
here's how i'd do the below...

> So ... How about -
> 
> # open files for I/O -
> open (OHTML, ">".&sx_make_fn().".html") || die "FATAL:
> $filename.html\n $!";

open OHTML, sprintf(">%s.html", sx_make_fn())
  or die "couldn't open >$filename.html: $!";
 
> !$enable_css and print "CSS will not be emitted...\n"; # Otherwise
> $enable_css and open (OCSS, ">$filename.css") || die "FATAL:
> $filename.css\n $!";
> # Emit CSS here ...
> $enable_css and close (OCSS) || die "FATAL: $filename.css\n $!";

i assume that OCSS will be used in the "# Emit CSS here"
part, which means you're gonna have to have even more
"$enable_css and" stuff, so just go to a block.  if
you don't like "if", use "do":

$enable_css and do {
  open OCSS, ">$filename.css" or die "couldn't open >$filename.css: $!";
  # emit CSS
  close OCSS or die "couldn't close $filename.css: $!";
};
 
> =pod
> filename and sx_make_fn are declared elsewhere; sx_make_fn just
> makes me up a unique fn which looks like Sat05Jan2002182043 -- no,
> this script will not be executed more than once a minute...
> =cut
> 
> Looks clear to me... Maybe I am just crazy...

i'll tell you what's crazy... we're gonna get 4-8
inches of snow tonight here in TN... finally!  no
you folks in Jax can't have any :).
--
Steve Lane <sml at zfx.com>

Jax.PM Moderator's Note:
This message was posted to the Jacksonville Perl Monger's Group listserv.
The group manager can be reached at -- owner-jacksonville-pm-list at pm.org
to whom send all praises, complaints, or comments...




More information about the Jacksonville-pm mailing list