You Here : Home > Linux

namespace::clean 0.11

OS Support:


Publisher Old version


March 19 2012


namespace::clean 0.11


namespace:: Clean is a Perl module for storing functions and import your package namespace.Keeping cleanWhen you define a function, or import one, into a Perl package, it will naturally also be available as a method. This does not mean to cause problems in itself, but it can complicate subclassing and, for example, plugin classes that are included via multiple inheritance by loading them as namespace classes.The Basic: pragma clean will remove all previously declared or imported Symbols at the end of the package being compiled cycle. The functions called in the package itself will still be bound by their names, but they will not appear as methods on your class or unimporting instances.By Route No, you can tell namespace:: Clean to begin collecting functions to use the following namespace:: clean; specification.You can use the indicator to say except namespace:: clean that you do not want to delete a certain function or method. A common use would be a module to export a method of importing and functions: ModuleExportingImport use; use namespace:: clean-except => [qw (import)]; If you just want to except a single sub, you can skip. For more than a value you must use a table removing reference.Explicitely functions when your scope is compiled is also possible to say explicitly namespace:: clean packages to remove when the surrounding field has finished compiling. For example: package foo; use strict; # blessed NOT available under my_class (use Scalar:: Util qw (blessed); use namespace:: clean QW (blessed); # return completely blessed blessed shift;) # blessed NOT using availableMooseWhen namespace:: clean with Moose you want to keep the method of Meta installed. Thus, your classes should look like: package Foo; use Moose; use namespace:: clean-except => 'meta', ... Same for moose: Role.Cleaning packagesYou others may say namespace:: clean that you want to clean another package instead of the import. To do this you must go to the-cleanee like this: package My:: MooseX:: namespace:: clean; use strict; use namespace:: clean () # no cleaning, just as import load (namespace:: Clean-> Import (-cleanee => scalar (caller),-except => 'meta',);) If you do not worry about namespace:: clean discover and - except logic, and you just want to delete the sub-routines, try "clean_subroutines" package. SYNOPSIS Foo, use warnings, use strict; use Carp qw (croak); # 'burst' will be removed sub bar (23) # 'bar' will be removed # remove all previously defined functions use namespace:: clean; sub baz (bar ()) # 'baz' still defined, 'bar' # always start with names related collection function from again, no namespace:: clean; sub quux (baz ()) # 'quux' will be removed # remove all functions defined after the 'no' unimport use namespace:: clean; # allows you to print: 'No', 'No', 'Yes' and 'n' print + (__PACKAGE__-> can ( 'die')? 'yes':' No ') "print + (__PACKAGE__-> can (' bar ')?' yes': 'No')" print + (__PACKAGE__-> can ( 'baz ')?' yes': 'No') "print + (__PACKAGE__-> can ( 'quux')? 'yes':' No ')," ", 1, Requirements: Perl ·

Related Downloads

Software Tags

Namespace::clean | Namespace::clean 0.11 | Namespace::clean Free Download | Namespace::clean Reviews | Download Namespace::clean

Size :