in reply to Is there an andand for Perl like there is in Ruby?
Another way to think about it might be: why do you have to check that ShopperDueDate is true in the first place?
For example, you could have $shop->ShopperDueDate throw an exception if it's not true that it can('day_name'), then
eval { say $shop->ShopperDueDate->day_name };
Ok, I'm joking, but what about never allowing ->ShopperDueDate to be a non-DateTime object (or whatever). Like in Moose:
package Shop; use Moose; .... has 'ShopperDueDate' => (...., isa => 'DateTime', default => sub { Dat +eTime->new });
Now when $shop is initialized, you know that ShopperDueDate can call day_name, so you just write
say $shop->ShopperDueDate->day_name;
|
|---|