develooper Front page | perl.perl5.porters | Postings from March 2003

Core modules w/o "1;" [Was: Re: Pod::Man has no "1;"...]

Thread Previous | Thread Next
From:
Dan Kogai
Date:
March 28, 2003 23:16
Subject:
Core modules w/o "1;" [Was: Re: Pod::Man has no "1;"...]
Message ID:
49C53593-61B6-11D7-84CB-000393AE4244@dan.co.jp
On Saturday, Mar 29, 2003, at 15:02 Asia/Tokyo, Dan Kogai wrote:
>  diff -u  /usr/local/lib/perl5/5.8.0/Pod/Man.pm Pod/Man.pm
> --- /usr/local/lib/perl5/5.8.0/Pod/Man.pm       Wed Jan 15 23:11:52 
> 2003
> +++ Pod/Man.pm  Sat Mar 29 14:55:42 2003
> @@ -1121,6 +1121,7 @@
>      }
>  }
>
> +1; # So perl and Schwern is happy
>  __END__

perldoc -f require says;
> sub require {
>     my($filename) = @_;
>     return 1 if $INC{$filename};
>     my($realfilename,$result);
>  ITER: {
>         foreach $prefix (@INC) {
>             $realfilename = "$prefix/$filename";
>             if (-f $realfilename) {
>                 $INC{$filename} = $realfilename;
>                 $result = do $realfilename;
>                 last ITER;
>             }
>         }
>         die "Can't find $filename in \@INC";
>     }
>     delete $INC{$filename} if $@ || !$result;
>     die $@ if $@;
>     die "$filename did not return true value" unless $result;
>     return $result;
> }

Therefore it is perl 5.8.0 that is behaving correctly.  And "eval 
q(require Module)" still works since  It does not kill perl itself.

> perl5.8.0 -e 'eval q[require Pod::Man];  print $@; print "1\n"'
> Pod/Man.pm did not return a true value at (eval 1) line 3.
> 1

I have made a very crude module checker (the source right after the 
signature).  There were not very many modules to fix so I suggest we 
just fix these;  all we need to do is add "1;"

On FreeBSD (The one installed via ports)
> AnyDBM_File: no "1;" but OK
> diagnostics: no "1;" but OK
> CPAN::Nox: no "1;" and not OK
> ExtUtils::Embed: no "1;" but OK
> ExtUtils::Liblist: no "1;" but OK
> ExtUtils::MM: no "1;" but OK
> ExtUtils::MY: no "1;" but OK
> Getopt::Long: no "1;" but OK
> IPC::Open2: no "1;" but OK
> Math::Trig: no "1;" and not OK
> Memoize::AnyDBM_File: no "1;" but OK
> Pod::LaTeX: no "1;" and not OK
> Pod::Man: no "1;" and not OK
> Test::Harness::Iterator: no "1;" but OK
> Tie::File: no "1;" and not OK
> warnings::register: no "1;" but OK
> threads::shared: no "1;" and not OK


On MacOS X
(Made with "Configure -Dprefix=/usr/local -DDEBUGGING -Doptimize='-g 
-O3'  -Uinstallusrbinperl -Dusemorebits -Dusethreads -desO")
> AnyDBM_File: no "1;" but OK
> diagnostics: no "1;" but OK
> warnings::register: no "1;" but OK
> Tie::File: no "1;" and not OK
> Test::Harness::Iterator: no "1;" but OK
> Pod::LaTeX: no "1;" and not OK
> Pod::Man: no "1;" and not OK
> Memoize::AnyDBM_File: no "1;" but OK
> Math::Trig: no "1;" and not OK
> IPC::Open2: no "1;" but OK
> Getopt::Long: no "1;" but OK
> ExtUtils::Embed: no "1;" and not OK
> ExtUtils::Liblist: no "1;" and not OK
> ExtUtils::MM: no "1;" but OK
> ExtUtils::MY: no "1;" but OK
> threads::shared: no "1;" and not OK
> CPAN::Nox: no "1;" and not OK

Dan the Perl5 Porter
#!/usr/local/bin/perl

use strict;
use File::Find ();

# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name   = *File::Find::name;
*dir    = *File::Find::dir;
*prune  = *File::Find::prune;

sub wanted;

my $coreroot = '/usr/local/lib/perl5/5.8.0';
my @roots;
for (@INC){
     s,^$coreroot/,,o or next;
     push @roots, $_;
}
my $roots = join("|" => @roots);
# warn $roots;

# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, $coreroot);
exit;

sub wanted {
     /^.*\.pm\z/s or return;
     my $one = 0;
     open my $fh, $name or die "$name:$!";
     while(my $line = <$fh>){
         $line =~ /^1;/o and $one = 1 and last;
     }
     close $fh;
     $one and return;
     my $mod = $name;
     $mod =~ s,^$coreroot/,,o;
     $mod =~ s,^($roots)/,,o;
     $mod =~ s,/,::,go; $mod =~ s/\.pm$//o;
     print qq($mod: no "1;" );
     eval qq(require $mod);
     print $@ ? "and not OK" : "but OK";
     print "\n";
}


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About