Thread

Posted on Fri Jan 26 17:24:40 2007 by gaetan
Extra parameter in new constructor
Hello all
If I execute the following program
package Foo; use strict; use warnings; use Object::InsideOut; my @attr :Field ; package main; my $obj = Foo->new('forbidden_attribute' => 'is accepted'); print $obj; 1;
No exception is raised
I didn't find any information about the correct behavior in the POD documentation
Could the OIO module raise an exception in such a situation ?
Thanks
Gaetan
Direct Responses: 4172 | Write a response
Posted on Fri Jan 26 19:35:23 2007 by jdhedden in response to 4167
Re: Extra parameter in new constructor
You only get an error if you're missing a mandatory arg, or if you supply an optional arg (as specified in an :InitArgs hash) without a 'Field' designation and without an :Init subroutine.

There's just no way to generally tell which parameters are used by which classes and in what manner. Further, if a class has no :Args or :InitArgs but does have :Init, then it gets all args.
Write a response