DOKK / manpages / debian 11 / libmason-perl / Mason::Component::Moose.3pm.en
Mason::Component::Moose(3pm) User Contributed Perl Documentation Mason::Component::Moose(3pm)

Mason::Component::Moose - Moose policies and exports for Mason components

This module is automatically included in each generated Mason component class, and is equivalent to

    use CLASS;
    use Moose;
    use MooseX::HasDefaults::RW;
    use Method::Signatures::Simple;

To override the default behavior, subclass this class and specify it as "base_component_moose_class" to Mason::Interp.

For example, to use MooseX::StrictConstructor in every component:

    package My::Mason::Component::Moose;
    use Moose::Exporter;
    use MooseX::StrictConstructor ();
    use base qw(Mason::Component::Moose);
    sub init_meta {
        my $class = shift;
        $class->SUPER::init_meta(@_);
        MooseX::StrictConstructor->init_meta(@_);
    }
    ...
    my $interp = Mason::Interp->new(..., base_component_moose_class => 'My::Mason::Component::Moose');

Mason

Jonathan Swartz <swartz@pobox.com>

This software is copyright (c) 2012 by Jonathan Swartz.

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

2021-01-06 perl v5.32.0