This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
authorNicholas Clark <nick@ccl4.org>
Tue, 27 Jan 2004 22:39:47 +0000 (22:39 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 27 Jan 2004 22:39:47 +0000 (22:39 +0000)
[ 22207]
Subject:  Re: Doc patches for File::Find
From:  Mark Jason Dominus <mjd@plover.com>
Date:  Thu, 22 Jan 2004 09:30:58 -0500
Message-Id:  <20040122143058.29226.qmail@plover.com>

Better document the fact that neither find() nor finddepth() do a
breath-first search.

[ 22208]
Subject:  [perl #24942] fields::inherit doesn't bless derived
    package's \%FIELDS, results in phash deprecation errors.
From:  "nothingmuch@woobling.org (via RT)" <perlbug-followup@perl.org>
Date:  18 Jan 2004 15:15:46 -0000
Message-Id:  <rt-3.0.8-24942-70144.16.7177902690315@perl.org>

[ 22227]
Subject:  [PATCH] myconfig.SH
From:  "Daniel S. Lewart" <lewart@uiuc.edu>
Date:  Sun, 25 Jan 2004 22:11:25 -0600
Message-Id:  <20040125221125.A5390@staff1.cso.uiuc.edu>

make perl -V show the major release as 5 rather than 5.0

[ 22228]
Subject: [PATCH] 5.8.3 -- fix signal comments in L<perlfunc/system>
From: Brendan O'Dea <bod@debian.org>
Date: Sun, 25 Jan 2004 11:23:48 +1100
Message-ID: <20040125002348.GA31407@londo.c47.org>
p4raw-link: @22228 on //depot/perl: 4c2e8b59470475b2be2757a46f0310b650149aa2
p4raw-link: @22227 on //depot/perl: 31e7d91aa2c497c1f2b20d19e3949c2f2538e617
p4raw-link: @22208 on //depot/perl: 8731c5d9eb453a5b2d087dabd7a5f51b576b8048
p4raw-link: @22207 on //depot/perl: 6eb87ff8bf4b0fb28bd1498a03b1502cf11429d2

p4raw-id: //depot/maint-5.8/perl@22241
p4raw-integrated: from //depot/perl@22240 'copy in'
lib/base/t/fields-base.t (@21235..) lib/base.pm (@21927..)
lib/File/Find.pm (@22150..) 'merge in' myconfig.SH (@18030..)
p4raw-integrated: from //depot/perl@22228 'merge in' pod/perlfunc.pod
(@22199..)

lib/File/Find.pm
lib/base.pm
lib/base/t/fields-base.t
myconfig.SH
pod/perlfunc.pod

index f9fb16b..c81c02e 100644 (file)
@@ -44,21 +44,23 @@ but have subtle differences.
   find(\&wanted,  @directories);
   find(\%options, @directories);
 
-C<find()> does a breadth-first search over the given C<@directories> in the
-order they are given.  In essence, it works from the top down.
-
-For each file or directory found, the C<&wanted> subroutine is called,
-with the return code ignored.  (See below for details on how to use
-the C<&wanted> function).  Additionally, for each directory found,
-it will go into that directory and continue the search.
+C<find()> does a depth-first search over the given C<@directories> in
+the order they are given.  For each file or directory found, it calls
+the C<&wanted> subroutine.  (See below for details on how to use the
+C<&wanted> function).  Additionally, for each directory found, it will
+C<chdir()> into that directory and continue the search, invoking the
+C<&wanted> function on each file or subdirectory in the directory.
 
 =item B<finddepth>
 
   finddepth(\&wanted,  @directories);
   finddepth(\%options, @directories);
 
-C<finddepth()> works just like C<find()> except it does a depth-first search.
-It works from the bottom of the directory tree up.
+C<finddepth()> works just like C<find()> except that is invokes the
+C<&wanted> function for a directory I<after> invoking it for the
+directory's contents.  It does a postorder traversal instead of a
+preorder traversal, working from the bottom of the directory tree up
+where C<find()> works from the top of the tree down.
 
 =back
 
@@ -388,6 +390,12 @@ volume actually maintains its own "Desktop Folder" directory.
 
 =back
 
+=head1 BUGS AND CAVEATS
+
+Despite the name of the C<finddepth()> function, both C<find()> and
+C<finddepth()> perform a depth-first search of the directory
+hierarchy.
+
 =head1 HISTORY
 
 File::Find used to produce incorrect results if called recursively.
index 04a8aa9..b735848 100644 (file)
@@ -38,11 +38,26 @@ sub get_attr {
     return $Fattr->{$_[0]};
 }
 
-sub get_fields {
-    # Shut up a possible typo warning.
-    () = \%{$_[0].'::FIELDS'};
-
-    return \%{$_[0].'::FIELDS'};
+if ($] < 5.009) {
+    *get_fields = sub {
+       # Shut up a possible typo warning.
+       () = \%{$_[0].'::FIELDS'};
+       my $f = \%{$_[0].'::FIELDS'};
+
+       # should be centralized in fields? perhaps
+       # fields::mk_FIELDS_be_OK. Peh. As long as %{ $package . '::FIELDS' }
+       # is used here anyway, it doesn't matter.
+       bless $f, 'pseudohash' if (ref($f) ne 'pseudohash');
+
+       return $f;
+    }
+}
+else {
+    *get_fields = sub {
+       # Shut up a possible typo warning.
+       () = \%{$_[0].'::FIELDS'};
+       return \%{$_[0].'::FIELDS'};
+    }
 }
 
 sub import {
index b5ab54f..f4a17f5 100644 (file)
@@ -20,7 +20,7 @@ BEGIN {
 }
 
 use strict;
-use Test::More tests => 25;
+use Test::More tests => 26;
 
 BEGIN { use_ok('base'); }
 
@@ -194,3 +194,27 @@ eval {
 ::like( $@, qr/Can't multiply inherit %FIELDS/i, 'Again, no multi inherit' );
 
 
+# Test that a package with no fields can inherit from a package with
+# fields, and that pseudohash messages don't show up
+
+package B9;
+use fields qw(b1);
+
+sub _mk_obj { fields::new($_[0])->{'b1'} };
+
+package D9;
+use base qw(B9);
+
+package main;
+
+{
+    my $w = 0;
+    local $SIG{__WARN__} = sub { $w++ };
+    
+    B9->_mk_obj();
+    # used tp emit a warning that pseudohashes are deprecated, because
+    # %FIELDS wasn't blessed.
+    D9->_mk_obj();
+    
+    is ($w, 0, "pseudohash warnings in derived class with no fields of it's own");     
+}
index 737c6ec..ab1884d 100644 (file)
@@ -27,7 +27,7 @@ $startsh
 
 # Note that the text lines /^Summary of/ .. /^\s*$/ are copied into Config.pm.
 cat <<'!NO!SUBS!'
-Summary of my $package (revision $baserev $version_patchlevel_string) configuration:
+Summary of my $package (revision $revision $version_patchlevel_string) configuration:
   Platform:
     osname=$osname, osvers=$osvers, archname=$archname
     uname='$myuname'
index fe7f098..fe18a79 100644 (file)
@@ -5770,9 +5770,10 @@ indicates a failure to start the program (inspect $! for the reason).
 Like C<exec>, C<system> allows you to lie to a program about its name if
 you use the C<system PROGRAM LIST> syntax.  Again, see L</exec>.
 
-Because C<system> and backticks block C<SIGINT> and C<SIGQUIT>,
-killing the program they're running doesn't actually interrupt
-your program.
+Since C<SIGINT> and C<SIGQUIT> are ignored during the execution of
+C<system>, if you expect your program to terminate on receipt of these
+signals you will need to arrange to do so yourself based on the return
+value.
 
     @args = ("command", "arg1", "arg2");
     system(@args) == 0
@@ -5792,7 +5793,6 @@ C<$?> like this:
        printf "child exited with value %d\n", $? >> 8;
     }
 
-
 or more portably by using the W*() calls of the POSIX extension;
 see L<perlport> for more information.