r5299 - in /packages/libsub-exporter-perl/trunk: ./ inc/Module/ inc/Module/Install/ lib/Sub/ lib/Sub/Exporter/ t/

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Tue Apr 24 11:47:58 UTC 2007


Author: eloy
Date: Tue Apr 24 11:47:57 2007
New Revision: 5299

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=5299
Log:
new upstream version

Modified:
    packages/libsub-exporter-perl/trunk/Changes
    packages/libsub-exporter-perl/trunk/META.yml
    packages/libsub-exporter-perl/trunk/inc/Module/Install.pm
    packages/libsub-exporter-perl/trunk/inc/Module/Install/Base.pm
    packages/libsub-exporter-perl/trunk/inc/Module/Install/Can.pm
    packages/libsub-exporter-perl/trunk/inc/Module/Install/Fetch.pm
    packages/libsub-exporter-perl/trunk/inc/Module/Install/Makefile.pm
    packages/libsub-exporter-perl/trunk/inc/Module/Install/Metadata.pm
    packages/libsub-exporter-perl/trunk/inc/Module/Install/Win32.pm
    packages/libsub-exporter-perl/trunk/inc/Module/Install/WriteAll.pm
    packages/libsub-exporter-perl/trunk/lib/Sub/Exporter.pm
    packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Tutorial.pod
    packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Util.pm
    packages/libsub-exporter-perl/trunk/t/real-export-setup.t

Modified: packages/libsub-exporter-perl/trunk/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/Changes?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/Changes (original)
+++ packages/libsub-exporter-perl/trunk/Changes Tue Apr 24 11:47:57 2007
@@ -1,4 +1,13 @@
 Revision history for Sub-Exporter
+
+0.974   2007-04-22
+        fix a bug that didn't mind trying to export a routine that didn't exist
+        in the exporting package; this caused Sub::Install to give the
+        unhelpful message "argument 'code' is not optional"
+
+0.973   2007-02-02
+        document changes made in 0.972
+        minor code changes for readability
 
 0.972   2006-12-05
         allow exporter config to provide name (via string ref) of generator for

Modified: packages/libsub-exporter-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/META.yml?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/META.yml (original)
+++ packages/libsub-exporter-perl/trunk/META.yml Tue Apr 24 11:47:57 2007
@@ -1,7 +1,11 @@
+--- 
 author: Ricardo SIGNES <rjbs at cpan.org>
 distribution_type: module
-generated_by: Module::Install version 0.64
+generated_by: Module::Install version 0.65
 license: perl
+meta-spec: 
+  url: http://module-build.sourceforge.net/META-spec-v1.3.html
+  version: 1.3
 name: Sub-Exporter
 no_index: 
   directory: 
@@ -11,4 +15,4 @@
   Data::OptList: 0.1
   Params::Util: 0.14
   Sub::Install: 0.92
-version: 0.972
+version: 0.974

Modified: packages/libsub-exporter-perl/trunk/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/inc/Module/Install.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/inc/Module/Install.pm (original)
+++ packages/libsub-exporter-perl/trunk/inc/Module/Install.pm Tue Apr 24 11:47:57 2007
@@ -28,7 +28,7 @@
     # This is not enforced yet, but will be some time in the next few
     # releases once we can make sure it won't clash with custom
     # Module::Install extensions.
-    $VERSION = '0.64';
+    $VERSION = '0.65';
 }
 
 # Whether or not inc::Module::Install is actually loaded, the

Modified: packages/libsub-exporter-perl/trunk/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/inc/Module/Install/Base.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/inc/Module/Install/Base.pm (original)
+++ packages/libsub-exporter-perl/trunk/inc/Module/Install/Base.pm Tue Apr 24 11:47:57 2007
@@ -1,7 +1,7 @@
 #line 1
 package Module::Install::Base;
 
-$VERSION = '0.64';
+$VERSION = '0.65';
 
 # Suspend handler for "redefined" warnings
 BEGIN {

Modified: packages/libsub-exporter-perl/trunk/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/inc/Module/Install/Can.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/inc/Module/Install/Can.pm (original)
+++ packages/libsub-exporter-perl/trunk/inc/Module/Install/Can.pm Tue Apr 24 11:47:57 2007
@@ -11,7 +11,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.64';
+	$VERSION = '0.65';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: packages/libsub-exporter-perl/trunk/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/inc/Module/Install/Fetch.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/inc/Module/Install/Fetch.pm (original)
+++ packages/libsub-exporter-perl/trunk/inc/Module/Install/Fetch.pm Tue Apr 24 11:47:57 2007
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.64';
+	$VERSION = '0.65';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: packages/libsub-exporter-perl/trunk/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/inc/Module/Install/Makefile.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/inc/Module/Install/Makefile.pm (original)
+++ packages/libsub-exporter-perl/trunk/inc/Module/Install/Makefile.pm Tue Apr 24 11:47:57 2007
@@ -7,7 +7,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.64';
+	$VERSION = '0.65';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -136,9 +136,13 @@
                 . "but we need version >= $perl_version";
     }
 
