Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Rakudo * DATA filehandle syntax

by thundergnat (Deacon)
on Aug 11, 2010 at 15:18 UTC ( #854416=perlquestion: print w/ replies, xml ) Need Help??
thundergnat has asked for the wisdom of the Perl Monks concerning the following question:

I've been playing around a bit with Rakudo * and haven't been able to figure out the syntax to use the DATA filehandle. I'm beginning to suspect that it hasn't been implemented yet.

Google yielded meager results; the most promising was the preliminary "Learning Perl6" book by merlyn and brian_d_foy. It was written in 2007 however, based on pugs, and syntax has drifted since then.

I checked the Rakudo test suite to see if I could find a test using a DATA fh but didn't turn up anything.

Anyone have any pointers to documentation about this? (Even documentation saying "It isn't implemented yet."?)

From "Learning Perl6": (Doesn't work in Rakudo *)

for =$=DATA { .say } =begin DATA 1 2 3 4 5 =end

Returns:

===SORRY!=== Non-declarative sigil is missing its name at line 3, near "$=DATA {\n +"

I tried some different things but started hearing dominus commenting in my head so figured I would be better off asking.

Comment on Rakudo * DATA filehandle syntax
Select or Download Code
Re: Rakudo * DATA filehandle syntax
by molecules (Monk) on Aug 11, 2010 at 16:44 UTC
    I don't know about the state of implementation for the DATA filehandle (and I've tried several variations to no avail). However, reading from a file seems to work fine:
    my $data_fh = open 'data.txt'; for $data_fh.lines { .say }
Re: Rakudo * DATA filehandle syntax
by moritz (Cardinal) on Aug 11, 2010 at 16:47 UTC
    Rakudo doesn't support DATA sections yet.

    Even if it did, reading from a file handle has a different syntax now, you'd write

    for $=DATA.lines { ... }

    Since "Learning Perl 6" seems out of date, I can only point you to the latest download of Using Perl 6. Different target audience, and also a work in progress, but we do try to track spec changes when they occur :-)

    Perl 6 - links to (nearly) everything that is Perl 6.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://854416]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2014-09-01 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (6 votes), past polls