Number::Fraction

Th. J. van Hoesel th.j.v.hoesel at gmail.com
Wed May 1 16:06:35 BST 2013


Hello,

As agreed upon with Dave Cross, I would make some really cool changes to his module Number::Fraction - I as former math teacher love fraction.

However, can someone point me out what is happening between lines 132 and 144 of Fraction.pm ? This part is the neatest part of the module, where it enables the module to use constants in your Perl programs.


Theo


my %_const_handlers =
  (q => sub { return __PACKAGE__->new($_[0]) || $_[1] });

=head2 import

Called when module is C<use>d. Use to optionally install constant
handler.

=cut

sub import {
  overload::constant %_const_handlers if $_[1] and $_[1] eq ':constants';
}



More information about the london.pm mailing list