Data::Inherited

Data::Inherited is a Perl module with hierarchy-wide accumulation of list and hash results.
Download

Data::Inherited Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Marcel Grnauer
  • Publisher web site:
  • http://search.cpan.org/~marcel/Module-Install-Template-0.05/lib/Module/Install/Template.pm

Data::Inherited Tags


Data::Inherited Description

Data::Inherited is a Perl module with hierarchy-wide accumulation of list and hash results. Data::Inherited is a Perl module with hierarchy-wide accumulation of list and hash results.SYNOPSIS package Foo; use base 'Data::Inherited'; use constant PROPERTIES => (qw/name address/); package Bar; use base 'Foo'; use constant PROPERTIES => (qw/age/); package main; my $bar = Bar->new; print "$_n" for $bar->every_list('PROPERTIES');prints name address ageThis is a mixin class. By inheriting from it you get two methods that are able to accumulate hierarchy-wide list and hash results.every_list(String $method_name, Bool ?$override_cache = 0)Takes as arguments a method name (mandatory) and a boolean indicating whether to override the cache (optional, off by default)Causes every method in the object's hierarchy with the given name to be invoked. The resulting list is the combined set of results from all the methods, pushed together in top-to-bottom order (hierarchy-wise).every_list() returns a list in list context and an array reference in scalar context.The result is cached (per calling package) and the next time the method is called from the same package with the same method argument, the cached result is returned. This is to speed up method calls, because internally this module uses NEXT, which is quite slow. It is expected that every_list() is used for methods returning static lists (object defaults, static class definitions and such). If you want to override the caching mechanism, you can provide the optional second argument. The result is cached in any case. Requirements: · Perl


Data::Inherited Related Software