NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Thanks (Score:2)
A quick way to upgrade yourself from level 2 to 3 is reading http://juerd.nl/site.plp/perluniadvice [juerd.nl]
Re: (Score:2)
So, I've been thinking there need to be some standards for CPAN modules to declare if it accept/return strings or bytes. (If they need to handle both)
For instance, HTML::Parser has an instance method called utf8_mode [cpan.org].
Another example (that triggered me to write this entry) is Catalyst's uri_for() method [cpan.org]. At some release the developers changed the implementation to accept only strings (UTF-8 flagged or not) in its %query_values hash.
Based on the complaints and patches made by
Strings or bytes (Score:2)
A trap is the UTF-8 string, which is a byte string representing characters, and has "the flag" off (which to perluninewbies is confusing because this flag is called UTF8). Compare this with the result of pack "N*", LIST, which is a byte
Re:Strings or bytes (Score:2)
And also, I'm a bit afraid that you misunderstood what I meant with mention to bytes.pm. I didn't mean we should call "use bytes" in this situation to force string operations to be bytes-wise. Not at all.
I meant declaring "use bytes" *might be* a good way for programmers to tell the module authors "Hey I want this module to do whatever string operations as bytes, not as characters".
But obviously that has a side effect and might not be a good thing at all. But I like the idea of having a pragma or something to explicitly say "I DONT WANT UNICODE WISE HERE".
BTW, I find that BLOB module would be useful for other stuff too.
Reply to This
Parent
Re: (Score:2)
Experience has show so far that the only workable way of supporting both byte strings and text strings in your function, is to provide two separate functions, or a mecha
Re: (Score:2)