Are you saying you can't return undef from BUILDARGS?
That would be nice. Unfortunately, it's a fatal exception that requires catching:
#!/usr/bin/perl -w use strict; package test; use Mouse; sub BUILDARGS { return undef } __PACKAGE__->meta->make_immutable(); my $eg = test->new(); print "All good!"; # nope...
BUILDARGS did not return a HASH reference at ./test.pl line 11.
..then return undef from new.
Yer not suppose to use your own "new", but I did try defining one and having it return undef. No errors, however, the object returned is still a hash ref, not undef:
package test; use Mouse; sub new { return undef } __PACKAGE__->meta->make_immutable(); my $eg = test->new(); print $eg;
test=HASH(0x2208f08)
In reply to Re^2: Moose: return null object
by halfcountplus
in thread Moose: return null object
by halfcountplus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |