Subject: | conflict MooseX::StrictConstructor and MooseX::MultiInitArg |
Date: | Thu, 4 Jun 2009 19:37:08 +0400 |
To: | bug-moosex-strictconstructor [...] rt.cpan.org |
From: | Konstantin [...] Tokar.RU |
Здравствуйте, Frodwith.
I found conflict MooseX::StrictConstructor and MooseX::MultiInitArg.
MooseX:: StrictConstructor it is necessary that unknown argument
IMOnum1 caused an exception, but its use leads to an error.
Sample:
#!perl -w
use strict;
package LRIT::Data;
use strict;
use Moose;
use Moose::Util::TypeConstraints;
use MooseX::MultiInitArg;
#use MooseX::StrictConstructor; - uncomment for error
subtype LRITImoNumType => as 'Str' => where { /^\d{7}$/o } =>
message { "Неправильный формат IMO number: '$_'" };
sub dump {
my $self = shift;
foreach my $key ( sort keys %$self ) {
print STDERR "'$key' => '$self->{$key}'\n";
} ## end foreach my $key ( sort keys...
} ## end sub dump
package LRIT::Data::IMOnum_LRITID;
use strict;
use Moose;
use MooseX::MultiInitArg;
extends qw[ LRIT::Data ];
has 'imonum' => (
metaclass => 'MultiInitArg',
is => 'rw',
isa => 'LRITImoNumType',
required => 1,
init_args => [qw( IMOnum)],
);
package main;
my $parent = new LRIT::Data::IMOnum_LRITID( IMOnum1 => '1001001',, IMOnum => '1001002', );
$parent->dump();
--
С уважением,
Konstantin mailto:Konstantin@Tokar.RU