[11319] in Perl-Users-Digest
Perl-Users Digest, Issue: 4915 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 17 13:16:48 1999
Date: Wed, 17 Feb 99 10:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 17 Feb 1999 Volume: 8 Number: 4915
Today's topics:
<<HERE code joec@impacttech.com
Re: <<HERE code <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: <<HERE code <jglascoe@giss.nasa.gov>
Re: <<HERE code <Allan@due.net>
Re: <<HERE code <jeff@vpservices.com>
DOC: perldelta.pod for 5.005_55 <tchrist@mox.perl.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 Feb 1999 16:27:34 GMT
From: joec@impacttech.com
Subject: <<HERE code
Message-Id: <7aeql9$7hi$1@nnrp1.dejanews.com>
I have to copy a fairly large block of text to a variable.
I would like to do it with a similar construct to the construct:
print <<EOT;
this is test
EOT
Something on the order of
$SampleText = <<EOT;
this is a test
EOT
Perl gives me fits if I try to do this.
Is there any way to do this correctly without a function call?
I apologize if this has already been discussed, but I couldn't find this
precise topic in the FAQ, and I couldn't seem to convert what was in the FAQ
to my purposes.
Thank you for your time,
Joe Chambers
joec@impacttech.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 17 Feb 1999 17:47:54 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: <<HERE code
Message-Id: <83k8xhj7t1.fsf@vcpc.univie.ac.at>
Re: <<HERE code, joec <joec@impacttech.com> said:
joec> I have to copy a fairly large block of text to
joec> a variable. I would like to do it with a
joec> similar construct to the construct:
joec> print <<EOT; this is test EOT
joec> Something on the order of
joec> $SampleText = <<EOT; this is a test EOT
joec> Perl gives me fits if I try to do this.
Your code is correct. The problem must be somewhere
else in something you haven't included in this
article.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Wed, 17 Feb 1999 11:51:15 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: joec@impacttech.com
Subject: Re: <<HERE code
Message-Id: <36CAF383.6F530F6C@giss.nasa.gov>
joec@impacttech.com wrote:
>
> $SampleText = <<EOT;
> this is a test
> EOT
>
> Perl gives me fits if I try to do this.
>
huh? It should work:
perl -e '
$SampleText = <<EOT;
this is a test
EOT
print $SampleText, "\n";
'
Jay Glascoe
--
"Don't be too proud of this technological
terror you've constructed."
-- Darth Vader
------------------------------
Date: Wed, 17 Feb 1999 12:27:18 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: <<HERE code
Message-Id: <7aetpp$221$1@camel0.mindspring.com>
joec@impacttech.com wrote in message <7aeql9$7hi$1@nnrp1.dejanews.com>...
:I have to copy a fairly large block of text to a variable.
:I would like to do it with a similar construct to the construct:
:print <<EOT;
:this is test
:EOT
:
:Something on the order of
:
:$SampleText = <<EOT;
:this is a test
:EOT
Well the code is correct, when I hear this complaint I always think, no
newline at the end of thefile.
EOT token cannot be the last element of the file, there must be at least one
additional line. I often end up recommending that folks write the above as
$SampleText = <<EOT;
this is a test
EOT
;
The useless ; ensures that there is the necessary extra newline. Or just
make sure you hit return at least once <g>.
HTH
AmD
------------------------------
Date: Wed, 17 Feb 1999 08:50:52 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: <<HERE code
Message-Id: <36CAF36C.C079DDD@vpservices.com>
joec@impacttech.com wrote:
>
> I have to copy a fairly large block of text to a variable.
>
> [snip]
>
> Something on the order of
>
> $SampleText = <<EOT;
> this is a test
> EOT
>
> Perl gives me fits if I try to do this.
Hmm, what kind of fits? (i.e. what error message?). Because that code
works for me. Perhaps you have trailing spaces on the EOT line.
--
Jeff Zucker Co-coordinator, UNICEF Voices of Youth
\/ http://www.unicef.org/voy/
-<>-
/\ CTO, Virtual Production Services LLC
jeff@vpservices.com http://www.vpservices.com/jeff/
------------------------------
Date: 17 Feb 1999 06:55:43 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: DOC: perldelta.pod for 5.005_55
Message-Id: <36caca5f@csnews>
=head1 NAME
perldelta - what's new for perl5.006 (as of 5.005_55)
=head1 DESCRIPTION
This document describes differences between the 5.005 release and this one.
=head1 Incompatible Changes
=head2 Perl Source Incompatibilities
None known at this time.
=head2 C Source Incompatibilities
=over 4
=item C<PERL_POLLUTE>
Release 5.005 grandfathered old global symbol names by providing preprocessor
macros for extension source compatibility. As of release 5.006, these
preprocessor definitions are not available by default. You need to explicitly
compile perl with C<-DPERL_POLLUTE> in order to get these definitions.
=item C<PERL_POLLUTE_MALLOC>
Enabling the use of Perl's malloc in release 5.005 and earlier caused
the namespace of system versions of the malloc family of functions to
be usurped by the Perl versions of these functions, since they used the
same names by default.
Besides causing problems on platforms that do not allow these functions to
be cleanly replaced, this also meant that the system versions could not
be called in programs that used Perl's malloc. Previous versions of Perl
have allowed this behavior to be suppressed with the HIDEMYMALLOC and
EMBEDMYMALLOC preprocessor definitions.
As of release 5.006, Perl's malloc family of functions have default names
distinct from the system versions. You need to explicitly compile perl with
C<-DPERL_POLLUTE_MALLOC> in order to get the older behavior. HIDEMYMALLOC
and EMBEDMYMALLOC have no effect, since the behavior they enabled is now
the default.
Note that these functions do B<not> constitute Perl's memory allocation API.
See L<perlguts/"Memory Allocation"> for further information about that.
=item C<PL_na> and C<dTHR> Issues
The C<PL_na> global is now thread local, so a C<dTHR> declaration is needed
in the scope in which it appears. XSUBs should handle this automatically,
but if you have used C<PL_na> in support functions, you either need to
change the C<PL_na> to a local variable (which is recommended), or put in
a C<dTHR>.
=back
=head2 Compatible C Source API Changes
=over
=item C<PATCHLEVEL> is now C<PERL_VERSION>
The cpp macros C<PERL_REVISION>, C<PERL_VERSION> and C<PERL_SUBVERSION>
are now available by default from perl.h, and reflect the base revision,
patchlevel and subversion respectively. C<PERL_REVISION> had no
prior equivalent, while C<PERL_VERSION> and C<PERL_SUBVERSION> were
previously available as C<PATCHLEVEL> and C<SUBVERSION>.
The new names cause less pollution of the cpp namespace, and reflect what
the numbers have come to stand for in common practice. For compatibility,
the old names are still supported when patchlevel.h is explicitly
included (as required before), so there is no source incompatibility
due to the change.
=back
=head2 Binary Incompatibilities
This release is not binary compatible with the 5.005 release and its
maintenance versions.
=head1 Core Changes
=head2 Binary numbers supported
Binary numbers are now supported as literals, in s?printf formats, and
C<oct()>:
$answer = 0b101010;
printf "The answer is: %b\n", oct("0b101010");
=head2 syswrite() ease-of-use
The length argument of C<syswrite()> is now optional.
=head2 64-bit support
Better 64-bit support -- but full support still a distant goal. One
must Configure with -Duse64bits to get Configure to probe for the
extent of 64-bit support. Depending on the platform (hints file) more
or less 64-awareness becomes available. As of 5.005_54 at least
somewhat 64-bit aware platforms are HP-UX 11 or better, Solaris 2.6 or
better, IRIX 6.2 or better. Naturally 64-bit platforms like Digital
UNIX and UNICOS also have 64-bit support.
=head2 Better syntax checks on parenthesized unary operators
Expressions such as:
print defined(&foo,&bar,&baz);
print uc("foo","bar","baz");
undef($foo,&bar);
used to be accidentally allowed in earlier versions, and produced
unpredictable behavior. Some of them produced ancillary warnings
when used in this way, while others silently did the wrong thing.
The parenthesized forms of most unary operators that expect a single
argument will now ensure that they are not called with more than one
argument, making the above cases syntax errors. Note that the usual
behavior of:
print defined &foo, &bar, &baz;
print uc "foo", "bar", "baz";
undef $foo, &bar;
remains unchanged. See L<perlop>.
=head2 Improved C<qw//> operator
The C<qw//> operator is now evaluated at compile time into a true list
instead of being replaced with a run time call to C<split()>. This
removes the confusing behavior of C<qw//> in scalar context stemming from
the older implementation, which inherited the behavior from split().
Thus:
$foo = ($bar) = qw(a b c); print "$foo|$bar\n";
now correctly prints "3|a", instead of "2|a".
=head2 pack() format 'Z' supported
The new format type 'Z' is useful for packing and unpacking null-terminated
strings. See L<perlfunc/"pack">.
=head1 Significant bug fixes
=head2 E<lt>HANDLEE<gt> on empty files
With C<$/> set to C<undef>, slurping an empty file returns a string of
zero length (instead of C<undef>, as it used to) for the first time the
HANDLE is read. Subsequent reads yield C<undef>.
This means that the following will append "foo" to an empty file (it used
to not do anything before):
perl -0777 -pi -e 's/^/foo/' empty_file
Note that the behavior of:
perl -pi -e 's/^/foo/' empty_file
is unchanged (it continues to leave the file empty).
=head2 pack() format modifier '_' supported
The new format type modifer '_' is useful for packing and unpacking
native shorts, ints, and longs. See L<perlfunc/"pack">.
=head1 Supported Platforms
=over 4
=item *
VM/ESA is now supported.
=item *
Siemens BS200 is now supported.
=item *
The Mach CThreads (NeXTstep) are now supported by the Thread extension.
=back
=head1 New tests
=over 4
=item op/io_const
IO constants (SEEK_*, _IO*).
=item op/io_dir
Directory-related IO methods (new, read, close, rewind, tied delete).
=item op/io_multihomed
INET sockets with multi-homed hosts.
=item op/io_poll
IO poll().
=item op/io_unix
UNIX sockets.
=item op/filetest
File test operators.
=item op/lex_assign
Verify operations that access pad objects (lexicals and temporaries).
=back
=head1 Modules and Pragmata
=head2 Modules
=over 4
=item Dumpvalue
Added Dumpvalue module provides screen dumps of Perl data.
=item Benchmark
You can now run tests for I<x> seconds instead of guessing the right
number of tests to run.
=item Fcntl
More Fcntl constants added: F_SETLK64, F_SETLKW64, O_LARGEFILE for
large (more than 4G) file access (the 64-bit support is not yet
working, though, so no need to get overly excited), Free/Net/OpenBSD
locking behaviour flags F_FLOCK, F_POSIX, Linux F_SHLCK, and
O_ACCMODE: the mask of O_RDONLY, O_WRONLY, and O_RDWR.
=item Math::Complex
The accessors methods Re, Im, arg, abs, rho, theta, methods can
($z->Re()) now also act as mutators ($z->Re(3)).
=item Math::Trig
A little bit of radial trigonometry (cylindrical and spherical) added,
for example the great circle distance.
=item Time::Local
The timelocal() and timegm() functions used to silently return bogus
results when the date exceeded the machine's integer range. They
consistently croak() if the date falls in an unsupported range.
=back
=head2 Pragmata
Lexical warnings pragma, "use warning;", to control optional warnings.
Filetest pragma, to control the behaviour of filetests (C<-r> C<-w> ...).
Currently only one subpragma implemented, "use filetest 'access';",
that enables the use of access(2) or equivalent to check the
permissions instead of using stat(2) as usual. This matters
in filesystems where there are ACLs (access control lists), the
stat(2) might lie, while access(2) knows better.
=head1 Utility Changes
Todo.
=head1 Documentation Changes
=over 4
=item perlopentut.pod
A tutorial on using open() effectively.
=item perlreftut.pod
A tutorial that introduces the essentials of references.
=back
=head1 New Diagnostics
=item /%s/: Unrecognized escape \\%c passed through
(W) You used a backslash-character combination which is not recognized
by Perl. This combination appears in an interpolated variable or a
C<'>-delimited regular expression.
=item Unrecognized escape \\%c passed through
(W) You used a backslash-character combination which is not recognized
by Perl.
=item Missing command in piped open
(W) You used the C<open(FH, "| command")> or C<open(FH, "command |")>
construction, but the command was missing or blank.
=head1 Obsolete Diagnostics
Todo.
=head1 Configuration Changes
You can use "Configure -Uinstallusrbinperl" which causes installperl
to skip installing perl also as /usr/bin/perl. This is useful if you
prefer not to modify /usr/bin for some reason or another but harmful
because many scripts assume to find Perl in /usr/bin/perl.
=head1 BUGS
If you find what you think is a bug, you might check the headers of
recently posted articles in the comp.lang.perl.misc newsgroup.
There may also be information at http://www.perl.com/perl/, the Perl
Home Page.
If you believe you have an unreported bug, please run the B<perlbug>
program included with your release. Make sure you trim your bug down
to a tiny but sufficient test case. Your bug report, along with the
output of C<perl -V>, will be sent off to <F<perlbug@perl.com>> to be
analysed by the Perl porting team.
=head1 SEE ALSO
The F<Changes> file for exhaustive details on what changed.
The F<INSTALL> file for how to build Perl.
The F<README> file for general stuff.
The F<Artistic> and F<Copying> files for copyright information.
=head1 HISTORY
Written by Gurusamy Sarathy <F<gsar@umich.edu>>, with many contributions
from The Perl Porters.
Send omissions or corrections to <F<perlbug@perl.com>>.
=cut
--
If I had to choose between System V and 4.2, I'd resign. --Peter Honeyman
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4915
**************************************