MooX::SingleArg(3pm)

MooX::SingleArg3pm

Support single-argument instantiation.

Usage

    package Foo;
    use Moo;
    with 'MooX::SingleArg';
    Foo->single_arg('bar');
    has bar => ( is=>'ro' );
    
    my $foo = Foo->new( 'goo' );
    print $foo->bar(); # goo

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.

Support

See "SUPPORT" in MooX::BuildArgs.

Releases

5 releases since Debian 9 (Stretch); the text changed 3 times.

  1. 9
  2. 10
  3. 11–12
  4. 13

Authors

See "AUTHORS" in MooX::BuildArgs.

License

See "LICENSE" in MooX::BuildArgs.

From libmoox-buildargs-perl 0.08-4 in Debian 13 (Trixie). Parsed by carta from the page's man source.