I was trying to overload classes to strings in perl. For example:
use MooseX::Declare;
class overloadingInPerl{
use overload '""' => sub {shift->printOut()};
method printOut(){
return "Overloading worked";
}
}
my $overloadingTrial = overloadingInPerl->new();
print $overloadingTrial;
prints out: overloadingInPerl=HASH(0x1f520fc)
want to print: Overloading worked
Any ideas?
You have to add the dirty trait to use overloading