ptkFAQ

 view release on metacpan or  search on metacpan

history/perl425.html-pl  view on Meta::CPAN


=head1

From:	IN%"tchrist@mox.perl.com"  "Tom Christiansen"  2-APR-1996 06:32:53.73
To:	IN%"wjm@best.com"  "William J. Middleton"
CC:	IN%"perl5-porters@africa.nicoh.com", IN%"tchrist@mox.perl.com"
Subj:	RE: 425traps v1.05

Return-path: <owner-perl5-porters@nicoh.com>
Received: from africa.nicoh.com by LNS62.LNS.CORNELL.EDU (PMDF V4.3-13 #13710)
 id <01I321MV5SWG8X3LJI@LNS62.LNS.CORNELL.EDU>; Tue,
 02 Apr 1996 06:32:36 -0500 (EST)
Received: from localhost by africa.nicoh.com with SMTP (1.37.109.15/16.2)
 id AA018704756; Tue, 2 Apr 1996 07:32:36 -0400
Received: by africa.nicoh.com (1.37.109.15/16.2) id AA017974712; Tue,
 2 Apr 1996 07:31:52 -0400
Received: from mox.perl.com (perl.com) by africa.nicoh.com with ESMTP
 (1.37.109.15/16.2) id AA017854690; Tue, 2 Apr 1996 04:31:30 -0700
Received: from localhost.perl.com (localhost.perl.com [127.0.0.1])
 by mox.perl.com (8.6.12/8.6.12) with SMTP id EAA17251; Tue,
 2 Apr 1996 04:30:25 -0700
Date: Tue, 02 Apr 1996 04:30:21 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: 425traps v1.05
In-reply-to: "William J. Middleton"'s missive
 <199604020649.WAA04800@shellx.best.com> of Mon, 01 Apr 1996 22:49:55 PST.
Sender: owner-perl5-porters@nicoh.com
To: "William J. Middleton" <wjm@best.com>
Cc: perl5-porters@africa.nicoh.com, tchrist@mox.perl.com
Message-id: <17247.828444621@mox.perl.com>
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: 8bit
List-Name: perl5-porters
Precedence: bulk
References: <199604020649.WAA04800@shellx.best.com>

Her'es the file, converted for htmlification.  Prolly
should be for poddification, but I'll leave that as an
exercise for the reader.

I had to change a little bit of the formatting to make it more regular.

--tom

=cut


if (open(STDIN, "-|")) {
    $/ = '';
    while (<STDIN>) { 
	s,</XMP>(\s*)<XMP>,$1,gis;
	s,\s+</XMP>,</XMP>,gi;
	print;
    } 
    exit;
}

while (<DATA>) {
    if (s/# (?=\$Id.*)//) {
	print <<EOT;
<TITLE>Perl 425traps</TITLE>
<h1>Perl4 to Perl5 Traps</h1>
<P>
EOT
	next;
    }
    s/^#+\s*$/<P>/ && next;
    s/^(\s+.*)/<XMP>$1<\/XMP>/ && next;
    s{# (Example \d+\s+-\s*.*)}{\n\n<HR><H2>$1</H2>} && next;
    s/^(?:# )?(perl[45].*?:)\s*(.*)/<DL><DT><I>$1<\/I><DD><XMP>$2<\/XMP><\/DL>/i && next;
    if (s/# //) {
	s/End of Examples//;
	s,_(\w[\w\s]+\w)_,<I>$1</I>,g;
	s/ ([\$\@%]\S+)/ <CODE>$1<\/CODE>/g 	    ||
	    s,\b([sm](?=\W)\S+),<CODE>$1</CODE>,g   ||
	    s,([^sm])(([/?]).*?\3),$1<CODE>$2</CODE>,g;
	next;
    }
} continue { 
    print;
}

__END__
# $Id: 425traps,v 1.5 1996/04/02 06:12:29 bmiddlet Exp $
#############################################################################
# Example 1 - From perltrap
#############################################################################
# @ now always interpolates an array in double-quotish strings.

    print "To: someone@somewhere.com\n";

# perl4 prints: To:someone@somewhere.com
# perl5 errors : Literal @somewhere now requires backslash

#############################################################################
# Example 2 - From perltrap
#############################################################################
# Barewords that used to look like strings to Perl will now look like subroutine
# calls if a subroutine by that name is defined before the compiler sees them.
# For example:

       sub SeeYa { warn"Hasta la vista, baby!" }
       $SIG{'TERM'} = SeeYa;
       print "SIGTERM is now $SIG{'TERM'}\n";

# perl4 prints: SIGTERM is main'SeeYa
# perl5 prints: SIGTERM is now main::1
# Use -w to catch this one



( run in 1.324 second using v1.01-cache-2.11-cpan-364913b4093 )