Class::Method::Auto

Turn subroutine calls into class method calls
Download

Class::Method::Auto Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Bernhard Bauer
  • Publisher web site:
  • http://search.cpan.org/~bauerb/

Class::Method::Auto Tags


Class::Method::Auto Description

Turn subroutine calls into class method calls Class::Method::Auto is a Perl module that allows you to call inherited class methods directly without prefixing them with the class name.There are two methods of telling Class::Method::Auto which methods to call automatically: By explicitly giving it a list of method names or by specifying a filter for the methods.In the first case, Class::Method::Auto creates a subroutine in the importing package for every name in the list that unshift's the calling package name onto @_ and jumps to the method in the first package where is it defined. package Blurp; use Class::Method::Auto qw; # creates Blurp::bar and Blurp::bazIn the second case, you can specify a regular expression for the method names to be tested against or the string -attributes, which causes Class::Method::Auto to check whether the called method has the < method > attribute to make sure only real methods are called.When specifying a filter, the method AUTOLOAD is installed in the importing package for dispatching. package Foo; sub my_method :method { ... } sub no_method { ... } sub _private { ... } package Moose; use base 'Foo'; use Class::Method::Auto '-attributes', qr/^/; # now my_method(...) can be called, but not no_method or _privateSYNOPSIS # in Foo.pm package Foo; sub bar { ... } # in Baz.pm package Baz; use Class::Method::Auto 'bar'; use base 'Foo'; bar("Moose!"); # same as __PACKAGE__->bar("Moose!") Requirements: · Perl


Class::Method::Auto Related Software