Revision history for Package-Variant
+ - add build_variant method on variable packages, to allow avoiding
+ importing a generator sub
- fix pragmas applied by modules listed in "importing" from leaking out
into unexpected scopes
}
*{"${variable}::install"} = sub {
goto &{$Variable{$variable}{install}};
- }
+ };
+ *{"${variable}::build_variant"} = sub {
+ shift;
+ $me->build_variant_of($variable, @_);
+ };
}
sub build_variant_of {
=back
+=head2 build_variant
+
+ use Some::Variant::Package ();
+ my $variant_package = Some::Variant::Package->build_variant( @arguments );
+
+This method is provided for you. It will generate a variant package
+and return its name, just like the generator sub provided by
+L</import>. This allows you to avoid importing anything into the
+consuming package.
+
=head1 C<Package::Variant> METHODS
These methods are available on C<Package::Variant> itself.
is_deeply [@imported], [qw( TestImportableA )],
'scalar import works';
+@imported = ();
+
+TestSingleImport::->build_variant;
+
+is_deeply [@imported], [qw( TestImportableA )],
+ 'build_variant works';
+
like exception {
Package::Variant->import(
importing => \'foo', subs => [qw( foo )],