SPUG: A little style question....

Andy Jacobs andyj at microsoft.com
Tue Sep 19 21:55:34 CDT 2000


I take it your friend, by the stated rule, doesn't use any comments in Perl.
If your friend happens to be your manager (i.e., you need to please your
friend), I belive you could get almost the same effect with:

$output = "
Blah blah blah $variable blah blah
More blah blah";

where you'd both get almost what you want.  But this probably won't please
your friend, who probably isn't articulating their peeve very well, and is
actually bothered by having things unindented in the middle of the program.

 - Andy Jacobs

-----Original Message-----
From: owner-spug-list at pm.org [mailto:owner-spug-list at pm.org]On Behalf Of
Stephen Nickels
Sent: Tuesday, September 19, 2000 3:26 PM
To: spug-list at pm.org
Subject: SPUG: A little style question....


I've got a quasi-perl, quasi-programming-style question for y'all.
I've gone back and forth with a friend of mine on this one, so I thought
I'd get some more professional opinions. My question is: here docs, good
or bad?

(aka:
$output =<<TEXT;
Blah blah blah $variable blah blah
TEXT
)

I consider them a very helpful part of programming, especially web
scripting, allowing you to either output or save to an output variable
large pieces of formatted and interpolated text; they're great for
outputting html. My friend, however, considers them the spawn of the
underworld, believing that all good programs should work exactly the same
after having all groups of spaces and/or newlines replaced with a single
space. (aka, $code =~ s/[\s\n]+/ /g;) Line-delimited things like here docs
break this rule of his quite severly.

So what are some of the general opinions of perl-mongers out there? Are
here docs a useful addition to programming languages, or are they bad
form?

Thanks a lot!



"When once you have tasted flight, you will forever walk
the Earth with your eyes turned skyward, for there you have been,
and there you will always long to return"
					-Leonardo da Vinci


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list