Hi, mostly with DBIx::Class I have to often write:
my $foo = $bar->related1->related2->foo;While any of the related objects may not exist and return undef so it's necessary to test first or do an easy bad solution and use eval:
my $foo = eval{ $bar->related1->related2->foo };Which also means that when ever there is a typoo (for example misspelled relation name) inside eval {}, it's silently ignored.
And here is my question: Is there a module or an easy way to say Perl that in this given scope when ever method is called on undef return undef instead of an exception? Here is how it would look like:
my $foo = undef_is_undef { undef->bar };Thanks!
Jozef
In reply to undef is undef by jozef
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |