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

Patch for featured TODO: make a reproducible perlmodlib.PL #9293

Closed
p5pRT opened this issue Apr 17, 2008 · 10 comments
Closed

Patch for featured TODO: make a reproducible perlmodlib.PL #9293

p5pRT opened this issue Apr 17, 2008 · 10 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 17, 2008

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

Searchable as RT53000$

@p5pRT
Copy link
Author

p5pRT commented Apr 17, 2008

From wsjbence@gmail.com

Hi​:
  Here, after clarification from Rafael Garcia-Suarez, is a patch
for the TODO featured in a recent summary. It's been a long time since
I submitted a patch; I read the docs on how to do it, but if I made a
mistake, please let me know and I will fix it.

--James

@p5pRT
Copy link
Author

p5pRT commented Apr 17, 2008

From wsjbence@gmail.com

perlmodlib.PL.patch
*** perl-5.10.0/pod/perlmodlib.PL.old	Tue Dec 18 02:47:08 2007
--- perl-5.10.0/pod/perlmodlib.PL	Wed Apr 16 22:05:57 2008
***************
*** 10,45 ****
  push @MANIFEST, 'lib/Config.pod', 'lib/Errno.pm', 'lib/lib.pm',
      'lib/DynaLoader.pm', 'lib/XSLoader.pm';
  
! -f "../lib/DynaLoader.pm" or die "Must be run from a source tree where perl has been built\n";
  
  for (@MANIFEST) {
!      my $filename;
!      next unless s|^lib/|| or m|^ext/|;
!      my ($origfilename) = ($filename) = m|^(\S+)|;
!      $filename =~ s|^[^/]+/|| if $filename =~ s|^ext/||;
!      next unless $filename =~ m!\.p(m|od)$!;
!      unless (open (MOD, "../lib/$filename")) {
! 	unless (open (MOD, "../$origfilename")) {
! 	    warn "Couldn't open ../$origfilename: $!";
! 	    next;
! 	}
! 	$filename = $origfilename;
!      }
  
  
       my ($name, $thing);
       my $foundit=0;
       {
! 	 local $/="";
! 	 while (<MOD>) {
! 	     next unless /^=head1 NAME/;
! 	     $foundit++;
! 	     last;
! 	 }
       }
       unless ($foundit) {
! 	 warn "$filename missing =head1 NAME (okay if there is respective .pod)\n";
! 	 next;
       }
       my $title = <MOD>;
       chomp($title);
--- 10,66 ----
  push @MANIFEST, 'lib/Config.pod', 'lib/Errno.pm', 'lib/lib.pm',
      'lib/DynaLoader.pm', 'lib/XSLoader.pm';
  
! # If run in a clean source tree, these will be missing because they are
! # generated by the build.
! my %generated = (
!     'encoding' => 'Allows you to write your script in non-ascii or non-utf8',
!     'lib' => 'Manipulate @INC at compile time',
!     'ops' => 'Restrict unsafe operations when compiling',
!     'Config' => 'Access Perl configuration information',
!     'DynaLoader' => 'Dynamically load C libraries into Perl code',
!     'Errno' => 'System errno constants',
!     'O' => 'Generic interface to Perl Compiler backends',
!     'Safe' => 'Compile and execute code in restricted compartments',
!     'XSLoader' => 'Dynamically load C libraries into Perl code',
! );
  
+ # If run in a clean source tree, these should not be reported.
+ # These are considered 'modules' by this script, but they really are not.
+ my %suppressed = map {$_ => 1} qw(
+     B::O
+     Encode::encoding
+     Opcode::Safe
+     Opcode::ops
+ );
+ 
  for (@MANIFEST) {
!     my $filename;
!     next unless s|^lib/|| or m|^ext/|;
!     my ($origfilename) = ($filename) = m|^(\S+)|;
!     $filename =~ s|^[^/]+/|| if $filename =~ s|^ext/||;
!     next unless $filename =~ m!\.p(m|od)$!;
!     unless (open (MOD, "../lib/$filename")) {
!         unless (open (MOD, "../$origfilename")) {
!             warn "Couldn't open ../$origfilename: $!";
!             next;
!         }
!         $filename = $origfilename;
!     }
  
  
       my ($name, $thing);
       my $foundit=0;
       {
!          local $/="";
!          while (<MOD>) {
!              next unless /^=head1 NAME/;
!              $foundit++;
!              last;
!          }
       }
       unless ($foundit) {
!          warn "$filename missing =head1 NAME (OK if respective .pod exists)\n";
!          next;
       }
       my $title = <MOD>;
       chomp($title);
***************
*** 57,67 ****
       ($name, $thing) = split / --? /, $title, 2;
  
       unless ($name and $thing) {
! 	 warn "$filename missing name\n"  unless $name;
! 	 warn "$filename missing thing\n" unless $thing;
! 	 next;
       }
  
  
       $thing =~ s/^perl pragma to //i;
       $thing = ucfirst($thing);
--- 78,89 ----
       ($name, $thing) = split / --? /, $title, 2;
  
       unless ($name and $thing) {
!          warn "$filename missing name\n"  unless $name;
!          warn "$filename missing thing\n" unless $thing;
!          next;
       }
  
+      next if $suppressed{$perlname};
  
       $thing =~ s/^perl pragma to //i;
       $thing = ucfirst($thing);
***************
*** 72,78 ****
--- 94,111 ----
       } else {
            push @pragma, $title;
       }
+ 
+      # if we find a generated one via the MANIFEST, no need to add later.
+      delete $generated{$perlname};
  }
+ while (my ($name,$desc) = each %generated) {
+     my $title = "=item $name\n\n$desc\n\n";
+     if ($name =~ /[A-Z]/) {
+         push @mod, $title;
+     } else {
+         push @pragma, $title;
+     }
+ }
  
  print OUT <<'EOF';
  =for maintainers

@p5pRT
Copy link
Author

p5pRT commented Apr 18, 2008

From @rgs

Thanks, applied as change #33711 (and perlmodlib.pod regenerated).

Next time, please provide a patch in unified diff format (diff -u).

@p5pRT
Copy link
Author

p5pRT commented Apr 18, 2008

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Apr 18, 2008

@rgs - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Apr 18, 2008
@p5pRT
Copy link
Author

p5pRT commented Jan 13, 2009

From @floatingatoll

I accidentally did more work on this todo because it's still listed at
http​://perldoc.perl.org/perltodo.html. It seems to improve things
anyways, so here it is.

(1) Descriptions are now pulled from the source file.

I updated perlmodlib.PL to list the filename containing the pod
description for e.g. "lib/encodings.pm", rather than hard-coding the
descriptions in the script itself.

(2) Two modules that went missing from the pod are returned.

The generated pod now includes two modules that went missing for no
apparent reason, e.g. "Test​::Tutorial".

(3) Regenerated perlmodlib.pod from a ./Configure -des w/miniperl source
tree.

A great deal of modules appear to have been added since the last time
the pod was regenerated. So I included a patch against blead to do that.

Cheers!

(This is a "git diff blead..work" patch, rather than a bundle or
something. I hope that's okay.)

- R.

@p5pRT
Copy link
Author

p5pRT commented Jan 13, 2009

@p5pRT
Copy link
Author

p5pRT commented Jan 13, 2009

From @nwc10

On Mon, Jan 12, 2009 at 11​:02​:42PM -0800, Richard Soderberg via RT wrote​:

I accidentally did more work on this todo because it's still listed at
http​://perldoc.perl.org/perltodo.html. It seems to improve things
anyways, so here it is.

Without properly reading the rest of your message, this prompted me to change
the first paragraph to

  This is a list of wishes for Perl. The most up to date version of this file
  is at http​://perl5.git.perl.org/perl.git/blob_plain/HEAD​:/pod/perltodo.pod

Hmm, we have the source to gitweb, don't we. I see /blob_plain/ in that URL.
Logically we could add a /blob_pod/ ?

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Jan 16, 2009

From @rgs

2009/1/13 Richard Soderberg via RT <perlbug-followup@​perl.org>​:

I accidentally did more work on this todo because it's still listed at
http​://perldoc.perl.org/perltodo.html. It seems to improve things
anyways, so here it is.

This patch is not good to apply as-is​: the resulting perlmodlib.PL
doesn't run correctly from the pod/ directory (which is the intended
way of working).

(1) Descriptions are now pulled from the source file.

I updated perlmodlib.PL to list the filename containing the pod
description for e.g. "lib/encodings.pm", rather than hard-coding the
descriptions in the script itself.

(2) Two modules that went missing from the pod are returned.

The generated pod now includes two modules that went missing for no
apparent reason, e.g. "Test​::Tutorial".

(3) Regenerated perlmodlib.pod from a ./Configure -des w/miniperl source
tree.

A great deal of modules appear to have been added since the last time
the pod was regenerated. So I included a patch against blead to do that.

Cheers!

(This is a "git diff blead..work" patch, rather than a bundle or
something. I hope that's okay.)

Commits are prefferred.

@p5pRT
Copy link
Author

p5pRT commented Jan 18, 2009

From @floatingatoll

On Fri, Jan 16, 2009 at 8​:11 AM, Rafael Garcia-Suarez via RT <
perlbug-followup@​perl.org> wrote​:

2009/1/13 Richard Soderberg via RT <perlbug-followup@​perl.org>​:

I accidentally did more work on this todo because it's still listed at
http​://perldoc.perl.org/perltodo.html. It seems to improve things
anyways, so here it is.

This patch is not good to apply as-is​: the resulting perlmodlib.PL
doesn't run correctly from the pod/ directory (which is the intended
way of working).

Something must be wrong with my git checkout then, as I've been testing it
using​:

cd pod/ && make perlmodlib.pod

Apologies for the failed patch, I'll try again someday.

- R.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant