Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pod does not get ignored by perl #43

Closed
p5pRT opened this issue Jun 5, 1999 · 8 comments
Closed

Pod does not get ignored by perl #43

p5pRT opened this issue Jun 5, 1999 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 5, 1999

Migrated from rt.perl.org#845 (status was 'resolved')

Searchable as RT845$

@p5pRT
Copy link
Author

p5pRT commented Jun 5, 1999

From pfeiffer@start.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

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2000

From [Unknown Contact. See original ticket]

This bug is still present in 5.6. Porters, anyone game to track
it down?

Nat

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.

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2000

From [Unknown Contact. See original ticket]

The funny thing is that if it's the first pod directive in the file,
the first =cut doesn't.

--tom

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2000

From [Unknown Contact. See original ticket]

This bug is still present in 5.6. Porters, anyone game to track
it down?

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/

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2000

From [Unknown Contact. See original ticket]

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

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2000

From [Unknown Contact. See original ticket]

Tom Christiansen writes​:

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

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2000

From [Unknown Contact. See original ticket]

On Mon, 20 Mar 2000, Tom Christiansen wrote​:

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>

@p5pRT
Copy link
Author

p5pRT commented Mar 28, 2000

From [Unknown Contact. See original ticket]

Hmm. Why doesn't Perl like reading a lot from STDIN?

perl -Mdiagnostics -e 'read(FOO,$FOO,2 ** 31 - 1)'

runs smoothly.

perl -Mdiagnostics -e 'read(STDIN,$STDIN,2 ** 31 - 1)'

Out of memory during "large" request for -2147479552 bytes at -e line 1
(#1)

(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

khwilliamson pushed a commit to khwilliamson/perl5 that referenced this issue Jul 28, 2023
In particular, this allows the -X option to be named in the .package file
(which would have saved some confusion for Tux).

This also reduces the amount of divergence from upstream dist, which goes
a small way to addressing Perl#43.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant