Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I go as low as Perl let's me go (system IO), and don't rely on anything that PerlIO might layer on top. If I do that, I don't have to peel back the layers of every onion and figure out what is happening and then compensate when necessary.
I understand. But, in Perl, sys functions are just not suitable for that. Consider:
use 5.022; use warnings; use Fcntl; use Devel::Peek; sysopen my $fh, 'out', O_WRONLY | O_CREAT; my $buffer = "\xFF\xFF\xFF"; utf8::upgrade($buffer); Dump $buffer; syswrite $fh, $buffer;
Folks, I don't know how to eliminate all unknowns, other than to use system IO.
Bypassing PerlIO is not enough; using system IO doesn't solve anything. And anyway, there are many ways for errors to appear - string concatenation, for instance... It doesn't really have much to do with IO per se.
Can anyone shed more light? Or is the answer to just go with PerlIO, "accept the defaults", trust in the decisions that are built into PerlIO, and let the chips fall where they may?
It seems to me that p5porters are strongly opposed to any explanations about how text in Perl actually works, which is too bad. Perl's "unified" model of text is a particularly leaky abstraction, IMO. Basically, p5porters advise "decode all inputs, encode all output" (using Encode, for example, or open my $fh, '<:encoding(SOME_ENCODING)', or binmode, or some such). Of course, in practice some strings cannot be decoded, or sometimes you don't want to decode/encode anything but some module that you use does that for you anyway (that's relatively recent examples actually posted on Perlmonks).

I'm not sure why they're opposed to document it... it's not like it's something difficult to understand. Why don't you ask them about it? If they're not actually against it, and just don't have time, someone else (maybe even I) can do it (especially if you'll then fix my grammatical, orphographic and other mistakes).

In reply to Re^4: UTF-8 and systemIO are not friends anymore by Anonymous Monk
in thread UTF-8 and systemIO are not friends anymore by Tommy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2023-11-28 22:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found