.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Perl6::Say 3pm" .TH Perl6::Say 3pm "2015-08-15" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Perl6::Say \- "print()", but no newline needed .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& # Perl 5 code... \& \& use Perl6::Say; \& \& say \*(Aqboo\*(Aq; # same as: print \*(Aqboo\*(Aq, "\en" \& \& say STDERR \*(Aqboo\*(Aq; # same as: print STDERR \*(Aqboo\*(Aq, "\en" \& \& STDERR\->say(\*(Aqboo\*(Aq); # same as: print STDERR \*(Aqboo\*(Aq, \en" \& \& $fh\->say(\*(Aqboo\*(Aq); # same as: print $fh \*(Aqboo\*(Aq, "\en"; \& \& say(); # same as: print "$_\en"; \& \& say undef; # same as: print "\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" .SS "Note for Users of Perl 5.10" .IX Subsection "Note for Users of Perl 5.10" You don't need this module. The Perl 6 \f(CW\*(C`say\*(C'\fR function is available in Perl 5.10 by saying \f(CW\*(C`use feature \*(Aqsay\*(Aq;\*(C'\fR. Hence, this module is of interest only to users of Perl 5.6 and 5.8. .PP If you have Perl 5.10 installed, see the \fI510/\fR directory in this distribution for some elementary examples of \f(CW\*(C`say\*(C'\fR taken from \f(CW\*(C`perldoc feature\*(C'\fR. .SS "General" .IX Subsection "General" Implements a close simulation of the \f(CW\*(C`say\*(C'\fR function in Perl 6, which acts like \f(CW\*(C`print\*(C'\fR but automatically appends a newline. .PP Use it just like \f(CW\*(C`print\*(C'\fR (except that it only supports the indirect object syntax when the stream is a bareword). That is, assuming the relevant filehandles are open for output, you can use any of these: .PP .Vb 7 \& say @data; \& say FH @data; \& FH\->say(@data); \& *FH\->say(@data); \& (\e*FH)\->say(@data); \& say $fh, @data; \& $fh\->say(@data); .Ve .PP but not any of these: .PP .Vb 5 \& say {FH} @data; \& say {*FH} @data; \& say {\e*FH} @data; \& say $fh @data; \& say {$fh} @data; .Ve .SS "Additional Permitted Usages" .IX Subsection "Additional Permitted Usages" As demonstrated in the test suite accompanying this distribution, \&\f(CW\*(C`Perl6::Say::say()\*(C'\fR can be used in all the following situations. .PP .Vb 4 \& $string = q{}; \& open FH, ">", \e$string; \& say FH qq{Hello World}; # print to a string \& close FH; # requires Perl 5.8.0 or later \& \& use FileHandle; \& $fh = FileHandle\->new($file, \*(Aqw\*(Aq); \& if (defined $fh) { \& say $fh, qq{Hello World}; \& $fh\->close; \& } \& \& use IO::File; \& $fh = IO::File\->new($file, \*(Aqw\*(Aq); \& if (defined $fh) { \& say $fh, qq{Hello World}; \& $fh\->close; \& } \& \& $string = q{}; \& open FH, ">", \e$string; # requires Perl 5.8.0 or later \& select(FH); \& say qq{Hello World}; \& close FH; .Ve .SS "Interaction with Output Record Separator" .IX Subsection "Interaction with Output Record Separator" In Perl 6, \f(CW\*(C`say\ @stuff\*(C'\fR is exactly equivalent to \&\f(CW\*(C`Core::print\ @stuff,\ "\en"\*(C'\fR. .PP That means that a call to \f(CW\*(C`say\*(C'\fR appends any output record separator (\s-1ORS\s0) \&\fIafter\fR the added newline (though in Perl 6, the \s-1ORS\s0 is an attribute of the filehandle being used, rather than a global \f(CW$/\fR variable). .ie n .SS """IO::Handle::say()""" .el .SS "\f(CWIO::Handle::say()\fP" .IX Subsection "IO::Handle::say()" IO::Handle version 1.27 or later (which, confusingly, is found in \s-1IO\s0 distribution 1.23 and later) also implements a \f(CW\*(C`say\*(C'\fR method. Perl6::Say provides its own \f(CW\*(C`say\*(C'\fR method to IO::Handle if \f(CW\*(C`IO::Handle::say\*(C'\fR is not available. .SS "Usage with Older Perls" .IX Subsection "Usage with Older Perls" As noted above, some aspects of \f(CW\*(C`Perl6::Say::say()\*(C'\fR will not work with versions of Perl earlier than 5.8.0. This is not due to any problem with this module; it is simply that Perl did not support printing to an in-memory file (\f(CW\*(C`print \e$string, "\en";\*(C'\fR) prior to that point. (Thanks to a \s-1CPAN\s0 testers report from David Cantrell for identifying this limitation.) .SH "WARNING" .IX Header "WARNING" The syntax and semantics of Perl 6 is still being finalized and consequently is at any time subject to change. That means the same caveat applies to this module. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" No dependencies other than on modules included with the Perl core as of version 5.8.0. .PP Some of the files in the test suite accompanying this distribution use non-core \s-1CPAN\s0 module IO::Capture::Stdout. Tests calling IO::Capture::Stdout methods are enclosed in \f(CW\*(C`SKIP\*(C'\fR blocks and so should pose no obstacle to installation of the distribution on systems lacking IO::Capture. (However, the maintainer strongly recommends IO::Capture for developers who write a lot of test code. So please consider installing it!) .SH "AUTHOR and MAINTAINER" .IX Header "AUTHOR and MAINTAINER" .SS "\s-1AUTHOR\s0" .IX Subsection "AUTHOR" Damian Conway (damian@conway.org). .SS "\s-1MAINTAINER\s0" .IX Subsection "MAINTAINER" Alexandr Ciornii (alexchorny@gmail.com) .SH "ACKNOWLEDGMENTS" .IX Header "ACKNOWLEDGMENTS" Thanks to Damian Conway for dreaming this up. Thanks to David A Golden for a close review of the documentation. Thanks to \s-1CPAN\s0 tester Jost Krieger for reporting an error in my \s-1SKIP\s0 block count in one test file. .SH "BUGS AND IRRITATIONS" .IX Header "BUGS AND IRRITATIONS" As far as we can determine, Perl 5 doesn't allow us to create a subroutine that truly acts like \f(CW\*(C`print\*(C'\fR. That is, one that can simultaneously be used like so: .PP .Vb 1 \& say @data; .Ve .PP and like so: .PP .Vb 1 \& say {$fh} @data; .Ve .PP Comments, suggestions, and patches welcome. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2004, Damian Conway. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.