Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 527 forks source link

fields.pm manpage: syntax error in example code #159

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

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

Searchable as RT964$

p5pRT commented 24 years ago

From splice@zerg.com

Fields manpage​: http​://www.rge.com/CPAN/doc/manual/html/lib/fields.html The fields manpage has incorrect code at the bottom of the DESCRIPTION section. Here is the code​:

sub new   {   my $class = shift;   no strict 'refs';   my $self = bless [\%{"$class\​::FIELDS"]\, $class; # INCORRECT LINE   $self;   }

It's got an opening "{"\, but it's got no closing "}". I have tested this example under perl 5.005 and\, as expected\, it only works if you put in the closing "}". This is what the code should say​:

sub new   {   my $class = shift;   no strict 'refs';   my $self = bless [\%{"$class\​::FIELDS"}]\, $class; # CORRECT LINE   $self;   }

- David James beta@​home.com

Perl Info ``` Site configuration information for perl 5.005: Summary of my perl5 (5.0 patchlevel 5 subversion 00) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-object uname='' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cl.exe', optimize='-O2 -MD -DNDEBUG -TP -GX', gccversion= cppflags='-DWIN32' ccflags '-O2 -MD -DNDEBUG -TP -GX -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_OBJECT' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -release -machine:x86' libpth="d:\program files\devstudio\vc\lib" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib PerlCRT.lib libc=f:\Perl32\5.005\bin\MSWin32-x86-object\PerlCRT.lib, so=dll, useshrplib=yes, libperl=perlcore.lib Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -machine:x86' Locally applied patches: @INC for perl 5.005: F:\PERL32\5.005\lib/MSWin32-x86-object F:\PERL32\5.005\lib F:\PERL32\site\5.005\lib/MSWin32-x86-object F:\PERL32\site\5.005\lib F:\PERL32\site\lib . Environment for perl 5.005: HOME (unset) LANG (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=f:\Perl32\5.005\bin\MSWin32-x86-object;f:\Perl32\5.005\bin;F:\PERL\BIN; F:\PERL\BIN;C:\PROGRA~1\ULTRAEDT;C:\WINDOWS;C:\WINDOWS\COMMAND;C:\WINDOWS\SY STEM;F:\PERL\BIN PERL_BADLANG (unset) SHELL (unset) ```