UNIVERSAL::Acme - Because it's a METHOD, hoser.


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

Index


Code Index:

NAME

Top

UNIVERSAL::Acme -- Because it's a METHOD, hoser.

SYNOPSIS

Top

  use UNIVERSAL::Acme;
  UNIVERSAL::thing($obj, 'whatever');  # calls $obj->thing('whatever')

DESCRIPTION

Top

Tired of people who refuse to call functions as methods? Show 'em good with UNIVERSAL::Acme.

SEE ALSO

Top

UNIVERSAL::can, UNIVERSAL::isa, UNIVERSAL::ref.

AUTHOR

Top

Sean O'Rourke, <seano@cpan.org>

COPYRIGHT AND LICENSE

Top


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

package UNIVERSAL::Acme;

$VERSION = '0.01';

my %ORIG;
sub import {
    my @SAVE = grep !/[A-Z]/, keys %UNIVERSAL::;
    $ORIG{$_} = \&{'UNIVERSAL::'.$_} for @SAVE;
    delete $UNIVERSAL::{$_} for @SAVE;
}

{ package UNIVERSAL;
  sub AUTOLOAD {
      (my $al = $AUTOLOAD) =~ s/.*:://;
      if ($IN_UA) {
          if (exists $ORIG{$al}) {
              goto &{$ORIG{$al}};
          } else {
              local *UNIVERSAL::AUTOLOAD;
              goto &$AUTOLOAD;
          }
      } else {
          local $IN_UA = 1;
          eval { $_[0]->$al(@_[1..$#_]) }
      }
  }
}

1;
__END__