namespace::autoclean5.16 man page on MacOSX

Man page or keyword search:  
man Server   23457 pages
apropos Keyword Search (all sections)
Output format
MacOSX logo
[printable version]

namespace::autoclean(3User Contributed Perl Documentatinamespace::autoclean(3)

NAME
       namespace::autoclean - Keep imports out of your namespace

SYNOPSIS
	   package Foo;
	   use namespace::autoclean;
	   use Some::Package qw/imported_function/;

	   sub bar { imported_function('stuff') }

	   # later on:
	   Foo->bar;		   # works
	   Foo->imported_function; # will fail. imported_function got cleaned after compilation

DESCRIPTION
       When you import a function into a Perl package, it will naturally also
       be available as a method.

       The "namespace::autoclean" pragma will remove all imported symbols at
       the end of the current package's compile cycle. Functions called in the
       package itself will still be bound by their name, but they won't show
       up as methods on your class or instances.

       This module is very similar to namespace::clean, except it will clean
       all imported functions, no matter if you imported them before or after
       you "use"d the pragma. It will also not touch anything that looks like
       a method, according to "Class::MOP::Class::get_method_list".

       If you're writing an exporter and you want to clean up after yourself
       (and your peers), you can use the "-cleanee" switch to specify what
       package to clean:

	 package My::MooseX::namespace::autoclean;
	 use strict;

	 use namespace::autoclean (); # no cleanup, just load

	 sub import {
	     namespace::autoclean->import(
	       -cleanee => scalar(caller),
	     );
	 }

PARAMETERS
   -also => [ ITEM | REGEX | SUB, .. ]
   -also => ITEM
   -also => REGEX
   -also => SUB
       Sometimes you don't want to clean imports only, but also helper
       functions you're using in your methods. The "-also" switch can be used
       to declare a list of functions that should be removed additional to any
       imports:

	   use namespace::autoclean -also => ['some_function', 'another_function'];

       If only one function needs to be additionally cleaned the "-also"
       switch also accepts a plain string:

	   use namespace::autoclean -also => 'some_function';

       In some situations, you may wish for a more powerful cleaning solution.

       The "-also" switch can take a Regex or a CodeRef to match against local
       function names to clean.

	   use namespace::autoclean -also => qr/^_/

	   use namespace::autoclean -also => sub { $_ =~ m{^_} };

	   use namespace::autoclean -also => [qr/^_/ , qr/^hidden_/ ];

	   use namespace::autoclean -also => [sub { $_ =~ m/^_/ or $_ =~ m/^hidden/ }, sub { uc($_) == $_ } ];

SEE ALSO
       namespace::clean

       Class::MOP

       B::Hooks::EndOfScope

AUTHOR
       Florian Ragwitz <rafl@debian.org>

COPYRIGHT AND LICENSE
       This software is copyright (c) 2011 by Florian Ragwitz.

       This is free software; you can redistribute it and/or modify it under
       the same terms as the Perl 5 programming language system itself.

perl v5.16.2			  2011-08-24	       namespace::autoclean(3)
[top]

List of man pages available for MacOSX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net