1PERLFAQ9(1) Perl Programmers Reference Guide PERLFAQ9(1)
2
3
4
6 perlfaq9 - Networking
7
9 This section deals with questions related to networking, the internet,
10 and a few on the web.
11
12 What is the correct form of response from a CGI script?
13 (Alan Flavell <flavell+www@a5.ph.gla.ac.uk> answers...)
14
15 The Common Gateway Interface (CGI) specifies a software interface
16 between a program ("CGI script") and a web server (HTTPD). It is not
17 specific to Perl, and has its own FAQs and tutorials, and usenet group,
18 comp.infosystems.www.authoring.cgi
19
20 The CGI specification is outlined in an informational RFC:
21 http://www.ietf.org/rfc/rfc3875
22
23 Other relevant documentation listed in:
24 http://www.perl.org/CGI_MetaFAQ.html
25
26 These Perl FAQs very selectively cover some CGI issues. However, Perl
27 programmers are strongly advised to use the CGI.pm module, to take care
28 of the details for them.
29
30 The similarity between CGI response headers (defined in the CGI
31 specification) and HTTP response headers (defined in the HTTP
32 specification, RFC2616) is intentional, but can sometimes be confusing.
33
34 The CGI specification defines two kinds of script: the "Parsed Header"
35 script, and the "Non Parsed Header" (NPH) script. Check your server
36 documentation to see what it supports. "Parsed Header" scripts are
37 simpler in various respects. The CGI specification allows any of the
38 usual newline representations in the CGI response (it's the server's
39 job to create an accurate HTTP response based on it). So "\n" written
40 in text mode is technically correct, and recommended. NPH scripts are
41 more tricky: they must put out a complete and accurate set of HTTP
42 transaction response headers; the HTTP specification calls for records
43 to be terminated with carriage-return and line-feed, i.e ASCII \015\012
44 written in binary mode.
45
46 Using CGI.pm gives excellent platform independence, including EBCDIC
47 systems. CGI.pm selects an appropriate newline representation
48 ($CGI::CRLF) and sets binmode as appropriate.
49
50 My CGI script runs from the command line but not the browser. (500 Server
51 Error)
52 Several things could be wrong. You can go through the "Troubleshooting
53 Perl CGI scripts" guide at
54
55 http://www.perl.org/troubleshooting_CGI.html
56
57 If, after that, you can demonstrate that you've read the FAQs and that
58 your problem isn't something simple that can be easily answered, you'll
59 probably receive a courteous and useful reply to your question if you
60 post it on comp.infosystems.www.authoring.cgi (if it's something to do
61 with HTTP or the CGI protocols). Questions that appear to be Perl
62 questions but are really CGI ones that are posted to
63 comp.lang.perl.misc are not so well received.
64
65 The useful FAQs, related documents, and troubleshooting guides are
66 listed in the CGI Meta FAQ:
67
68 http://www.perl.org/CGI_MetaFAQ.html
69
70 How can I get better error messages from a CGI program?
71 Use the CGI::Carp module. It replaces "warn" and "die", plus the
72 normal Carp modules "carp", "croak", and "confess" functions with more
73 verbose and safer versions. It still sends them to the normal server
74 error log.
75
76 use CGI::Carp;
77 warn "This is a complaint";
78 die "But this one is serious";
79
80 The following use of CGI::Carp also redirects errors to a file of your
81 choice, placed in a BEGIN block to catch compile-time warnings as well:
82
83 BEGIN {
84 use CGI::Carp qw(carpout);
85 open(LOG, ">>/var/local/cgi-logs/mycgi-log")
86 or die "Unable to append to mycgi-log: $!\n";
87 carpout(*LOG);
88 }
89
90 You can even arrange for fatal errors to go back to the client browser,
91 which is nice for your own debugging, but might confuse the end user.
92
93 use CGI::Carp qw(fatalsToBrowser);
94 die "Bad error here";
95
96 Even if the error happens before you get the HTTP header out, the
97 module will try to take care of this to avoid the dreaded server 500
98 errors. Normal warnings still go out to the server error log (or
99 wherever you've sent them with "carpout") with the application name and
100 date stamp prepended.
101
102 How do I remove HTML from a string?
103 The most correct way (albeit not the fastest) is to use HTML::Parser
104 from CPAN. Another mostly correct way is to use HTML::FormatText which
105 not only removes HTML but also attempts to do a little simple
106 formatting of the resulting plain text.
107
108 Many folks attempt a simple-minded regular expression approach, like
109 "s/<.*?>//g", but that fails in many cases because the tags may
110 continue over line breaks, they may contain quoted angle-brackets, or
111 HTML comment may be present. Plus, folks forget to convert
112 entities--like "<" for example.
113
114 Here's one "simple-minded" approach, that works for most files:
115
116 #!/usr/bin/perl -p0777
117 s/<(?:[^>'"]*|(['"]).*?\1)*>//gs
118
119 If you want a more complete solution, see the 3-stage striphtml program
120 in http://www.cpan.org/authors/Tom_Christiansen/scripts/striphtml.gz .
121
122 Here are some tricky cases that you should think about when picking a
123 solution:
124
125 <IMG SRC = "foo.gif" ALT = "A > B">
126
127 <IMG SRC = "foo.gif"
128 ALT = "A > B">
129
130 <!-- <A comment> -->
131
132 <script>if (a<b && a>c)</script>
133
134 <# Just data #>
135
136 <![INCLUDE CDATA [ >>>>>>>>>>>> ]]>
137
138 If HTML comments include other tags, those solutions would also break
139 on text like this:
140
141 <!-- This section commented out.
142 <B>You can't see me!</B>
143 -->
144
145 How do I extract URLs?
146 You can easily extract all sorts of URLs from HTML with
147 "HTML::SimpleLinkExtor" which handles anchors, images, objects, frames,
148 and many other tags that can contain a URL. If you need anything more
149 complex, you can create your own subclass of "HTML::LinkExtor" or
150 "HTML::Parser". You might even use "HTML::SimpleLinkExtor" as an
151 example for something specifically suited to your needs.
152
153 You can use URI::Find to extract URLs from an arbitrary text document.
154
155 Less complete solutions involving regular expressions can save you a
156 lot of processing time if you know that the input is simple. One
157 solution from Tom Christiansen runs 100 times faster than most module
158 based approaches but only extracts URLs from anchors where the first
159 attribute is HREF and there are no other attributes.
160
161 #!/usr/bin/perl -n00
162 # qxurl - tchrist@perl.com
163 print "$2\n" while m{
164 < \s*
165 A \s+ HREF \s* = \s* (["']) (.*?) \1
166 \s* >
167 }gsix;
168
169 How do I download a file from the user's machine? How do I open a file on
170 another machine?
171 In this case, download means to use the file upload feature of HTML
172 forms. You allow the web surfer to specify a file to send to your web
173 server. To you it looks like a download, and to the user it looks like
174 an upload. No matter what you call it, you do it with what's known as
175 multipart/form-data encoding. The CGI.pm module (which comes with Perl
176 as part of the Standard Library) supports this in the
177 start_multipart_form() method, which isn't the same as the startform()
178 method.
179
180 See the section in the CGI.pm documentation on file uploads for code
181 examples and details.
182
183 How do I make an HTML pop-up menu with Perl?
184 (contributed by brian d foy)
185
186 The CGI.pm module (which comes with Perl) has functions to create the
187 HTML form widgets. See the CGI.pm documentation for more examples.
188
189 use CGI qw/:standard/;
190 print header,
191 start_html('Favorite Animals'),
192
193 start_form,
194 "What's your favorite animal? ",
195 popup_menu(
196 -name => 'animal',
197 -values => [ qw( Llama Alpaca Camel Ram ) ]
198 ),
199 submit,
200
201 end_form,
202 end_html;
203
204 How do I fetch an HTML file?
205 (contributed by brian d foy)
206
207 Use the libwww-perl distribution. The "LWP::Simple" module can fetch
208 web resources and give their content back to you as a string:
209
210 use LWP::Simple qw(get);
211
212 my $html = get( "http://www.example.com/index.html" );
213
214 It can also store the resource directly in a file:
215
216 use LWP::Simple qw(getstore);
217
218 getstore( "http://www.example.com/index.html", "foo.html" );
219
220 If you need to do something more complicated, you can use
221 "LWP::UserAgent" module to create your own user-agent (e.g. browser) to
222 get the job done. If you want to simulate an interactive web browser,
223 you can use the "WWW::Mechanize" module.
224
225 How do I automate an HTML form submission?
226 If you are doing something complex, such as moving through many pages
227 and forms or a web site, you can use "WWW::Mechanize". See its
228 documentation for all the details.
229
230 If you're submitting values using the GET method, create a URL and
231 encode the form using the "query_form" method:
232
233 use LWP::Simple;
234 use URI::URL;
235
236 my $url = url('http://www.perl.com/cgi-bin/cpan_mod');
237 $url->query_form(module => 'DB_File', readme => 1);
238 $content = get($url);
239
240 If you're using the POST method, create your own user agent and encode
241 the content appropriately.
242
243 use HTTP::Request::Common qw(POST);
244 use LWP::UserAgent;
245
246 $ua = LWP::UserAgent->new();
247 my $req = POST 'http://www.perl.com/cgi-bin/cpan_mod',
248 [ module => 'DB_File', readme => 1 ];
249 $content = $ua->request($req)->as_string;
250
251 How do I decode or create those %-encodings on the web?
252 (contributed by brian d foy)
253
254 Those "%" encodings handle reserved characters in URIs, as described in
255 RFC 2396, Section 2. This encoding replaces the reserved character with
256 the hexadecimal representation of the character's number from the US-
257 ASCII table. For instance, a colon, ":", becomes %3A.
258
259 In CGI scripts, you don't have to worry about decoding URIs if you are
260 using "CGI.pm". You shouldn't have to process the URI yourself, either
261 on the way in or the way out.
262
263 If you have to encode a string yourself, remember that you should never
264 try to encode an already-composed URI. You need to escape the
265 components separately then put them together. To encode a string, you
266 can use the the "URI::Escape" module. The "uri_escape" function returns
267 the escaped string:
268
269 my $original = "Colon : Hash # Percent %";
270
271 my $escaped = uri_escape( $original )
272
273 print "$string\n"; # 'Colon%20%3A%20Hash%20%23%20Percent%20%25%20'
274
275 To decode the string, use the "uri_unescape" function:
276
277 my $unescaped = uri_unescape( $escaped );
278
279 print $unescaped; # back to original
280
281 If you wanted to do it yourself, you simply need to replace the
282 reserved characters with their encodings. A global substitution is one
283 way to do it:
284
285 # encode
286 $string =~ s/([^^A-Za-z0-9\-_.!~*'()])/ sprintf "%%%0x", ord $1 /eg;
287
288 #decode
289 $string =~ s/%([A-Fa-f\d]{2})/chr hex $1/eg;
290
291 How do I redirect to another page?
292 Specify the complete URL of the destination (even if it is on the same
293 server). This is one of the two different kinds of CGI "Location:"
294 responses which are defined in the CGI specification for a Parsed
295 Headers script. The other kind (an absolute URLpath) is resolved
296 internally to the server without any HTTP redirection. The CGI
297 specifications do not allow relative URLs in either case.
298
299 Use of CGI.pm is strongly recommended. This example shows redirection
300 with a complete URL. This redirection is handled by the web browser.
301
302 use CGI qw/:standard/;
303
304 my $url = 'http://www.cpan.org/';
305 print redirect($url);
306
307 This example shows a redirection with an absolute URLpath. This
308 redirection is handled by the local web server.
309
310 my $url = '/CPAN/index.html';
311 print redirect($url);
312
313 But if coded directly, it could be as follows (the final "\n" is shown
314 separately, for clarity), using either a complete URL or an absolute
315 URLpath.
316
317 print "Location: $url\n"; # CGI response header
318 print "\n"; # end of headers
319
320 How do I put a password on my web pages?
321 To enable authentication for your web server, you need to configure
322 your web server. The configuration is different for different sorts of
323 web servers--apache does it differently from iPlanet which does it
324 differently from IIS. Check your web server documentation for the
325 details for your particular server.
326
327 How do I edit my .htpasswd and .htgroup files with Perl?
328 The HTTPD::UserAdmin and HTTPD::GroupAdmin modules provide a consistent
329 OO interface to these files, regardless of how they're stored.
330 Databases may be text, dbm, Berkeley DB or any database with a DBI
331 compatible driver. HTTPD::UserAdmin supports files used by the "Basic"
332 and "Digest" authentication schemes. Here's an example:
333
334 use HTTPD::UserAdmin ();
335 HTTPD::UserAdmin
336 ->new(DB => "/foo/.htpasswd")
337 ->add($username => $password);
338
339 How do I make sure users can't enter values into a form that cause my CGI
340 script to do bad things?
341 See the security references listed in the CGI Meta FAQ
342
343 http://www.perl.org/CGI_MetaFAQ.html
344
345 How do I parse a mail header?
346 For a quick-and-dirty solution, try this solution derived from "split"
347 in perlfunc:
348
349 $/ = '';
350 $header = <MSG>;
351 $header =~ s/\n\s+/ /g; # merge continuation lines
352 %head = ( UNIX_FROM_LINE, split /^([-\w]+):\s*/m, $header );
353
354 That solution doesn't do well if, for example, you're trying to
355 maintain all the Received lines. A more complete approach is to use
356 the Mail::Header module from CPAN (part of the MailTools package).
357
358 How do I decode a CGI form?
359 (contributed by brian d foy)
360
361 Use the CGI.pm module that comes with Perl. It's quick, it's easy, and
362 it actually does quite a bit of work to ensure things happen correctly.
363 It handles GET, POST, and HEAD requests, multipart forms, multivalued
364 fields, query string and message body combinations, and many other
365 things you probably don't want to think about.
366
367 It doesn't get much easier: the CGI module automatically parses the
368 input and makes each value available through the "param()" function.
369
370 use CGI qw(:standard);
371
372 my $total = param( 'price' ) + param( 'shipping' );
373
374 my @items = param( 'item' ); # multiple values, same field name
375
376 If you want an object-oriented approach, CGI.pm can do that too.
377
378 use CGI;
379
380 my $cgi = CGI->new();
381
382 my $total = $cgi->param( 'price' ) + $cgi->param( 'shipping' );
383
384 my @items = $cgi->param( 'item' );
385
386 You might also try CGI::Minimal which is a lightweight version of the
387 same thing. Other CGI::* modules on CPAN might work better for you,
388 too.
389
390 Many people try to write their own decoder (or copy one from another
391 program) and then run into one of the many "gotchas" of the task. It's
392 much easier and less hassle to use CGI.pm.
393
394 How do I check a valid mail address?
395 (partly contributed by Aaron Sherman)
396
397 This isn't as simple a question as it sounds. There are two parts:
398
399 a) How do I verify that an email address is correctly formatted?
400
401 b) How do I verify that an email address targets a valid recipient?
402
403 Without sending mail to the address and seeing whether there's a human
404 on the other end to answer you, you cannot fully answer part b, but
405 either the "Email::Valid" or the "RFC::RFC822::Address" module will do
406 both part a and part b as far as you can in real-time.
407
408 If you want to just check part a to see that the address is valid
409 according to the mail header standard with a simple regular expression,
410 you can have problems, because there are deliverable addresses that
411 aren't RFC-2822 (the latest mail header standard) compliant, and
412 addresses that aren't deliverable which, are compliant. However, the
413 following will match valid RFC-2822 addresses that do not have
414 comments, folding whitespace, or any other obsolete or non-essential
415 elements. This just matches the address itself:
416
417 my $atom = qr{[a-zA-Z0-9_!#\$\%&'*+/=?\^`{}~|\-]+};
418 my $dot_atom = qr{$atom(?:\.$atom)*};
419 my $quoted = qr{"(?:\\[^\r\n]|[^\\"])*"};
420 my $local = qr{(?:$dot_atom|$quoted)};
421 my $quotedpair = qr{\\[\x00-\x09\x0B-\x0c\x0e-\x7e]};
422 my $domain_lit = qr{\[(?:$quotedpair|[\x21-\x5a\x5e-\x7e])*\]};
423 my $domain = qr{(?:$dot_atom|$domain_lit)};
424 my $addr_spec = qr{$local\@$domain};
425
426 Just match an address against "/^${addr_spec}$/" to see if it follows
427 the RFC2822 specification. However, because it is impossible to be
428 sure that such a correctly formed address is actually the correct way
429 to reach a particular person or even has a mailbox associated with it,
430 you must be very careful about how you use this.
431
432 Our best advice for verifying a person's mail address is to have them
433 enter their address twice, just as you normally do to change a
434 password. This usually weeds out typos. If both versions match, send
435 mail to that address with a personal message. If you get the message
436 back and they've followed your directions, you can be reasonably
437 assured that it's real.
438
439 A related strategy that's less open to forgery is to give them a PIN
440 (personal ID number). Record the address and PIN (best that it be a
441 random one) for later processing. In the mail you send, ask them to
442 include the PIN in their reply. But if it bounces, or the message is
443 included via a "vacation" script, it'll be there anyway. So it's best
444 to ask them to mail back a slight alteration of the PIN, such as with
445 the characters reversed, one added or subtracted to each digit, etc.
446
447 How do I decode a MIME/BASE64 string?
448 The MIME-Base64 package (available from CPAN) handles this as well as
449 the MIME/QP encoding. Decoding BASE64 becomes as simple as:
450
451 use MIME::Base64;
452 $decoded = decode_base64($encoded);
453
454 The MIME-Tools package (available from CPAN) supports extraction with
455 decoding of BASE64 encoded attachments and content directly from email
456 messages.
457
458 If the string to decode is short (less than 84 bytes long) a more
459 direct approach is to use the unpack() function's "u" format after
460 minor transliterations:
461
462 tr#A-Za-z0-9+/##cd; # remove non-base64 chars
463 tr#A-Za-z0-9+/# -_#; # convert to uuencoded format
464 $len = pack("c", 32 + 0.75*length); # compute length byte
465 print unpack("u", $len . $_); # uudecode and print
466
467 How do I return the user's mail address?
468 On systems that support getpwuid, the $< variable, and the
469 Sys::Hostname module (which is part of the standard perl distribution),
470 you can probably try using something like this:
471
472 use Sys::Hostname;
473 $address = sprintf('%s@%s', scalar getpwuid($<), hostname);
474
475 Company policies on mail address can mean that this generates addresses
476 that the company's mail system will not accept, so you should ask for
477 users' mail addresses when this matters. Furthermore, not all systems
478 on which Perl runs are so forthcoming with this information as is Unix.
479
480 The Mail::Util module from CPAN (part of the MailTools package)
481 provides a mailaddress() function that tries to guess the mail address
482 of the user. It makes a more intelligent guess than the code above,
483 using information given when the module was installed, but it could
484 still be incorrect. Again, the best way is often just to ask the user.
485
486 How do I send mail?
487 Use the "sendmail" program directly:
488
489 open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
490 or die "Can't fork for sendmail: $!\n";
491 print SENDMAIL <<"EOF";
492 From: User Originating Mail <me\@host>
493 To: Final Destination <you\@otherhost>
494 Subject: A relevant subject line
495
496 Body of the message goes here after the blank line
497 in as many lines as you like.
498 EOF
499 close(SENDMAIL) or warn "sendmail didn't close nicely";
500
501 The -oi option prevents sendmail from interpreting a line consisting of
502 a single dot as "end of message". The -t option says to use the
503 headers to decide who to send the message to, and -odq says to put the
504 message into the queue. This last option means your message won't be
505 immediately delivered, so leave it out if you want immediate delivery.
506
507 Alternate, less convenient approaches include calling mail (sometimes
508 called mailx) directly or simply opening up port 25 have having an
509 intimate conversation between just you and the remote SMTP daemon,
510 probably sendmail.
511
512 Or you might be able use the CPAN module Mail::Mailer:
513
514 use Mail::Mailer;
515
516 $mailer = Mail::Mailer->new();
517 $mailer->open({ From => $from_address,
518 To => $to_address,
519 Subject => $subject,
520 })
521 or die "Can't open: $!\n";
522 print $mailer $body;
523 $mailer->close();
524
525 The Mail::Internet module uses Net::SMTP which is less Unix-centric
526 than Mail::Mailer, but less reliable. Avoid raw SMTP commands. There
527 are many reasons to use a mail transport agent like sendmail. These
528 include queuing, MX records, and security.
529
530 How do I use MIME to make an attachment to a mail message?
531 This answer is extracted directly from the MIME::Lite documentation.
532 Create a multipart message (i.e., one with attachments).
533
534 use MIME::Lite;
535
536 ### Create a new multipart message:
537 $msg = MIME::Lite->new(
538 From =>'me@myhost.com',
539 To =>'you@yourhost.com',
540 Cc =>'some@other.com, some@more.com',
541 Subject =>'A message with 2 parts...',
542 Type =>'multipart/mixed'
543 );
544
545 ### Add parts (each "attach" has same arguments as "new"):
546 $msg->attach(Type =>'TEXT',
547 Data =>"Here's the GIF file you wanted"
548 );
549 $msg->attach(Type =>'image/gif',
550 Path =>'aaa000123.gif',
551 Filename =>'logo.gif'
552 );
553
554 $text = $msg->as_string;
555
556 MIME::Lite also includes a method for sending these things.
557
558 $msg->send;
559
560 This defaults to using sendmail but can be customized to use SMTP via
561 Net::SMTP.
562
563 How do I read mail?
564 While you could use the Mail::Folder module from CPAN (part of the
565 MailFolder package) or the Mail::Internet module from CPAN (part of the
566 MailTools package), often a module is overkill. Here's a mail sorter.
567
568 #!/usr/bin/perl
569
570 my(@msgs, @sub);
571 my $msgno = -1;
572 $/ = ''; # paragraph reads
573 while (<>) {
574 if (/^From /m) {
575 /^Subject:\s*(?:Re:\s*)*(.*)/mi;
576 $sub[++$msgno] = lc($1) || '';
577 }
578 $msgs[$msgno] .= $_;
579 }
580 for my $i (sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msgs)) {
581 print $msgs[$i];
582 }
583
584 Or more succinctly,
585
586 #!/usr/bin/perl -n00
587 # bysub2 - awkish sort-by-subject
588 BEGIN { $msgno = -1 }
589 $sub[++$msgno] = (/^Subject:\s*(?:Re:\s*)*(.*)/mi)[0] if /^From/m;
590 $msg[$msgno] .= $_;
591 END { print @msg[ sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msg) ] }
592
593 How do I find out my hostname, domainname, or IP address?
594 gethostbyname, Socket, Net::Domain, Sys::Hostname" (contributed by
595 brian d foy)
596
597 The Net::Domain module, which is part of the standard distribution
598 starting in perl5.7.3, can get you the fully qualified domain name
599 (FQDN), the host name, or the domain name.
600
601 use Net::Domain qw(hostname hostfqdn hostdomain);
602
603 my $host = hostfqdn();
604
605 The "Sys::Hostname" module, included in the standard distribution since
606 perl5.6, can also get the hostname.
607
608 use Sys::Hostname;
609
610 $host = hostname();
611
612 To get the IP address, you can use the "gethostbyname" built-in
613 function to turn the name into a number. To turn that number into the
614 dotted octet form (a.b.c.d) that most people expect, use the
615 "inet_ntoa" function from the <Socket> module, which also comes with
616 perl.
617
618 use Socket;
619
620 my $address = inet_ntoa(
621 scalar gethostbyname( $host || 'localhost' )
622 );
623
624 How do I fetch a news article or the active newsgroups?
625 Use the Net::NNTP or News::NNTPClient modules, both available from
626 CPAN. This can make tasks like fetching the newsgroup list as simple
627 as
628
629 perl -MNews::NNTPClient
630 -e 'print News::NNTPClient->new->list("newsgroups")'
631
632 How do I fetch/put an FTP file?
633 LWP::Simple (available from CPAN) can fetch but not put. Net::FTP
634 (also available from CPAN) is more complex but can put as well as
635 fetch.
636
637 How can I do RPC in Perl?
638 (Contributed by brian d foy)
639
640 Use one of the RPC modules you can find on CPAN (
641 http://search.cpan.org/search?query=RPC&mode=all ).
642
644 Revision: $Revision$
645
646 Date: $Date$
647
648 See perlfaq for source control details and availability.
649
651 Copyright (c) 1997-2009 Tom Christiansen, Nathan Torkington, and other
652 authors as noted. All rights reserved.
653
654 This documentation is free; you can redistribute it and/or modify it
655 under the same terms as Perl itself.
656
657 Irrespective of its distribution, all code examples in this file are
658 hereby placed into the public domain. You are permitted and encouraged
659 to use this code in your own programs for fun or for profit as you see
660 fit. A simple comment in the code giving credit would be courteous but
661 is not required.
662
663
664
665perl v5.10.1 2009-08-15 PERLFAQ9(1)