DOKK / manpages / debian 10 / libmoox-buildargs-perl / MooX::SingleArg.3pm.en
MooX::SingleArg(3pm) User Contributed Perl Documentation MooX::SingleArg(3pm)

MooX::SingleArg - Support single-argument instantiation.

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

    __PACKAGE__->single_arg( 'foo' );

Use this to declare the "init_arg" of the single argument.

    __PACKAGE__->force_single_arg( 1 );

Causes single-argument processing to happen even if a hashref is passed in as the single argument.

Returns true if "single_arg" has been called.

  • MooX::BuildArgs
  • MooX::BuildArgsHooks
  • MooX::MethodProxyArgs
  • MooX::Rebuild

Aran Clary Deltac <bluefeet@gmail.com>

Peter Pentchev <roam@ringlet.net>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2018-08-25 perl v5.26.2