Hello community,

here is the log from the commit of package perl-Import-Into for 
openSUSE:Factory checked in at 2014-03-25 13:25:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Import-Into (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Import-Into.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Import-Into"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Import-Into/perl-Import-Into.changes        
2013-08-06 11:04:21.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Import-Into.new/perl-Import-Into.changes   
2014-03-25 13:25:34.000000000 +0100
@@ -1,0 +2,8 @@
+Sat Mar 22 19:05:03 UTC 2014 - [email protected]
+
+- updated to 1.002001
+  - fix tests and Makefile.PL to support perl 5.6
+  - allow specifying by caller level, as well as specifying file, line,
+    and version
+
+-------------------------------------------------------------------

Old:
----
  Import-Into-1.001001.tar.gz

New:
----
  Import-Into-1.002001.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Import-Into.spec ++++++
--- /var/tmp/diff_new_pack.gtKrCS/_old  2014-03-25 13:25:34.000000000 +0100
+++ /var/tmp/diff_new_pack.gtKrCS/_new  2014-03-25 13:25:34.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Import-Into
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,21 +17,18 @@
 
 
 Name:           perl-Import-Into
-Version:        1.001001
+Version:        1.002001
 Release:        0
 %define cpan_name Import-Into
 Summary:        import packages into other packages
 License:        Artistic-1.0 or GPL-1.0+
 Group:          Development/Libraries/Perl
 Url:            http://search.cpan.org/dist/Import-Into/
-Source:         
http://www.cpan.org/authors/id/E/ET/ETHER/%{cpan_name}-%{version}.tar.gz
+Source:         
http://www.cpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz
 BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  perl
 BuildRequires:  perl-macros
-#BuildRequires: perl(Distar)
-#BuildRequires: perl(Import::Into)
-#BuildRequires: perl(MultiExporter)
 %{perl_requires}
 
 %description
@@ -39,100 +36,11 @@
 Sub::Exporter manpage, some use the Moose::Exporter manpage, some use the
 Exporter::Declare manpage ... and some things are pragmas.
 
-If you want to re-export other things, you have to know which is which. the
-Exporter manpage subclasses provide export_to_level, but if they overrode
-their import method all bets are off. the Sub::Exporter manpage provides an
-into parameter but figuring out something used it isn't trivial. Pragmas
-need to have their 'import' method called directly since they affect the
-current unit of compilation.
+Exporting on someone else's behalf is harder. The exporters don't provide a
+consistent API for this, and pragmas need to have their import method
+called directly, since they effect the current unit of compilation.
 
-It's ... annoying.
-
-However, there is an approach that actually works for all of these types.
-
-  eval "package $target; use $thing;"
-
-will work for anything checking caller, which is everything except pragmas.
-But it doesn't work for pragmas - pragmas need:
-
-  $thing->import;
-
-because they're designed to affect the code currently being compiled - so
-within an eval, that's the scope of the eval itself, not the module that
-just 'use'd you - so
-
-  sub import {
-    eval "use strict;"
-  }
-
-doesn't do what you wanted, but
-
-  sub import {
-    strict->import;
-  }
-
-will apply the strict manpage to the calling file correctly.
-
-Of course, now you have two new problems - first, that you still need to
-know if something's a pragma, and second that you can't use either of these
-approaches alone on something like the Moose manpage or the Moo manpage
-that's both an exporter and a pragma.
-
-So, the complete solution is:
-
-  my $sub = eval "package $target; sub { shift->import(\@_) }";
-  $sub->($thing, @import_args);
-
-which means that import is called from the right place for pragmas to take
-effect, and from the right package for caller checking to work - and so
-behaves correctly for all types of exporter, for pragmas, and for hybrids.
-
-Remembering all this, however, is excessively irritating. So I wrote a
-module so I didn't have to anymore. Loading the Import::Into manpage
-creates a global method 'import::into' which you can call on any package to
-import it into another package. So now you can simply write:
-
-  use Import::Into;
-
-  $thing->import::into($target, @import_args);
-
-This works because of how perl resolves method calls - a call to a simple
-method name is resolved against the package of the class or object, so
-
-  $thing->method_name(@args);
-
-is roughly equivalent to:
-
-  my $code_ref = $thing->can('method_name');
-  $code_ref->($thing, @args);
-
-while if a '::' is found, the lookup is made relative to the package name
-(i.e. everything before the last '::') so
-
-  $thing->Package::Name::method_name(@args);
-
-is roughly equivalent to:
-
-  my $code_ref = Package::Name->can('method_name');
-  $code_ref->($thing, @args);
-
-So since the Import::Into manpage defines a method 'into' in package
-'import' the syntax reliably calls that.
-
-For more craziness of this order, have a look at the article I wrote at the
-http://shadow.cat/blog/matt-s-trout/madness-with-methods manpage which
-covers coderef abuse and the '${\...}' syntax.
-
-Final note: You do still need to ensure that you already loaded '$thing' -
-if you're receiving this from a parameter, I recommend using the
-Module::Runtime manpage:
-
-  use Import::Into;
-  use Module::Runtime qw(use_module);
-
-  use_module($thing)->import::into($target, @import_args);
-
-And that's it.
+'Import::Into' provides global methods to make this painless.
 
 %prep
 %setup -q -n %{cpan_name}-%{version}

++++++ Import-Into-1.001001.tar.gz -> Import-Into-1.002001.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Import-Into-1.001001/Changes 
new/Import-Into-1.002001/Changes
--- old/Import-Into-1.001001/Changes    2013-03-26 05:08:26.000000000 +0100
+++ new/Import-Into-1.002001/Changes    2014-03-04 20:49:58.000000000 +0100
@@ -1,5 +1,14 @@
+Revision history for Import-Into
+
+1.002001 - 2014-03-04
+  - fix tests and Makefile.PL to support perl 5.6
+
+1.002000 - 2013-12-10
+  - allow specifying by caller level, as well as specifying file, line,
+    and version
+
 1.001001 - 2013-03-25
-  - fix NAME in Makefile.PL (RT#84211)
+  - fix NAME in Makefile.PL (RT#84207)
 
 1.001000 - 2012-05-12
   - add unimport::out_of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Import-Into-1.001001/META.json 
new/Import-Into-1.002001/META.json
--- old/Import-Into-1.001001/META.json  2013-03-26 05:08:35.000000000 +0100
+++ new/Import-Into-1.002001/META.json  2014-03-04 20:50:06.000000000 +0100
@@ -1,10 +1,10 @@
 {
-   "abstract" : "import packages into other packages ",
+   "abstract" : "import packages into other packages",
    "author" : [
       "mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter 
version 2.120921",
+   "generated_by" : "ExtUtils::MakeMaker version 6.9, CPAN::Meta::Converter 
version 2.133380",
    "license" : [
       "perl_5"
    ],
@@ -36,10 +36,15 @@
    },
    "release_status" : "stable",
    "resources" : {
-      "homepage" : 
"http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Import-Into.git";,
+      "bugtracker" : {
+         "mailto" : "[email protected]",
+         "web" : 
"https://rt.cpan.org/Public/Dist/Display.html?Name=Import-Into";
+      },
       "repository" : {
-         "url" : "git://git.shadowcat.co.uk/p5sagit/Import-Into.git"
+         "type" : "git",
+         "url" : "git://git.shadowcat.co.uk/p5sagit/Import-Into.git",
+         "web" : 
"http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Import-Into.git";
       }
    },
-   "version" : "1.001001"
+   "version" : "1.002001"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Import-Into-1.001001/META.yml 
new/Import-Into-1.002001/META.yml
--- old/Import-Into-1.001001/META.yml   2013-03-26 05:08:35.000000000 +0100
+++ new/Import-Into-1.002001/META.yml   2014-03-04 20:50:06.000000000 +0100
@@ -1,17 +1,17 @@
 ---
-abstract: 'import packages into other packages '
+abstract: 'import packages into other packages'
 author:
   - 'mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>'
 build_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 configure_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 
2.120921'
+generated_by: 'ExtUtils::MakeMaker version 6.9, CPAN::Meta::Converter version 
2.133380'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Import-Into
 no_index:
   directory:
@@ -19,6 +19,6 @@
     - inc
 requires: {}
 resources:
-  homepage: 
http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Import-Into.git
+  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Import-Into
   repository: git://git.shadowcat.co.uk/p5sagit/Import-Into.git
-version: 1.001001
+version: '1.002001'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Import-Into-1.001001/Makefile.PL 
new/Import-Into-1.002001/Makefile.PL
--- old/Import-Into-1.001001/Makefile.PL        2013-03-26 05:06:42.000000000 
+0100
+++ new/Import-Into-1.002001/Makefile.PL        2014-03-04 15:22:15.000000000 
+0100
@@ -1,6 +1,5 @@
 use strict;
 use warnings FATAL => 'all';
-use 5.008001;
 use ExtUtils::MakeMaker;
 (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
 
@@ -11,12 +10,19 @@
   LICENSE => 'perl',
 
   META_MERGE => {
+    'meta-spec' => { version => 2 },
     dynamic_config => 0,
-
     resources => {
       # r/w: [email protected]:Import-Into.git
-      repository => 'git://git.shadowcat.co.uk/p5sagit/Import-Into.git',
-      homepage => 
'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Import-Into.git',
+      repository => {
+        url => 'git://git.shadowcat.co.uk/p5sagit/Import-Into.git',
+        web => 
'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Import-Into.git',
+        type => 'git',
+      },
+      bugtracker => {
+          mailto => '[email protected]',
+          web => 
'https://rt.cpan.org/Public/Dist/Display.html?Name=Import-Into',
+      },
     },
 
   },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Import-Into-1.001001/README 
new/Import-Into-1.002001/README
--- old/Import-Into-1.001001/README     2013-03-26 05:08:35.000000000 +0100
+++ new/Import-Into-1.002001/README     2014-03-04 20:50:06.000000000 +0100
@@ -9,57 +9,95 @@
       use Thing1 ();
       use Thing2 ();
 
+      # simple
+      sub import {
+        Thing1->import::into(scalar caller);
+      }
+
+      # multiple
       sub import {
         my $target = caller;
         Thing1->import::into($target);
         Thing2->import::into($target, qw(import arguments));
       }
 
-    Note: you don't need to do anything more clever than this provided you
-    document that people wanting to re-export your module should also be
-    using Import::Into. In fact, for a single module you can simply do:
-
+      # by level
       sub import {
-        ...
-        Thing1->import::into(scalar caller);
+        Thing1->import::into(1);
       }
 
-    Notably, this works:
-
+      # with exporter
       use base qw(Exporter);
-
       sub import {
         shift->export_to_level(1);
-        Thing1->import::into(scalar caller);
+        Thing1->import::into(1);
       }
 
-    Note 2: You do not need to do anything to Thing1 to be able to call
-    "import::into" on it. This is a global method, and is callable on any
-    package (and in fact on any object as well, although it's rarer that
-    you'd want to do that).
-
-    Finally, we also provide an "unimport::out_of" to allow the exporting of
-    the effect of "no":
-
-      # unimport::out_of was added in 1.1.0 (1.001000)
+      # no My::MultiExporter == no Thing1
       sub unimport {
-        Moose->unimport::out_of(scalar caller); # no MyThing == no Moose
+        Thing1->unimport::out_of(scalar caller);
       }
 
-    If how and why this all works is of interest to you, please read on to
-    the description immediately below.
+    People wanting to re-export your module should also be using
+    Import::Into. Any exporter or pragma will work seamlessly.
+
+    Note: You do not need to make any changes to Thing1 to be able to call
+    "import::into" on it. This is a global method, and is callable on any
+    package (and in fact on any object as well, although it's rarer that
+    you'd want to do that).
 
 DESCRIPTION
     Writing exporters is a pain. Some use Exporter, some use Sub::Exporter,
     some use Moose::Exporter, some use Exporter::Declare ... and some things
     are pragmas.
 
-    If you want to re-export other things, you have to know which is which.
-    Exporter subclasses provide export_to_level, but if they overrode their
-    import method all bets are off. Sub::Exporter provides an into parameter
-    but figuring out something used it isn't trivial. Pragmas need to have
-    their "import" method called directly since they affect the current unit
-    of compilation.
+    Exporting on someone else's behalf is harder. The exporters don't
+    provide a consistent API for this, and pragmas need to have their import
+    method called directly, since they effect the current unit of
+    compilation.
+
+    "Import::Into" provides global methods to make this painless.
+
+METHODS
+  $package->import::into( $target, @arguments );
+    A global method, callable on any package. Imports the given package into
+    $target. @arguments are passed along to the package's import method.
+
+    $target can be an package name to export to, an integer for the caller
+    level to export to, or a hashref with the following options:
+
+    package
+        The target package to export to.
+
+    filename
+        The apparent filename to export to. Some exporting modules, such as
+        autodie or strictures, care about the filename they are being
+        imported to.
+
+    line
+        The apparent line number to export to. To be combined with the
+        "filename" option.
+
+    level
+        The caller level to export to. This will automatically populate the
+        "package", "filename", and "line" options, making it the easiest
+        most constent option.
+
+    version
+        A version number to check for the module. The equivalent of
+        specifying the version number on a "use" line.
+
+  $package->unimport::out_of( $target, @arguments );
+    Equivalent to "import::into", but dispatches to $package's "unimport"
+    method instead of "import".
+
+WHY USE THIS MODULE
+    The APIs for exporting modules aren't consistent. Exporter subclasses
+    provide export_to_level, but if they overrode their import method all
+    bets are off. Sub::Exporter provides an into parameter but figuring out
+    something used it isn't trivial. Pragmas need to have their "import"
+    method called directly since they affect the current unit of
+    compilation.
 
     It's ... annoying.
 
@@ -94,7 +132,7 @@
     these approaches alone on something like Moose or Moo that's both an
     exporter and a pragma.
 
-    So, the complete solution is:
+    So, a solution for that is:
 
       my $sub = eval "package $target; sub { shift->import(\@_) }";
       $sub->($thing, @import_args);
@@ -104,6 +142,23 @@
     and so behaves correctly for all types of exporter, for pragmas, and for
     hybrids.
 
+    Additionally, some import routines check the filename they are being
+    imported to. This can be dealt with by generating a #line directive in
+    the eval, which will change what "caller" reports for the filename when
+    called in the importer. The filename and line number to use in the
+    directive then need to be fetched using "caller":
+
+      my ($target, $file, $line) = caller(1);
+      my $sub = eval qq{
+        package $target;
+      #line $line "$file"
+        sub { shift->import(\@_) }
+      };
+      $sub->($thing, @import_args);
+
+    And you need to switch between these implementations depending on if you
+    are targetting a specific package, or something in your call stack.
+
     Remembering all this, however, is excessively irritating. So I wrote a
     module so I didn't have to anymore. Loading Import::Into creates a
     global method "import::into" which you can call on any package to import
@@ -152,11 +207,16 @@
 
     And that's it.
 
+ACKNOWLEDGEMENTS
+    Thanks to Getty for asking "how can I get "use strict; use warnings;"
+    turned on for all consumers of my code?" and then "why is this not a
+    module?!".
+
 AUTHOR
     mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>
 
 CONTRIBUTORS
-    None yet - maybe this software is perfect! (ahahahahahahahahaha)
+    haarg - Graham Knop (cpan:HAARG) <[email protected]>
 
 COPYRIGHT
     Copyright (c) 2012 the Import::Into "AUTHOR" and "CONTRIBUTORS" as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Import-Into-1.001001/lib/Import/Into.pm 
new/Import-Into-1.002001/lib/Import/Into.pm
--- old/Import-Into-1.001001/lib/Import/Into.pm 2013-03-26 05:07:35.000000000 
+0100
+++ new/Import-Into-1.002001/lib/Import/Into.pm 2014-03-04 20:48:36.000000000 
+0100
@@ -3,34 +3,49 @@
 use strict;
 use warnings FATAL => 'all';
 
-our $VERSION = '1.001001'; # 1.1.1
+our $VERSION = '1.002001'; # 1.2.1
 
-my %importers;
-
-sub _importer {
+sub _prelude {
   my $target = shift;
-  \($importers{$target} ||= eval qq{
-    package $target;
-    sub { my \$m = splice \@_, 1, 1; shift->\$m(\@_) };
-  } or die "Couldn't build importer for $target: $@")
+  my ($package, $file, $line, $level)
+    = ref $target         ? @{$target}{qw(package filename line)}
+    : $target =~ /[^0-9]/ ? ($target)
+                          : (undef, undef, undef, $target);
+  if (defined $level) {
+    my ($p, $fn, $ln) = caller($level + 2);
+    $package ||= $p;
+    $file    ||= $fn;
+    $line    ||= $ln;
+  }
+  qq{package $package;\n}
+    . ($file ? "#line $line \"$file\"\n" : '')
+}
+
+sub _make_action {
+  my ($action, $target) = @_;
+  my $version = ref $target && $target->{version};
+  my $ver_check = $version ? '$_[0]->VERSION($version);' : '';
+  eval _prelude($target).qq{sub { $ver_check shift->$action(\@_) }}
+    or die "Failed to build action sub to ${action} for ${target}: $@";
 }
-  
 
 sub import::into {
   my ($class, $target, @args) = @_;
-  $class->${_importer($target)}(import => @args);
+  _make_action(import => $target)->($class, @args);
 }
 
 sub unimport::out_of {
   my ($class, $target, @args) = @_;
-  $class->${_importer($target)}(unimport => @args);
+  _make_action(unimport => $target)->($class, @args);
 }
 
 1;
- 
+
+__END__
+
 =head1 NAME
 
-Import::Into - import packages into other packages 
+Import::Into - import packages into other packages
 
 =head1 SYNOPSIS
 
@@ -41,45 +56,42 @@
   use Thing1 ();
   use Thing2 ();
 
+  # simple
+  sub import {
+    Thing1->import::into(scalar caller);
+  }
+
+  # multiple
   sub import {
     my $target = caller;
     Thing1->import::into($target);
     Thing2->import::into($target, qw(import arguments));
   }
 
-Note: you don't need to do anything more clever than this provided you
-document that people wanting to re-export your module should also be using
-L<Import::Into>. In fact, for a single module you can simply do:
-
+  # by level
   sub import {
-    ...
-    Thing1->import::into(scalar caller);
+    Thing1->import::into(1);
   }
 
-Notably, this works:
-
+  # with exporter
   use base qw(Exporter);
-
   sub import {
     shift->export_to_level(1);
-    Thing1->import::into(scalar caller);
+    Thing1->import::into(1);
   }
 
-Note 2: You do B<not> need to do anything to Thing1 to be able to call
-C<import::into> on it. This is a global method, and is callable on any
-package (and in fact on any object as well, although it's rarer that you'd
-want to do that).
-
-Finally, we also provide an C<unimport::out_of> to allow the exporting of the
-effect of C<no>:
-
-  # unimport::out_of was added in 1.1.0 (1.001000)
+  # no My::MultiExporter == no Thing1
   sub unimport {
-    Moose->unimport::out_of(scalar caller); # no MyThing == no Moose
+    Thing1->unimport::out_of(scalar caller);
   }
 
-If how and why this all works is of interest to you, please read on to the
-description immediately below.
+People wanting to re-export your module should also be using L<Import::Into>.
+Any exporter or pragma will work seamlessly.
+
+Note: You do B<not> need to make any changes to Thing1 to be able to call
+C<import::into> on it. This is a global method, and is callable on any
+package (and in fact on any object as well, although it's rarer that you'd
+want to do that).
 
 =head1 DESCRIPTION
 
@@ -87,12 +99,64 @@
 some use L<Moose::Exporter>, some use L<Exporter::Declare> ... and some things
 are pragmas.
 
-If you want to re-export other things, you have to know which is which.
-L<Exporter> subclasses provide export_to_level, but if they overrode their
-import method all bets are off. L<Sub::Exporter> provides an into parameter
-but figuring out something used it isn't trivial. Pragmas need to have
-their C<import> method called directly since they affect the current unit of
-compilation.
+Exporting on someone else's behalf is harder.  The exporters don't provide a
+consistent API for this, and pragmas need to have their import method called
+directly, since they effect the current unit of compilation.
+
+C<Import::Into> provides global methods to make this painless.
+
+=head1 METHODS
+
+=head2 $package->import::into( $target, @arguments );
+
+A global method, callable on any package.  Imports the given package into
+C<$target>.  C<@arguments> are passed along to the package's import method.
+
+C<$target> can be an package name to export to, an integer for the
+caller level to export to, or a hashref with the following options:
+
+=over 4
+
+=item package
+
+The target package to export to.
+
+=item filename
+
+The apparent filename to export to.  Some exporting modules, such as
+L<autodie> or L<strictures>, care about the filename they are being imported
+to.
+
+=item line
+
+The apparent line number to export to.  To be combined with the C<filename>
+option.
+
+=item level
+
+The caller level to export to.  This will automatically populate the
+C<package>, C<filename>, and C<line> options, making it the easiest most
+constent option.
+
+=item version
+
+A version number to check for the module.  The equivalent of specifying the
+version number on a C<use> line.
+
+=back
+
+=head2 $package->unimport::out_of( $target, @arguments );
+
+Equivalent to C<import::into>, but dispatches to C<$package>'s C<unimport>
+method instead of C<import>.
+
+=head1 WHY USE THIS MODULE
+
+The APIs for exporting modules aren't consistent.  L<Exporter> subclasses
+provide export_to_level, but if they overrode their import method all bets
+are off.  L<Sub::Exporter> provides an into parameter but figuring out
+something used it isn't trivial. Pragmas need to have their C<import> method
+called directly since they affect the current unit of compilation.
 
 It's ... annoying.
 
@@ -126,7 +190,7 @@
 these approaches alone on something like L<Moose> or L<Moo> that's both
 an exporter and a pragma.
 
-So, the complete solution is:
+So, a solution for that is:
 
   my $sub = eval "package $target; sub { shift->import(\@_) }";
   $sub->($thing, @import_args);
@@ -135,6 +199,23 @@
 effect, and from the right package for caller checking to work - and so
 behaves correctly for all types of exporter, for pragmas, and for hybrids.
 
+Additionally, some import routines check the filename they are being imported
+to.  This can be dealt with by generating a L<#line directive|perlsyn/Plain
+Old Comments (Not!)> in the eval, which will change what C<caller> reports for
+the filename when called in the importer. The filename and line number to use
+in the directive then need to be fetched using C<caller>:
+
+  my ($target, $file, $line) = caller(1);
+  my $sub = eval qq{
+    package $target;
+  #line $line "$file"
+    sub { shift->import(\@_) }
+  };
+  $sub->($thing, @import_args);
+
+And you need to switch between these implementations depending on if you are
+targetting a specific package, or something in your call stack.
+
 Remembering all this, however, is excessively irritating. So I wrote a module
 so I didn't have to anymore. Loading L<Import::Into> creates a global method
 C<import::into> which you can call on any package to import it into another
@@ -181,13 +262,19 @@
 
 And that's it.
 
+=head1 ACKNOWLEDGEMENTS
+
+Thanks to Getty for asking "how can I get C<< use strict; use warnings; >>
+turned on for all consumers of my code?" and then "why is this not a
+module?!".
+
 =head1 AUTHOR
 
 mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>
 
 =head1 CONTRIBUTORS
 
-None yet - maybe this software is perfect! (ahahahahahahahahaha)
+haarg - Graham Knop (cpan:HAARG) <[email protected]>
 
 =head1 COPYRIGHT
 
@@ -198,3 +285,5 @@
 
 This library is free software and may be distributed under the same terms
 as perl itself.
+
+=cut
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Import-Into-1.001001/t/import_into.t 
new/Import-Into-1.002001/t/import_into.t
--- old/Import-Into-1.001001/t/import_into.t    2013-03-26 05:04:59.000000000 
+0100
+++ new/Import-Into-1.002001/t/import_into.t    2014-03-04 15:32:06.000000000 
+0100
@@ -20,31 +20,67 @@
     my $target = caller;
     warnings->import::into($target);
     MyExporter->import::into($target, 'thing');
+    CheckFile->import::into(1);
+
   }
 
   $INC{"MultiExporter.pm"} = 1;
 }
 
+my @checkcaller;
+my $checkversion;
 BEGIN {
 
+  package CheckFile;
+
+  sub import {
+    @checkcaller = caller;
+  }
+  sub VERSION {
+    $checkversion = $_[1];
+  }
+
+  $INC{"CheckFile.pm"} = 1;
+}
+
+eval q{
+
   package TestPackage;
 
-  no warnings;
+  no warnings FATAL => 'all';
 
+#line 1 "import_into_inline.pl"
   use MultiExporter;
 
   sub test {
     thing . undef
   }
-}
+  1;
+} or die $@;
 
 my @w;
 
 is(do {
   local $SIG{__WARN__} = sub { push @w, @_; };
-  TestPackage::test;
+  TestPackage::test();
 }, 'thing', 'returned thing ok');
 
 is(scalar @w, 1, 'Only one entry in @w');
 
 like($w[0], qr/uninitialized/, 'Correct warning');
+
+is $checkcaller[0], 'TestPackage', 'import by level has correct package';
+is $checkcaller[1], 'import_into_inline.pl', 'import by level has correct 
file';
+is $checkcaller[2], 1, 'import by level has correct line';
+
+CheckFile->import::into({
+  package  => 'ExplicitPackage',
+  filename => 'explicit-file.pl',
+  line     => 42,
+  version  => 219,
+});
+
+is $checkcaller[0], 'ExplicitPackage',  'import with hash has correct package';
+is $checkcaller[1], 'explicit-file.pl', 'import with hash has correct file';
+is $checkcaller[2], 42,                 'import with hash has correct line';
+is $checkversion, 219,                  'import with hash has correct version';

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to