Subject: | Get the canonical msisdn back out of the object? |
After constructing a Number::Phone object, how can I get the canonical
number back out? There is no $obj->number interface, despite this field
being implemented in some subclasses, and data does not seem to be
stored consistently across subclasses, even if I wanted to poke into the
object beyond the APIs, which I don't consider safe.
e.g. for UK numbers, it appears that the number itself is blessed as the
object:
perl -MNumber::Phone -MData::Dumper -wle'my $obj =
Number::Phone->new("+44 2087 712 924"); print Dumper($obj)'
$VAR1 = bless( do{\(my $o = '+442087712924')}, 'Number::Phone::UK' );
PS. It would also be enormously helpful if there was a string overload
on the object to access the number, e.g. for printing error messages:
my $num = Number::Phone->new("+44 2087 712 924");
die "Cannot use this number $num!";
(see perldoc overload for how to set this up.)