Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Number::Base::DWIM
delay parsing of based constants as long as possible.

Number::Base::DWIM - delay parsing of based constants as long as possible.


NAME

Number::Base::DWIM - delay parsing of based constants as long as possible.


SYNOPSIS


    use Numbers::Base::DWIM

    my $x = 011;

    print $x, "\n";  # prints 9

    print "$x\n";    # prints 011

    print oct($x)    # prints 011


DESCRIPTION

This module will delay parsing of based numeric constants (0b010101, 0655, 0xff) until the last possible moment. This means that if you use the constant as a string, then it will evaluate to the same form that the constant was declared in.

This module was developed after an discussion where some people found the behavior of perl -e 'print oct 011, "\n";' to be confusing. This module works around this by overloading the parsing of binary, hexidecimal and octal numeric constants. It then stores them in a dualvar, as provided by the Scalar::Util manpage.


NOTES

Originally this was implemented as a class, and the overload function returned an object with numification and stringification methods. Thanks to Brian D. Foy for suggesting that it use dualvar instead.


BUGS

Due to a bug in overload, constants inside of and eval '...' won't be handled specially.


AUTHOR

Clayton O'Neill <CMO@cpan.org>


COPYRIGHT

Copyright (c) 2006 by Clayton O'Neill

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy