MooX::BuildArgs − Save instantiation arguments for later use.
package Foo; use Moo; with 'MooX::BuildArgs'; has bar => (is => 'ro'); my $foo = Foo−>new( bar => 32 ); print $foo−>build_args−>{bar}; # 32
It is often useful to be able to access the arguments that were used to create an object in their unadulterated form, before any coercions or init_args have changed them. This Moo role provides the arguments via the "build_args" attribute.
Note that no attempt is made to weaken the args. So, if you use this module and you have attributes with "weak_ref" set the references will not be weakened within "build_args".
build_args
my $args_hashref = $object−>build_args();
Returns a hashref containing the captured arguments.
• |
MooX::BuildArgsHooks |
|||
• |
MooX::MethodProxyArgs |
|||
• |
MooX::Rebuild |
|||
• |
MooX::SingleArg |
Aran Clary Deltac <bluefeet AT gmail DOT com>
• |
Peter Pentchev <roam AT ringlet DOT net> |
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.