eliminate done_testing
[p5sagit/Import-Into.git] / lib / Import / Into.pm
CommitLineData
2afb5246 1package Import::Into;
2
3use strict;
4use warnings FATAL => 'all';
5
6our $VERSION = '1.0';
7
8my %importers;
9
10sub import::into {
11 my ($class, $target, @args) = @_;
12 $class->${\(
13 $importers{$target} ||= eval qq{
14 package $target;
15 sub { shift->import(\@_) };
16 } or die "Couldn't build importer for $target: $@"
17 )}(@args);
18}
19
201;
21
22=head1 NAME
23
24Import::Into - import packages into other packages
25
26=head1 SYNOPSIS
27
28 package My::MultiExporter;
29
30 use Thing1 ();
31 use Thing2 ();
32
33 sub import {
34 my $target = caller;
35 Thing1->import::into($target);
36 Thing2->import::into($target, qw(import arguments));
37 }
38
39=head1 AUTHOR
40
41mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>
42
43=head1 COPYRIGHT
44
45Copyright (c) 2010-2011 the Import::Into L</AUTHOR> and L</CONTRIBUTORS>
46as listed above.
47
48=head1 LICENSE
49
50This library is free software and may be distributed under the same terms
51as perl itself.