tag:blogger.com,1999:blog-4404522972176775500.post4394450214278024590..comments2023-06-12T18:05:09.048+02:00Comments on Perl-Uwe.com: Day 10: Can't call method "..." on an undefined valueUwehttp://www.blogger.com/profile/12178704398121428849noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-4404522972176775500.post-991587319979333782010-12-12T18:09:46.039+01:002010-12-12T18:09:46.039+01:00This little module of mine keeps garnering attenti...This little module of mine keeps garnering attention. Perl 5.14 will probably have syntax for this (probably &&->, though there is some bikeshedding about it).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4404522972176775500.post-86273613068352031832010-12-12T09:40:43.883+01:002010-12-12T09:40:43.883+01:00I handle this sort of thing by returning null obje...I handle this sort of thing by returning null objects that returns itself for every method called. If the result ends up with a null object, something went wrong. You can even spruce it up a bit to have the null object carry along the first error so you can inspect it.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4404522972176775500.post-41595597990668022502010-12-10T18:59:31.242+01:002010-12-10T18:59:31.242+01:00Roman, you are totally right. Scalar::Andand is ju...Roman, you are totally right. Scalar::Andand is just a "proof of concept". I do not use it myself. But I think it is a funny module. :)Uwehttps://www.blogger.com/profile/10575095551561928941noreply@blogger.comtag:blogger.com,1999:blog-4404522972176775500.post-64376170822280920192010-12-10T15:25:39.225+01:002010-12-10T15:25:39.225+01:00I am thinking what is the advantage against:
my $...I am thinking what is the advantage against:<br /><br />my $result = eval { $a->b->c };<br /><br />But I am glad to see that I am not only one who runs often into this "call on undefind value" problem.Romanhttp://bvr.github.comnoreply@blogger.com