MooX::SingleArg - Support single-argument instantiation.
Contents
Class Arguments
single_arg
__PACKAGE__->single_arg( 'foo' );
Use this to declare the "init_arg" of the single argument.
force_single_arg
__PACKAGE__->force_single_arg( 1 );
Causes single-argument processing to happen even if a hashref is passed in as the single argument.
Class Methods
has_single_arg
Returns true if "single_arg" has been called.
License
See "LICENSE" in MooX::BuildArgs.
perl v5.40.0 2024-12-31 MooX::SingleArg(3pm)
Name
MooX::SingleArg - Support single-argument instantiation.
See Also
• MooX::BuildArgs
• MooX::BuildArgsHooks
• MooX::MethodProxyArgs
• MooX::Rebuild
Support
See "SUPPORT" in MooX::BuildArgs.
Synopsis
package Foo;
use Moo;
with 'MooX::SingleArg';
Foo->single_arg('bar');
has bar => ( is=>'ro' );
my $foo = Foo->new( 'goo' );
print $foo->bar(); # goo
