Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Perl6: Capturing newline in a string

by Laurent_R (Canon)
on May 31, 2016 at 22:19 UTC ( [id://1164647]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Perl6: Capturing newline in a string
in thread Perl6: Capturing newline in a string

Hi stevieb,

Just a bit of feedback. I have tried a number of things and combinations (such as using the :bin and chomp => false options, using the lines, slurp, slurp-rest and get functions or methods), etc., but to no avail. Even when requested to keep new lines, Perl 6 is apparently converting \r\n sequences to \n on reading a Windows file, so that "un-chomped" lines end with \x0A (or ASCII 10), whether they come from a Unix or a Windows file. There doesn't seem to be a possibility to distinguish between EOL conventions this way. Or, at least, I haven't found any.

Not a good news, and unfortunately not very helpful, but I thought I should let you know about my tests.

Replies are listed 'Best First'.
Re^6: Perl6: Capturing newline in a string
by stevieb (Canon) on May 31, 2016 at 23:05 UTC

    It's very helpful Laurent_R, thanks! Combined with what raiph said in Re^3: Perl6: Capturing newline in a string that I've reviewed, I'm thinking this is a bug (or at least a function that's lacking... I can't see me being the only person who will want to identify which endings a file has, as perl6 takes off).

    There should be a way to get this information, or else there's no way to ensure the proper line endings get replaced (by proper I mean the original ones) when the endings aren't that of the local platform.

    I'm going to do a bit more testing and review. If I can't figure anything out, I'll open a ticket.

      So don't use .lines and instead open(:bin) parse the Buf like you normally would. It's really pretty simple if you quit trying to use a higher level convenience method to do this
        I'd be glad i you could show a working example. From my (very limited) tests, even that does not appear to work. But perhaps I failed to use the right function.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1164647]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-03-29 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found