basis - use base with import call
Version 0.05003
Usage is similar to base or parent:
package Baz; use basis qw/Foo bar/;
Or with arguments for import:
package Foo; use basis Bary => [go => "away"];
It uses Sub::Uplevel to do the construct
BEGIN { use base qw/Foo bal/; Foo->import; bal->import('tor'); };
transparently for the parent and child class.
If the classname is followed by a array reference, than the dereferenced array is used in the import call as argument.
Now it uses the import method from the class named in the global variable $basis::base. When not set from outside, this variable will be set during the first load of this module. It defaults to parent and as second alternative to base.
import
$basis::base
parent
base
The call of Sub::Uplevel might come to late, so uplevel will not work as expected. If you use this module, the same rule as for Sub::Uplevel applies:
uplevel
Use Sub::Uplevel as early as possible in your program.
Now this module croaks when Sub::Uplevel is not used earlier enough.
Sebastian Knapp, <rock@ccls-online.de>
<rock@ccls-online.de>
Please report any bugs or feature requests to bug-basis at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=basis. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.
bug-basis at rt.cpan.org
Thank you Michael G. Schwern for base and Sub::Uplevel. I hope this tiny add-on finds your blessing. Thank you David A Golden for maintenance and improvement of Sub::Uplevel.
Sub::Uplevel
Copyright 2006-2012 Computer-Leipzig, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install basis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm basis
CPAN shell
perl -MCPAN -e shell install basis
For more information on module installation, please visit the detailed CPAN module installation guide.