Treex::Core::RememberArgs - role for remembering constructor's arguments
version 2.20160629
package MyClass; use Moose; with 'Treex::Core::RememberArgs'; has num => (is=>'rw'); 1; package Main; use MyClass; my $object = MyClass->({foo=>'bar baz', num=>42}); say $object->args_str; # prints # foo='bar baz' num=42 my $foo = $object->args->{foo};
Moose role that saves all arguments that were passed to the constructor. These arguments are then available either as a hashref in attribute args or as a string in form arg1=value1 arg2=val2 ... in attribute args_str. Values containing spaces are enclosed in single quotes (and quotes inside the value escaped).
args
args_str
Unlike MooseX::SlurpyConstructor, this role stores also the arguments which are defined as attributes of the class (num in the Synopsis).
num
Expected use cases: Treex scenarios need to serialize all the parameters and propagate them to nested scenarios. See e.g. Treex::Scen::EN2CS.
hash ref with the original arguments
stringified original arguments
MooseX::SlurpyConstructor
MooseX::StrictConstructor
Martin Popel <popel@ufal.mff.cuni.cz>
Copyright © 2015 by Institute of Formal and Applied Linguistics, Charles University in Prague This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Treex::Core, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Treex::Core
CPAN shell
perl -MCPAN -e shell install Treex::Core
For more information on module installation, please visit the detailed CPAN module installation guide.