-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 40aef9d
Showing
22 changed files
with
1,545 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
|
|||
[0.01] Sun Feb 18 17:33:18 CET 2007 | |||
- Initial Version | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
Changes | |||
inc/Module/Install.pm | |||
inc/Module/Install/Base.pm | |||
inc/Module/Install/Can.pm | |||
inc/Module/Install/Fetch.pm | |||
inc/Module/Install/Makefile.pm | |||
inc/Module/Install/Metadata.pm | |||
inc/Module/Install/Win32.pm | |||
inc/Module/Install/WriteAll.pm | |||
lib/namespace/clean.pm | |||
Makefile.PL | |||
MANIFEST This list of files | |||
META.yml | |||
README | |||
t/00-basic.t | |||
t/01-function-wipeout.t | |||
t/02-inheritance.t | |||
t/10-pod.t | |||
t/11-pod-coverage.t | |||
t/lib/ExporterTest.pm | |||
t/lib/FunctionWipeout.pm | |||
t/lib/Inheritance.pm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
abstract: Keep imports out of your namespace | |||
author: Robert 'phaylon' Sedlacek <rs@474.at> | |||
build_requires: | |||
FindBin: 0 | |||
Test::More: 0.62 | |||
distribution_type: module | |||
generated_by: Module::Install version 0.64 | |||
license: perl | |||
name: namespace-clean | |||
no_index: | |||
directory: | |||
- inc | |||
- t | |||
requires: | |||
Filter::EOF: 0.02 | |||
Symbol: 0 | |||
version: 0.01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
#!/usr/bin/env perl | |||
use warnings; | |||
use strict; | |||
|
|||
use inc::Module::Install; | |||
|
|||
name q{namespace-clean}; | |||
license q{perl}; | |||
author q{Robert 'phaylon' Sedlacek <rs@474.at>}; | |||
all_from q{lib/namespace/clean.pm}; | |||
|
|||
build_requires q{Test::More}, '0.62'; | |||
build_requires q{FindBin}, 0; | |||
|
|||
requires q{Filter::EOF}, '0.02'; | |||
requires q{Symbol}, 0; | |||
|
|||
WriteAll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,66 @@ | |||
NAME | |||
namespace::clean - Keep imports out of your namespace | |||
|
|||
VERSION | |||
0.01 | |||
|
|||
SYNOPSIS | |||
package Foo; | |||
use warnings; | |||
use strict; | |||
|
|||
use Carp qw(croak); # will be removed | |||
|
|||
sub bar { 23 } # will be removed | |||
|
|||
use namespace::clean; | |||
|
|||
sub baz { bar() } # still defined, 'bar' still bound | |||
|
|||
### Will print: | |||
# No | |||
# No | |||
# Yes | |||
print +(__PACKAGE__->can('croak') ? 'Yes' : 'No'), "\n"; | |||
print +(__PACKAGE__->can('bar') ? 'Yes' : 'No'), "\n"; | |||
print +(__PACKAGE__->can('baz') ? 'Yes' : 'No'), "\n"; | |||
|
|||
1; | |||
|
|||
DESCRIPTION | |||
When you define a function, or import one, into a Perl package, it will | |||
naturally also be available as a method. This does not per se cause | |||
problems, but it can complicate subclassing and, for example, plugin | |||
classes that are included by loading them as base classes. | |||
|
|||
The "namespace::clean" pragma will remove all previously declared or | |||
imported symbols at the end of the current package's compile cycle. This | |||
means that functions are already bound by their name, and calls to them | |||
still work. But they will not be available as methods on your class or | |||
instances. | |||
|
|||
METHODS | |||
You shouldn't need to call any of these. Just "use" the package at the | |||
appropriate place. | |||
|
|||
import | |||
Makes a snapshot of the current defined functions and registers a | |||
Filter::EOF cleanup routine to remove those symbols from the package at | |||
the end of the compile-time. | |||
|
|||
get_functions | |||
Takes a class as argument and returns all currently defined functions in | |||
it as a hash reference with the function name as key and a typeglob | |||
reference to the symbol as value. | |||
|
|||
SEE ALSO | |||
Filter::EOF | |||
|
|||
AUTHOR AND COPYRIGHT | |||
Robert 'phaylon' Sedlacek "<rs@474.at>", with many thanks to Matt S | |||
Trout for the inspiration on the whole idea. | |||
|
|||
LICENSE | |||
This program is free software; you can redistribute it and/or modify it | |||
under the same terms as perl itself. | |||
|
Oops, something went wrong.