class Foo { field $x :param = 0; field $y :param = 0; } sub Foo::create ( $class, %args ) { if ( $args{x} < 0 ) { return undef; } else { return $class->new( %args ); } } my $foo = Foo->create( x => $x, y => $y ) or do_some_error_handling();