in reply to Re: Validating Regular Expression
in thread Validating Regular Expression
I think we can both agree that the interface you specify should depend on how you are going to use it.
That's entirely my point. One would use the result of validate as a boolean, so it should return a boolean. You suggested that it should return something that needs to be converted into a boolean first.
Use a bare return to return failure
Return an empty list can be useful to signal failure where a false value could be returned.
sub get { $engine->connect() or return (); return $engine->get(); } my $ok = ($data) = get();
That's not relevant here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Validating Regular Expression
by kennethk (Abbot) on Feb 15, 2011 at 17:53 UTC | |
by ikegami (Patriarch) on Feb 15, 2011 at 18:15 UTC |