X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FImport-Into.git;a=blobdiff_plain;f=lib%2FImport%2FInto.pm;h=84effea2d8164d5a4bb159361c69d75e33c4e82d;hp=c2ddbf8720a8f77fdfdb6d3b73c6dda0b6d6900d;hb=6e5223e6c0c3bdaf61ecd4ec09f875aa57d45dff;hpb=06bd142d875a918529a7e006cbddcd3cbddc11b9 diff --git a/lib/Import/Into.pm b/lib/Import/Into.pm index c2ddbf8..84effea 100644 --- a/lib/Import/Into.pm +++ b/lib/Import/Into.pm @@ -3,7 +3,7 @@ package Import::Into; use strict; use warnings FATAL => 'all'; -our $VERSION = '1.001001'; # 1.1.1 +our $VERSION = '1.002002'; # 1.2.2 sub _prelude { my $target = shift; @@ -40,7 +40,9 @@ sub unimport::out_of { } 1; - + +__END__ + =head1 NAME Import::Into - import packages into other packages @@ -83,11 +85,10 @@ Import::Into - import packages into other packages Thing1->unimport::out_of(scalar caller); } -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. +People wanting to re-export your module should also be using L. +Any exporter or pragma will work seamlessly. -Note: You do B need to make ayny changes to Thing1 to be able to call +Note: You do B need to make any changes to Thing1 to be able to call C 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). @@ -111,7 +112,8 @@ C provides global methods to make this painless. 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: +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 @@ -121,25 +123,32 @@ The target package to export to. =item filename -The apparent filename to export to. Some exporting modules, such as L or L, care about the filename they are being imported to. +The apparent filename to export to. Some exporting modules, such as +L or L, care about the filename they are being imported +to. =item line -The apparent line number to export to. To be combined with the C option. +The apparent line number to export to. To be combined with the C +option. =item level -The caller level to export to. This will automatically populate the C, C, and C options, making it the easiest most constent option. +The caller level to export to. This will automatically populate the +C, C, and C 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 line. +A version number to check for the module. The equivalent of specifying the +version number on a C line. =back =head2 $package->unimport::out_of( $target, @arguments ); -Equivalent to C, but dispatches to C<$package>'s C method instead of C. +Equivalent to C, but dispatches to C<$package>'s C +method instead of C. =head1 WHY USE THIS MODULE @@ -205,7 +214,7 @@ in the directive then need to be fetched using C: $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. +targeting 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 creates a global method @@ -253,6 +262,11 @@ you're receiving this from a parameter, I recommend using L: And that's it. +=head1 SEE ALSO + +I gave a lightning talk on this module (and L and L) at +L. + =head1 ACKNOWLEDGEMENTS Thanks to Getty for asking "how can I get C<< use strict; use warnings; >> @@ -276,3 +290,5 @@ as listed above. This library is free software and may be distributed under the same terms as perl itself. + +=cut