If "understanding Perl" isn't a choice, then it looks like you've got three choices.
- Modify your application where you meant zero but have undef.
- Use a hack like redefining undef via some Tie method, for those regions of your application where it's important.
- Find something other than Perl to do your work.
I mean, not to be rude or anything, but have you considered that there's a LOT of Perl code out there which would break badly if undef and zero were the same concept?
If you're using any modules in your application, they're going to be hosed. If your code is so insular that you're not using other people's modules, then it should be pretty straightforward to rewrite the code so it agrees with such fundamental Perl values.
-- [ e d @ h a l l e y . c c ]
| [reply] |
Dude, you've completely missed the point (again). No where did I propose making "0" and "undef" the same concept. All I want is to change the default STRINGIFICATION BEHAVIOUR of undef. Since you seem to be misunderstanding that, that means what happens when "undef" is interpolated inside a string. Currently when undef is interpolated inside a string it changes to ''. I want it to instead render as '0'. I'm not changing the fundamental concept of undef, just a display aspect of it.
Perhaps an example will illustrate my point. $u = URI->new('http://google.com'); $u is now a URI object. It's not a string containing a url, but when I interpolate it inside a string, it appears as a string containing a url. It's still a URI object, but it's rendered as a string.
As for breaking other modules, well, I have trouble believing that theres that many modules that test the stringification of undef if they wanted to test for undef, but even so, obviously the solution would have to be modular so it only applied to the current scope. use warnings; Would break far more code if it was indiscriminately applied to every module you used.
| [reply] [d/l] [select] |