[docs] Add some POD to Tapir, rurban++
[parrot.git] / examples / streams / SubHello.pir
blob7c7ac22d0b43b98d9a2070e3a76802f909d23fbf
1 # $Id$
3 =head1 Hello Example
5 This example shows the usage of C<Stream::Sub>.
7 =head1 FUNCTIONS
9 =over 4
11 =item _main
13 Creates a C<Stream::Sub> and dumps it.
15 =cut
17 .sub _main :main
18     .local pmc stream
20     load_bytecode 'Stream/Sub.pbc'
22     stream = new ['Stream'; 'Sub']
24     # set the stream's source sub
25     .const 'Sub' temp = "_hello"
26     assign stream, temp
28     # dump the stream
29     stream."dump"()
31     end
32 .end
34 =item _hello
36 This sub is used as the source for the stream.
38 It just writes some text to the stream.
40 =cut
42 .sub _hello :method
43     self."write"( "hello" )
44     self."write"( "world!" )
45     self."write"( "parrot" )
46     self."write"( "is cool" )
47 .end
49 =back
51 =head1 AUTHOR
53 Jens Rieks E<lt>parrot at jensbeimsurfen dot deE<gt> is the author
54 and maintainer.
55 Please send patches and suggestions to the Perl 6 Internals mailing list.
57 =head1 COPYRIGHT
59 Copyright (C) 2004-2009, Parrot Foundation.
61 =cut
63 # Local Variables:
64 #   mode: pir
65 #   fill-column: 100
66 # End:
67 # vim: expandtab shiftwidth=4 ft=pir: