0.56
* Moose
* Moose::Cookbook::Extending::Recipe2
- - Add a remove_keywords function so if you extend Moose
+ - Add a _remove_keywords function so if you extend Moose
you don't have to cargo cult Moose's unimport (Sartak)
* Moose
sub unimport {
my $class = _get_caller(@_);
- remove_keywords(
+ _remove_keywords(
source => __PACKAGE__,
package => $class,
keywords => [ keys %exports ],
}
-sub remove_keywords {
+sub _remove_keywords {
my ( %args ) = @_;
my $source = $args{source};
For more detail on this topic, see L<Moose::Cookbook::Extending::Recipe2>.
-=head2 B<remove_keywords>
-
-The remove_keywords method is called by Moose's C<unimport> to remove Moose's
-keywords from a package when C<no Moose> is used. If you extend Moose with
-new keywords, you should provide an C<unimport> that calls C<remove_keywords>
-to remove your sugar.
-
-C<remove_keywords> takes named parameters C<source> (to make sure that we
-don't remove keywords defined by somebody else), C<package> (from which we're
-removing keywords), and C<keywords> (an array reference of keyword names).
-
-For more detail on this topic, see L<Moose::Cookbook::Extending::Recipe2>.
-
=head1 CAVEATS
=over 4
sub unimport {
my $caller = caller();
- Moose::remove_keywords(
+ Moose::_remove_keywords(
source => __PACKAGE__,
package => $caller,
keywords => \@EXPORT,
can basically only have one Moose-alike module. This may be fixed in
the still-notional C<MooseX::Exporter> module someday.
-The C<unimport()> subroutine calls the C<remove_keywords> function
+The C<unimport()> subroutine calls the C<_remove_keywords> function
from Moose. This function removes only the keywords exported by
-this module. More precisely, C<remove_keywords> removes from the
+this module. More precisely, C<_remove_keywords> removes from the
C<package> package the keywords given by the C<keywords> argument
-that were created in the C<source> package.
+that were created in the C<source> package. This functionality may
+be deprecated if L<Sub::Exporter> begins providing it.
Finally, we have our C<has_table()> subroutine. This provides a bit of
sugar that looks a lot like C<has()>.