Acme::Acotie - Crash of Namespace


Acme-Acotie documentation Contained in the Acme-Acotie distribution.

Index


Code Index:

NAME

Top

Acme::Acotie - Crash of Namespace

SYNOPSIS

Top

  use Acme::Acotie;

DESCRIPTION

Top

Acme::Acotie is namespace crasher.

AUTHOR

Top

Kazuhiro Osawa <ko@yappo.ne.jp>

THANKS TO

Top

id:acotie Dan Kogai (s/spase/space/g)

REPOSITORY

Top

  svn co http://svn.coderepos.org/share/lang/perl/Acme-Acotie/trunk Acme-Acotie

Acme::Acotie is Subversion repository is hosted at http://coderepos.org/share/. patches and collaborators are welcome.

LICENSE

Top

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


Acme-Acotie documentation Contained in the Acme-Acotie distribution.

package Acme::Acotie;

use strict;
use warnings;
our $VERSION = '0.02';

use Class::Inspector;
use List::Util 'shuffle';

sub import {
    my $class = shift;
    my $pkg = caller;

    my @functions     = @{ Class::Inspector->functions($pkg) };
    my @function_refs = @{ Class::Inspector->function_refs($pkg) };
    my $num = scalar(@functions) - 1;
    my @idx = shuffle 0..$num;

    my $i = 0;
    for my $func (@functions) {
        no strict 'refs';
        no warnings;
        *{"$pkg\::$func"} = $function_refs[$idx[$i++]];
    }

}

1;
__END__