Skip Menu |
Report information
Id: 845
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: pfeiffer [at] start.de
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: 5.6.0
Fixed In: (no value)



From: pfeiffer [...] start.de
Date: Sat, 5 Jun 1999 17:04:18 +0200
To: perlbug [...] perl.com
Subject: Pod does not get ignored by perl
Cc: feedback [...] suse.de
This is a bug report for perl from occitan@esperanto.org, generated with the help of perlbug 1.26 running under perl 5.00502. ----------------------------------------------------------------- While you go about this, a little remark. When using =cut a lot it sticks out like a sore thumb, distracting from the code. It would be neat if (given that this is a sort of closing paren) qr/\bcut=$/ would perform the same trick. I'm thinking about writing a Pod.pm parser, which the various incarnations would inherit from and only worry about the generating-half of the job. In the style of literate programming I just mingled the pod into a very long statement (GetOptions which is several pages long, and I documented every option on the spot, for one thing to be sure to cover them all, for another to make the weird option specs clearer). The = signs before item and cut are not seen, probably erroneously parsed as assignments, even though they are on paragraphs of their own. A real pity the perlpod's assertion "Perl will ignore the pod text." doesn't hold. Silly example: =head1 test =over =cut print =item number =cut 1, =item newline =cut "\n"; =back gives: Number found where operator expected at test.pl line 13, near "cut 1" (Do you need to predeclare cut?) syntax error at test.pl line 13, near "cut 1" String found where operator expected at test.pl line 19, near "cut "\n"" (Do you need to predeclare cut?) Execution of test.pl aborted due to compilation errors. ----------------------------------------------------------------- Site configuration information for perl 5.00502: Configured by root at Sun Apr 4 19:59:20 /etc/localtime 1999. Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration: Platform: osname=linux, osvers=2.2.5, archname=i586-linux uname='linux pascal 2.2.5 #79 tue jan 19 12:41:20 met 1999 i686 unknown ' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-O2 -pipe', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release) cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include' ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt libc=, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: --- @INC for perl 5.00502: /usr/lib/perl5/5.00502/i586-linux /usr/lib/perl5/5.00502 /usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 . --- Environment for perl 5.00502: HOME=/home/pfeiffer LANG (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/pfeiffer/bin:/usr/local/system/scripts:/usr/local/bin:/bin:/usr/bin::/sbin:/usr/sbin:/usr/games/bin:/usr/bin/X11:/opt/kde/bin PERL_BADLANG (unset) SHELL=/bin/ksh --- Site configuration information for perl 5.00502: Configured by root at Sun Apr 4 19:59:20 /etc/localtime 1999. Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration: Platform: osname=linux, osvers=2.2.5, archname=i586-linux uname='linux pascal 2.2.5 #79 tue jan 19 12:41:20 met 1999 i686 unknown ' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-O2 -pipe', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release) cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include' ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt libc=, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: --- @INC for perl 5.00502: /usr/lib/perl5/5.00502/i586-linux /usr/lib/perl5/5.00502 /usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 . --- Environment for perl 5.00502: HOME=/home/pfeiffer LANG (unset) LC_CTYPE=de_DE LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/pfeiffer/bin:/usr/local/system/scripts:/usr/local/bin:/bin:/usr/bin::/sbin:/usr/sbin:/usr/games/bin:/usr/bin/X11:/opt/kde/bin PERL_BADLANG (unset) SHELL=/bin/bash
Date: Mon, 20 Mar 2000 21:32:41 -0700 (MST)
From: Nathan Torkington <gnat [...] frii.com>
To: perl5-porters [...] perl.org
Cc: pfeiffer [...] start.de
Subject: [19990605.001] =cut weirdness
Download (untitled) / with headers
text/plain 1.6k
This bug is still present in 5.6. Porters, anyone game to track it down? Nat Show quoted text
> This is a bug report for perl from occitan@esperanto.org, > generated with the help of perlbug 1.26 running under perl 5.00502. > ----------------------------------------------------------------- > While you go about this, a little remark. When using =cut a lot it sticks out > like a sore thumb, distracting from the code. It would be neat if (given that > this is a sort of closing paren) qr/\bcut=$/ would perform the same trick. > I'm thinking about writing a Pod.pm parser, which the various incarnations > would inherit from and only worry about the generating-half of the job. > > In the style of literate programming I just mingled the pod into a very long > statement (GetOptions which is several pages long, and I documented every > option on the spot, for one thing to be sure to cover them all, for another to > make the weird option specs clearer). > > The = signs before item and cut are not seen, probably erroneously parsed as > assignments, even though they are on paragraphs of their own. A real pity the > perlpod's assertion "Perl will ignore the pod text." doesn't hold. Silly > example: > > =head1 test > > =over > > =cut > > print > > =item number > > =cut > > 1, > > =item newline > > =cut > > "\n"; > > =back > > gives: > > Number found where operator expected at test.pl line 13, near "cut > > 1" > (Do you need to predeclare cut?) > syntax error at test.pl line 13, near "cut > > 1" > String found where operator expected at test.pl line 19, near "cut > > "\n"" > (Do you need to predeclare cut?) > Execution of test.pl aborted due to compilation errors.
To: Nathan Torkington <gnat [...] frii.com>
Cc: perl5-porters [...] perl.org, pfeiffer [...] start.de, tchrist [...] chthon.perl.com
Subject: Re: [19990605.001] =cut weirdness
Date: Mon, 20 Mar 2000 21:38:12 -0700
From: Tom Christiansen <tchrist [...] chthon.perl.com>
Download (untitled) / with headers
text/plain 101b
The funny thing is that if it's the first pod directive in the file, the first =cut doesn't. --tom
Date: Mon, 20 Mar 2000 23:41:55 -0500 (EST)
From: Jeff Pinyan <jeffp [...] crusoe.net>
To: Nathan Torkington <gnat [...] frii.com>
Cc: perl5-porters [...] perl.org, pfeiffer [...] start.de
Subject: Re: [19990605.001] =cut weirdness
Download (untitled) / with headers
text/plain 909b
Show quoted text
>This bug is still present in 5.6. Porters, anyone game to track >it down?
Show quoted text
>> The = signs before item and cut are not seen, probably erroneously parsed as >> assignments, even though they are on paragraphs of their own. A real pity the >> perlpod's assertion "Perl will ignore the pod text." doesn't hold. Silly >> example:
This is because POD directives (or whatever the are called, the paragraphs beginning with an =) must occur where Perl expects a new statement. At least, this is what I have found to be true through testing. But I don't know what to do about it, since "I'm more of an idea rat." -- MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve japhy@pobox.com http://www.pobox.com/~japhy/ http://pinyaj.stu.rpi.edu/ PerlMonth - An Online Perl Magazine http://www.perlmonth.com/ The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
To: japhy [...] pobox.com
Cc: Nathan Torkington <gnat [...] frii.com>, perl5-porters [...] perl.org, pfeiffer [...] start.de, tchrist [...] chthon.perl.com
Subject: Re: [19990605.001] =cut weirdness
Date: Mon, 20 Mar 2000 21:43:55 -0700
From: Tom Christiansen <tchrist [...] chthon.perl.com>
Download (untitled) / with headers
text/plain 532b
Show quoted text
>This is because POD directives (or whatever the are called, the paragraphs >beginning with an =) must occur where Perl expects a new statement. At >least, this is what I have found to be true through testing.
perlsyn: Perl has a mechanism for intermixing documentation with source code. While it's expecting the beginning of a new statement, if the compiler encounters a line that begins with an equal sign and a word, like this That could be more clearly worded, but the intent is there. --tom
Date: Mon, 20 Mar 2000 21:43:35 -0700 (MST)
From: Nathan Torkington <gnat [...] frii.com>
To: Tom Christiansen <tchrist [...] chthon.perl.com>
Cc: japhy [...] pobox.com, perl5-porters [...] perl.org, pfeiffer [...] start.de
Subject: Re: [19990605.001] =cut weirdness
Download (untitled) / with headers
text/plain 368b
Tom Christiansen writes: Show quoted text
> >This is because POD directives (or whatever the are called, the paragraphs > >beginning with an =) must occur where Perl expects a new statement. At > >least, this is what I have found to be true through testing.
> > perlsyn: > That could be more clearly worded, but the intent is there.
Good enough for me. I'll mark it closed. Nat
Date: Tue, 21 Mar 2000 02:45:27 -0500 (EST)
From: Philip Newton <newton [...] newton.digitalspace.net>
To: Tom Christiansen <tchrist [...] chthon.perl.com>
Cc: japhy [...] pobox.com, Nathan Torkington <gnat [...] frii.com>, perl5-porters [...] perl.org, pfeiffer [...] start.de
Subject: Re: [19990605.001] =cut weirdness
Download (untitled) / with headers
text/plain 941b
On Mon, 20 Mar 2000, Tom Christiansen wrote: Show quoted text
> >This is because POD directives (or whatever the are called, the paragraphs > >beginning with an =) must occur where Perl expects a new statement. At > >least, this is what I have found to be true through testing.
> > perlsyn: > > Perl has a mechanism for intermixing documentation with > source code. While it's expecting the beginning of a new > statement, if the compiler encounters a line that begins > with an equal sign and a word, like this
There's also an allusion in perlfaq7 under "How can I comment out a large block of perl code?": This can't go just anywhere. You have to put a pod directive where the parser is expecting a new statement, not just in the middle of an expression or some other arbitrary yacc grammar production. Cheers, Philip -- Philip Newton <newton@newton.digitalspace.net>
To: japhy [...] pobox.com
Cc: fwp [...] technofile.com, perl5-porters [...] perl.org, tchrist [...] chthon.perl.com
Subject: Re: read(FH,$buffer,2**31 - 1)
Date: Wed, 15 Mar 2000 16:55:54 -0700
From: Tom Christiansen <tchrist [...] chthon.perl.com>
Download (untitled) / with headers
text/plain 1.8k
Show quoted text
>Hmm. Why doesn't Perl like reading a lot from STDIN?
Show quoted text
> perl -Mdiagnostics -e 'read(FOO,$FOO,2 ** 31 - 1)'
Show quoted text
>runs smoothly.
Show quoted text
> perl -Mdiagnostics -e 'read(STDIN,$STDIN,2 ** 31 - 1)'
Show quoted text
>Out of memory during "large" request for -2147479552 bytes at -e line 1 >(#1)
Show quoted text
> (F) The malloc() function returned 0, indicating there was insufficient > remaining memory (or virtual memory) to satisfy the request. However, > the request was judged large enough (compile-time default is 64K), so > a possibility to shut down by trapping this error is granted.
Perhaps if you actually read from something you could read from you might get a different answer. % perl -Mdiagnostics -e '*FOO = *STDIN; read(FOO,$FOO,2 ** 31 - 1)' panic: realloc at -e line 1 (#1) (P) Something requested a negative number of bytes of realloc. Uncaught exception from user code: panic: realloc at -e line 1. Word to the wise: always read in only as much as is there, and always check you got what you asked for. And don't be trying to go preallocating these (off_t (-1)) sized buffers. That's a crackhead move. In some cases, this is ok not to, in others, it isn't. If you know how much is there, certainly check. If you don't know how much is there, use a block at a time--very carefully. You need to understand about partial reads and writes. use Errno qw/EINTR/; $blksize = (stat FROM)[11] || 16384; # preferred block size? while ($len = sysread FROM, $buf, $blksize) { if (!defined $len) { next if $! == EINTR; die "System read error: $!\n"; } $offset = 0; while ($len) { # Handle partial writes. $written = syswrite TO, $buf, $len, $offset; die "System write error: $!\n" unless defined $written; $offset += $written; $len -= $written; } } --tom


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org