+    $args->{INSTALLDIRS} = $self->installdirs;
+
     my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
-    if ($self->admin->preop) {
-        $args{dist} = $self->admin->preop;
+
+    my $user_preop = delete $args{dist}->{PREOP};
+    if (my $preop = $self->admin->preop($user_preop)) {
+        $args{dist} = $preop;
     }
 
     my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
@@ -205,4 +209,4 @@
 
 __END__
 
-#line 334
+#line 338

Modified: packages/libsub-exporter-perl/trunk/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/inc/Module/Install/Metadata.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/inc/Module/Install/Metadata.pm (original)
+++ packages/libsub-exporter-perl/trunk/inc/Module/Install/Metadata.pm Tue Apr 24 11:47:57 2007
@@ -6,14 +6,14 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.64';
+	$VERSION = '0.65';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
 
 my @scalar_keys = qw{
     name module_name abstract author version license
-    distribution_type perl_version tests
+    distribution_type perl_version tests installdirs
 };
 
 my @tuple_keys = qw{
@@ -56,6 +56,11 @@
     };
 }
 
+sub install_as_core   { $_[0]->installdirs('perl')   }
+sub install_as_cpan   { $_[0]->installdirs('site')   }
+sub install_as_site   { $_[0]->installdirs('site')   }
+sub install_as_vendor { $_[0]->installdirs('vendor') }
+
 sub sign {
     my $self = shift;
     return $self->{'values'}{'sign'} if defined wantarray and !@_;
@@ -279,9 +284,11 @@
 
     if (
         $self->_slurp($file) =~ m/
-        =head \d \s+
-        (?:licen[cs]e|licensing|copyright|legal)\b
-        (.*?)
+        (
+            =head \d \s+
+            (?:licen[cs]e|licensing|copyright|legal)\b
+            .*?
+        )
         (=head\\d.*|=cut.*|)
         \z
     /ixms
@@ -298,6 +305,7 @@
             'LGPL'                                            => 'lgpl',
             'BSD'                                             => 'bsd',
             'Artistic'                                        => 'artistic',
+            'MIT'                                             => 'MIT',
         );
         while ( my ( $pattern, $license ) = splice( @phrases, 0, 2 ) ) {
             $pattern =~ s{\s+}{\\s+}g;

Modified: packages/libsub-exporter-perl/trunk/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/inc/Module/Install/Win32.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/inc/Module/Install/Win32.pm (original)
+++ packages/libsub-exporter-perl/trunk/inc/Module/Install/Win32.pm Tue Apr 24 11:47:57 2007
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.64';
+	$VERSION = '0.65';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: packages/libsub-exporter-perl/trunk/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/inc/Module/Install/WriteAll.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/inc/Module/Install/WriteAll.pm (original)
+++ packages/libsub-exporter-perl/trunk/inc/Module/Install/WriteAll.pm Tue Apr 24 11:47:57 2007
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.64';
+	$VERSION = '0.65';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: packages/libsub-exporter-perl/trunk/lib/Sub/Exporter.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/lib/Sub/Exporter.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/lib/Sub/Exporter.pm (original)
+++ packages/libsub-exporter-perl/trunk/lib/Sub/Exporter.pm Tue Apr 24 11:47:57 2007
@@ -14,13 +14,13 @@
 
 =head1 VERSION
 
-version 0.972
-
-  $Id: /my/cs/projects/export/trunk/lib/Sub/Exporter.pm 28841 2006-12-05T22:44:01.427395Z rjbs  $
+version 0.974
+
+  $Id: /my/cs/projects/Sub-Exporter/trunk/lib/Sub/Exporter.pm 31455 2007-04-22T13:38:51.095739Z rjbs  $
 
 =cut
 
-our $VERSION = '0.972';
+our $VERSION = '0.974';
 
 =head1 SYNOPSIS
 
@@ -176,7 +176,8 @@
   exports - a list of routines to provide for exporting; each routine may be
             followed by generator
   groups  - a list of groups to provide for exporting; each must be followed by
-            a list of exports, possibly with arguments for each export
+            either (a) a list of exports, possibly with arguments for each
+            export, or (b) a generator
   collectors - a list of names into which values are collected for use in
                routine generation; each name may be followed by a validator
 
@@ -190,13 +191,13 @@
   { exports =>
     { foo => undef, bar => undef, baz => undef, quux => \&quux_generator } }
 
-Generators are coderefs that return coderefs.  They are called with four
+Generators are code that return coderefs.  They are called with four
 parameters:
 
   $class - the class whose exporter has been called (the exporting class)
   $name  - the name of the export for which the routine is being build
  \%arg   - the arguments passed for this export
- \%coll  - the collections for this import
+ \%col   - the collections for this import
 
 Given the configuration in the L</SYNOPSIS>, the following C<use> statement:
 
@@ -215,6 +216,11 @@
 
 The returned coderef (C<$code>) would then be installed as C<make_narrow> in the
 calling package.
+
+Instead of providing a coderef in the configuration, a reference to a method
+name may be provided.  This method will then be called on the invocant of the
+C<import> method.  (In this case, we do not pass the C<$class> parameter, as it
+would be redundant.)
 
 =head2 Group Configuration
 
@@ -459,14 +465,13 @@
     delete $group_arg->{-prefix};
     delete $group_arg->{-suffix};
 
-    my $group;
-    if (Params::Util::_CODELIKE($exports)) {
-      $group = $exports->($class, $group_name, $group_arg, $collection);
-    } else {
-      $group = $class->$$exports($group_name, $group_arg, $collection);
-    }
+    my $group = Params::Util::_CODELIKE($exports)
+              ? $exports->($class, $group_name, $group_arg, $collection)
+              : $class->$$exports($group_name, $group_arg, $collection);
+
     Carp::croak qq(group generator "$group_name" did not return a hashref)
       if ref $group ne 'HASH';
+
     my $stuff = [ map { [ $_ => $group->{$_} ] } keys %$group ];
     return @{
       _expand_groups($class, $config, $stuff, $collection, $seen, $merge)
@@ -750,7 +755,11 @@
 sub _generate {
   my ($class, $generator, $name, $arg, $collection) = @_;
 
-  return $class->can($name) unless $generator;
+  if (not defined $generator) {
+    my $code = $class->can($name)
+      or Carp::croak "can't locate exported subroutine $name via $class";
+    return $code;
+  }
 
   # I considered making this "$class->$generator(" but it seems that
   # overloading precedence would turn an overloaded-as-code generator object

Modified: packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Tutorial.pod
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Tutorial.pod?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Tutorial.pod (original)
+++ packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Tutorial.pod Tue Apr 24 11:47:57 2007
@@ -5,7 +5,7 @@
 
 =head1 VERSION
 
-  $Id: /my/cs/projects/export/trunk/lib/Sub/Exporter/Tutorial.pod 1425 2006-08-14T17:02:44.651525Z rjbs  $
+  $Id$
 
 =head1 DESCRIPTION
 

Modified: packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Util.pm?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Util.pm (original)
+++ packages/libsub-exporter-perl/trunk/lib/Sub/Exporter/Util.pm Tue Apr 24 11:47:57 2007
@@ -11,7 +11,7 @@
 
 version 0.022
 
-  $Id: /my/cs/projects/export/trunk/lib/Sub/Exporter/Util.pm 28839 2006-12-05T21:48:53.932621Z rjbs  $
+  $Id$
 
 =cut
 

Modified: packages/libsub-exporter-perl/trunk/t/real-export-setup.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libsub-exporter-perl/trunk/t/real-export-setup.t?rev=5299&op=diff
==============================================================================
--- packages/libsub-exporter-perl/trunk/t/real-export-setup.t (original)
+++ packages/libsub-exporter-perl/trunk/t/real-export-setup.t Tue Apr 24 11:47:57 2007
@@ -12,7 +12,7 @@
 
 =cut
 
-use Test::More tests => 35;
+use Test::More tests => 37;
 
 BEGIN { use_ok('Sub::Exporter'); }
 
@@ -31,6 +31,20 @@
 
     Test::SubExporter::SETUP->import(':all');
     main::is(X(), "desired", "constructed importer (via -setup [LIST]) worked");
+  }
+
+  {
+    package Test::SubExporter::EXPORT_MISSING;
+    use Sub::Exporter -setup => [ qw(X) ];
+
+    package Test::SubExporter::SETUP::CONSUMER_OF_MISSING;
+
+    eval { Test::SubExporter::EXPORT_MISSING->import(':all') };
+    main::like(
+      $@,
+      qr/can't locate export/,
+      "croak if we're configured to export something that can't be found",
+    );
   }
 
   {




More information about the Pkg-perl-cvs-commits mailing list