MooseX::Prototype::Role::UseAsPrototype - role providing a use_as_prototype method
{ package Person; use Moose; with 'MooseX::Prototype::Role::UseAsPrototype'; has name => (is => 'rw', isa => 'Str'); has employer => (is => 'rw', isa => 'Str'); } package main; my $template = Person->new(employer => 'Government'); my $CivilServant = $template->use_as_prototype; my $bob = $CivilServant->new(name => 'Bob'); say $bob->name; # Bob say $bob->employer; # Government
$object->use_as_prototype
Works as per the function of the same name in MooseX::Prototype, but should be called as a method.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=MooseX-Prototype.
Object::Prototype, MooseX::Prototype.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2012 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install MooseX::Prototype, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::Prototype
CPAN shell
perl -MCPAN -e shell install MooseX::Prototype
For more information on module installation, please visit the detailed CPAN module installation guide.