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

MooX::MethodProxyArgs - Invoke code to populate static arguments.

    package Foo;
    use Moo;
    with 'MooX::MethodProxyArgs';
    has bar => (
        is => 'ro',
    );
    
    package main;
    
    sub divide {
        my ($class, $number, $divisor) = @_;
        return $number / $divisor;
    }
    
    my $foo = Foo->new( bar => ['$proxy', 'main', 'divide', 10, 2 ] );
    
    print $foo->bar(); # 5

This module munges the class's input arguments by replacing any method proxy values found with the result of calling the methods.

This is done using Config::MethodProxy. See that module for more information on how method proxies work.

  • MooX::BuildArgs
  • MooX::BuildArgsHooks
  • MooX::Rebuild
  • MooX::SingleArg

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