Can I learn the ip-address of the person whose comment is in my blog?
Perl web-programming
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > Perl web-programmingGo to page: « previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | next »

  Top users: 
  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:
Thursday, 19 March 2009
r25909 - docs/Perl6/Spec Guest 21:28:28
 Author: lwall
Date: 2009-03-19 19:28:28 +0100 (Thu, 19 Mar 2009)
New Revision: 25909

Modified:
docs/Perl6/Spec/S12­-objects.pod
Log:
clarify container constraint meaning of sigil as requested by jnthn++


Modified: docs/Perl6/Spec/S12­-objects.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S12­-objects.pod 2009-03-19 18:13:13 UTC (rev 25908)
+++ docs/Perl6/Spec/S12­-objects.pod 2009-03-19 18:28:28 UTC (rev 25909)
@@ -1346,7 +1346,11 @@
Bar Foo @x

The constraint implied by the sigil also counts as part of the official type.
+The sigil is actually a constraint on the container, so the actual
+type of the parameter above is something like:

+ Positional[role { does Foo; does Bar; }]
+
Static C<where> clauses also count as part of the official type.
A C<where> clause is considered static if it can be applied to
the types to the left of it at compile time to produce a known finite set

Add comment
r25908 - docs/Perl6/Spec Guest 21:13:13
 Author: lwall
Date: 2009-03-19 19:13:13 +0100 (Thu, 19 Mar 2009)
New Revision: 25908

Modified:
docs/Perl6/Spec/S12­-objects.pod
Log:
[S12] attempt to clarify type narrowness of multiple constraints, enums, and where clauses


Modified: docs/Perl6/Spec/S12­-objects.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S12­-objects.pod 2009-03-19 13:29:43 UTC (rev 25907)
+++ docs/Perl6/Spec/S12­-objects.pod 2009-03-19 18:13:13 UTC (rev 25908)
@@ -12,9 +12,9 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 27 Oct 2004
- Last Modified: 14 Mar 2009
+ Last Modified: 19 Mar 2009
Number: 12
- Version: 77
+ Version: 78

=head1 Overview

@@ -1308,7 +1308,7 @@
You can leave out the block when matching against a literal value of some
kind:

- multi sub fib ($n where 0|1) { return $n }
+ multi sub fib (Int $n where 0|1) { return $n }
multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }

In fact, you can leave out the 'where' declaration altogether:
@@ -1335,6 +1335,111 @@
preferred if the constraint matches, and otherwise the second is
preferred.

+More generally, a parameter can have a set of constraints, and
+the set of constraints defines the formal type of the parameter,
+as visible to the signature. (No one constraint is priviledged as
+the storage type of the actual argument, unless it is a native type.)
+All constraints considered in type narrowness.
+That is, these are equivalently narrow:
+
+ Foo Bar @x
+ Bar Foo @x
+
+The constraint implied by the sigil also counts as part of the official type.
+
+Static C<where> clauses also count as part of the official type.
+A C<where> clause is considered static if it can be applied to
+the types to the left of it at compile time to produce a known finite set
+of values. For instance, a subset of an enum type is a static set
+of values. Hence
+
+ Day $d where 'Mon'..'Fri'
+
+is considered equivalent to
+
+ subset Weekday of Day where 'Mon'..'Fri';
+ Weekday $d
+
+Types mentioned in a dynamic C<where> class are not considered part of the official
+type, except insofar as the type includes the notion: "is also constrained
+by a dynamic C<where> clause", which narrows it by epsilon over the equivalent
+type without a C<where> clause.
+
+ Foo Bar @x # type is Foo & Bar & Positional
+ Foo Bar @x where Baz # slightly tighter than Foo Bar Positional
+
+The set of constraints for a parameter creates a subset type that implies
+some set of allowed values for the parameter. The set of allowed values
+may or may not be determinable at compile time. When the set of allowed
+values is determinable at compile time, we call it a static subtype.
+
+Type constraints that resolve to a static subtype (that is, with a
+fixed set of elements knowable (if not known) at compile time) are
+considered to be narrower than type constraints that involve run-time
+calculation, or are otherwise intractable at compile time.
+Note that all values such as 0 or "foo" are considered
+singleton static subtypes. Singleton values are considered narrower
+than a subtype with multiple values, even if the subtype contains
+the value in question. This is because, for enumerable types, type
+narrowness is defined by doing set theory on the set of enumerated values.
+
+So assuming:
+
+ my enum Day ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
+ subset Weekday of Day where 'Mon' .. 'Fri'; # considered static
+ subset Today of Day where *.today;
+
+we have the following pecking order:
+
+ Parameter # Set of possible values
+ ========= ===================­=====
+ Int $n # Int
+
+ Int $n where Today # Int plus dynamic where
+ Int $n where 1 <= * <= 5 # Int plus dynamic where
+
+ Day $n # 0..6
+
+ Day $n where Today # 0..6 plus dynamic where
+
+ Day $n where 1 <= * <= 5 # 1..5
+ Int $n where Weekday # 1..5
+ Day $n where Weekday # 1..5
+ Weekday $n # 1..5
+
+ Tue # 2
+
+Note the difference between:
+
+ Int $n where 1 <= * <= 5 # Int plus dynamic where
+ Day $n where 1 <= * <= 5 # 1..5
+
+The first C<where> is considered dynamic not because of the nature
+of the comparsons but because C<Int> is not finitely enumerable.
+Our C<Weekday> subset type can calculate the set membership at compile
+time because it is based on the C<Day> enum, and hence is considered
+static despite the use of a C<where>. Had we based C<Weekday> on
+C<Int> it would have been considered dynamic. Note, however, that
+with "anded" constraints, any enum type governs looser types, so
+
+ Int Day $n where 1 <= * <= 5
+
+is considered static, since C<Day> is an enum, and cuts down the
+search space.
+
+The basic principle we're trying to get at is this: in comparing
+two parameter types, the narrowness is determined by the subset
+relationships on the sets of possible values, not on the names of
+constraints, or the method by which those constraints are specified.
+For practical reasons, we limit our subset knowledge to what can be
+easily known at compile time, and consider the presence of one or
+more dynamic constraints to be epsilon narrower than the same set of
+possible values without a dynamic constraint.
+
+As a first approximation for 6.0.0, subsets of enums are static,
+and other subsets are dynamic. We may refine this in subsequent
+versions of Perl.
+
=head1 Enums

An enum is a low-level class that can function as a role or property.

Add comment
Logout from Apache Khalid Naji 19:19:48
 Hi,

How can I logout via a perl-script from Apache?

Thank you
KN


comment 1 answer | Add comment
r25821 - docs/Perl6/Spec Guest 12:01:27
 Author: masak
Date: 2009-03-14 13:34:42 +0100 (Sat, 14 Mar 2009)
New Revision: 25821

Modified:
docs/Perl6/Spec/S12­-objects.pod
Log:
specced syntactic 'where' sugar in param lists

Modified: docs/Perl6/Spec/S12­-objects.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S12­-objects.pod 2009-03-13 15:44:50 UTC (rev 25820)
+++ docs/Perl6/Spec/S12­-objects.pod 2009-03-14 12:34:42 UTC (rev 25821)
@@ -12,9 +12,9 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 27 Oct 2004
- Last Modified: 12 Mar 2009
+ Last Modified: 14 Mar 2009
Number: 12
- Version: 76
+ Version: 77

=head1 Overview

@@ -1305,6 +1305,18 @@
since all the type constraints in a signature parameter are just
anded together anyway.

+You can leave out the block when matching against a literal value of some
+kind:
+
+ multi sub fib ($n where 0|1) { return $n }
+ multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }
+
+In fact, you can leave out the 'where' declaration altogether:
+
+ multi sub fib (0) { return 0 }
+ multi sub fib (1) { return 1 }
+ multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }
+
Subtype constraints are used as tiebreakers in multiple dispatch:

use Rules::Common :p­rofanity;

comment 6 answers | Add comment
r25902 - docs/Perl6/Spec Guest 03:43:53
 Author: lwall
Date: 2009-03-19 01:43:53 +0100 (Thu, 19 Mar 2009)
New Revision: 25902

Modified:
docs/Perl6/Spec/S05­-regex.pod
Log:
[S05] define .caps and .chunks methods on match objects


Modified: docs/Perl6/Spec/S05­-regex.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S05­-regex.pod 2009-03-18 23:02:41 UTC (rev 25901)
+++ docs/Perl6/Spec/S05­-regex.pod 2009-03-19 00:43:53 UTC (rev 25902)
@@ -16,7 +16,7 @@
Date: 24 Jun 2002
Last Modified: 18 Mar 2009
Number: 5
- Version: 92
+ Version: 93

This document summarizes Apocalypse 5, which is about the new regex
syntax. We now try to call them I<regex> rather than "regular
@@ -1705,14 +1705,14 @@
=item * before C<pattern>

Perform lookahead -- i.e., check if we're at a position where
-C<pattern> matches. Returns a zero-width Match object on
+C<pattern> matches. Returns a zero-width C<Match> object on
success.

=item * after C<pattern>

Perform lookbehind -- i.e., check if the string before the
current position matches <pattern> (anchored at the end).
-Returns a zero-width Match object on success.
+Returns a zero-width C<Match> object on success.

=item * <?>

@@ -2385,7 +2385,7 @@

=item *

-A match always returns a Match object, which is also available
+A match always returns a C<Match> object, which is also available
as C<$/>, which is a contextual lexical declared in the outer
subroutine that is calling the regex. (A regex declares its own
lexical C<$/> variable, which always refers to the most recent
@@ -2547,6 +2547,9 @@
$/.chars # $/.to - $/.from
$/.orig # the original match string
$/.Str # substr($/.orig, $/.from, $/.chars)
+ $/.ast # the abstract result associated with this node
+ $/.caps # sequential captures
+ $/.chunks # sequential tokenization

Within the regex the current match state C<$ > also provides

@@ -2558,6 +2561,18 @@

=item *

+As described above, a C<Match> in list context returns its positional
+captures. However, sometimes you'd rather get a flat list of tokens in
+the order they occur in the text. The C<.caps> method returns a list
+of every captured item, regardless of how it was otherwise bound into
+named or numbered captures. The C<.chunks> method returns the captures
+as well as all the interleaved "noise" between the captures. [Conjecture:
+we could also have C<.deepcaps> and C<.deepchunks> that recursively expand
+any capture containing submatches. Presumably each returned chunk would
+come equipped with some method to discover its "pedigree" in the parse tree.]
+
+=item *
+
All match attempts--successfu­l or not--against any regex, subrule, or
subpattern (see below) return an object of class C<Match>. That is:

@@ -2566,8 +2581,8 @@

=item *

-This returned object is also automatically assigned to the lexical
-C<$/> variable of the current surroundings. That is:
+This returned object is also automatically bound to the lexical
+C<$/> variable of the current surroundings regardless of success. That is:

$str ~~ /pattern/;
say "Matched" if $/;
@@ -3122,7 +3137,7 @@
# | |
mm/ $<key>=[ (<[A..E]>) (\d**3..6) (X?) ] /;

-then the corresponding C<< $/<key> >> Match object contains only the string
+then the corresponding C<< $/<key> >> C<Match> object contains only the string
matched by the non-capturing brackets.

=item *

Add comment
Wednesday, 18 March 2009
r25895 - docs/Perl6/Spec Guest 23:10:41
 Author: coke
Date: 2009-03-18 21:10:41 +0100 (Wed, 18 Mar 2009)
New Revision: 25895

Modified:
docs/Perl6/Spec/S02­-bits.pod
Log:
Correct minor typo in metadata.
(... unless that's Welsh, in which case my bad.)



Modified: docs/Perl6/Spec/S02­-bits.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S02­-bits.pod 2009-03-18 20:10:33 UTC (rev 25894)
+++ docs/Perl6/Spec/S02­-bits.pod 2009-03-18 20:10:41 UTC (rev 25895)
@@ -12,7 +12,7 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 10 Aug 2004
- Lwst Modified: 18 Mar 2009
+ Last Modified: 18 Mar 2009
Number: 2
Version: 160


Add comment
r25890 - docs/Perl6/Spec Guest 22:04:17
 Author: lwall
Date: 2009-03-18 20:04:16 +0100 (Wed, 18 Mar 2009)
New Revision: 25890

Modified:
docs/Perl6/Spec/S03­-operators.pod
Log:
kill off int as a prefix operator to avoid confusion with the type name


Modified: docs/Perl6/Spec/S03­-operators.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S03­-operators.pod 2009-03-18 18:24:25 UTC (rev 25889)
+++ docs/Perl6/Spec/S03­-operators.pod 2009-03-18 19:04:16 UTC (rev 25890)
@@ -12,9 +12,9 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 8 Mar 2004
- Last Modified: 17 Mar 2009
+ Last Modified: 18 Mar 2009
Number: 3
- Version: 159
+ Version: 160

=head1 Overview

@@ -991,7 +991,6 @@

Functions of one argument

- int
sleep
abs
sin
@@ -1000,9 +999,16 @@
Note that, unlike in Perl5, you must use the C<.meth> forms to default
to C<$_> in Perl6.

-There is no unary C<rand> function in Perl 6, though there is a C<.rand>
-method call and an argumentless C<rand> term.
+There is no unary C<rand> prefix in Perl 6, though there is a C<.rand>
+method call and an argumentless C<rand> term. There is no unary C<int>
+prefix either; you must use a typecast to a type such as C<Int> or C<int>.
+(Typecasts require parentheses and may not be used as prefix operators.)
+In other words:

+ my $i = int $x; # ILLEGAL
+
+is a syntax error (two terms in a row), because C<int> is a type name now.
+
=over

=item *

Add comment
r25889 - docs/Perl6/Spec Guest 21:24:25
 Author: lwall
Date: 2009-03-18 19:24:25 +0100 (Wed, 18 Mar 2009)
New Revision: 25889

Modified:
docs/Perl6/Spec/S05­-regex.pod
Log:
Destroy the term "result object" in favor of "abstract object" and AST-Think.


Modified: docs/Perl6/Spec/S05­-regex.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S05­-regex.pod 2009-03-18 18:14:09 UTC (rev 25888)
+++ docs/Perl6/Spec/S05­-regex.pod 2009-03-18 18:24:25 UTC (rev 25889)
@@ -14,9 +14,9 @@
Maintainer: Patrick Michaud <pmichaud@pobox.com­> and
Larry Wall <larry@wall.org>
Date: 24 Jun 2002
- Last Modified: 11 Mar 2009
+ Last Modified: 18 Mar 2009
Number: 5
- Version: 91
+ Version: 92

This document summarizes Apocalypse 5, which is about the new regex
syntax. We now try to call them I<regex> rather than "regular
@@ -774,15 +774,21 @@
\s+ { print "but does contain whitespace\n" }
/

-An B<explicit> reduction using the C<make> function sets the I<result object>
+An B<explicit> reduction using the C<make> function generates the
+I<abstract syntax tree> object (I<abstract object> or I<ast> for short)
for this match:

/ (\d) { make $0.sqrt } Remainder /;

-This has the effect of capturing the square root of the numified string,
-instead of the string. The C<Remainder> part is matched but is not returned
-as part of the result object unless the first C<make> is later overridden by another C<make>.
+This has the effect of capturing the square root of the numified
+string, instead of the string. The C<Remainder> part is matched and
+returned as part of the C<Match> object but is not returned
+as part of the abstract object. Since the abstract object usually
+represents the top node of an abstract syntax tree, the abstract object
+may be extracted from the C<Match> object by use if the C<.ast> method.

+A second call to C<make> overrides any previous call to C<make>.
+
These closures are invoked with a topic (C<$_>) of the current match
state (a C<Cursor> object). Within a closure, the instantaneous
position within the search is denoted by the C<.pos> method on
@@ -1331,7 +1337,7 @@
time you use it unless the string changes. (Any external lexical
variable names must be rebound each time though.) Subrules may not be
interpolated with unbalanced bracketing. An interpolated subrule
-keeps its own inner match result as a single item, so its parentheses never count toward the
+keeps its own inner match results as a single item, so its parentheses never count toward the
outer regexes groupings. (In other words, parenthesis numbering is always
lexically scoped.)

@@ -1585,7 +1591,7 @@

=item *

-A C<< <( >> token indicates the start of a result capture, while the
+A C<< <( >> token indicates the start of the match's overall capture, while the
corresponding C<< )> >> token indicates its endpoint. When matched,
these behave as assertions that are always true, but have the side
effect of setting the C<.from> and C<.to> attributes of the match
@@ -1600,8 +1606,9 @@
except that the scan for "C<foo>" can be done in the forward direction,
while a lookbehind assertion would presumably scan for C<\d+> and then
match "C<foo>" backwards. The use of C<< <(...)> >> affects only the
-meaning of the I<result object> and the positions of the beginning and
-ending of the match. That is, after the match above, C<$()> contains
+meaning the positions of the beginning and
+ending of the match, and anything calculated based on those positions.
+For instance, after the match above, C<$()> contains
only the digits matched, and C<$/.to> is pointing to after the digits.
Other captures (named or numbered) are unaffected and may be accessed
through C<$/>.
@@ -2389,8 +2396,9 @@
=item *

Notionally, a match object contains (among other things) a boolean
-success value, a scalar I<result object>, an array of ordered submatch
-objects, and a hash of named submatch objects. To provide convenient
+success value, an array of ordered submatch objects, and a hash of named
+submatch objects. (It also optionally carries an I<abstract object> normally
+used to build up an abstract syntax tree,) To provide convenient
access to these various values, the match object evaluates differently
in different contexts:

@@ -2433,10 +2441,12 @@

When used as a scalar, a C<Match> object evaluates to itself.

-However, sometimes you would like an alternate scalar value to ride
-along with the match. This is called a I<result> object, and it rides
-along is an attribute of the C<Match> object.
-C<$()> is a shorthand for C<$($/.rob)>.
+However, sometimes you would like an alternate scalar value to
+ride along with the match. The C<Match> object itself describes
+a concrete parse tree, so this extra value is called an I<abstract>
+object; it rides along as an attribute of the C<Match> object. C<$()>
+is a shorthand for C<$($/.ast)>. The C<.ast> method by default just
+returns the string between the C<$/.from> and C<$/.to> positions.

Therefore C<$()> is usually just the entire match string, but
you can override that by calling C<make> inside a regex:
@@ -2447,19 +2457,19 @@
# match succeeds -- ignore the rest of the regex
});

-This puts the result object into C<$/.rob>. If a result object is
+This puts the new abstract node into C<$/.ast>. If the abstract object is
returned that way, it may be of any type, not just a string.
This makes it convenient to build up an abstract syntax tree of
arbitrary node types.

-You may also capture a subset of the match as the result object using
+You may also capture a subset of the match as the abstract object using
the C<< <(...)> >> construct:

"foo123bar" ~~ / foo <( \d+ )> bar /
say $(); # says 123

-In this case the result object is always a string when doing string
-matching, and a list of one or more elements when doing array matching.
+In this case the abstract object is always a string when doing string
+matching, and a list of one or more elements when doing list matching.

=item *

@@ -2564,15 +2574,15 @@

=item *

-Inside a regex, the C<$_> variable holds the current regex's incomplete
-C<Match> object, known as a match state. Generally this should not
+Inside a regex, the C<$ > variable holds the current regex's incomplete
+C<Match> object, known as a match state (of type C<Cursor>). Generally this should not
be modified unless you know how to create and propagate match states.
All regexes actually return match states even when you think they're
returning something else, because the match states keep track of
the success and failures of the pattern for you.

-Fortunately, when you just want to return a different result object instead
-of the default C<Match> object, you may associate your return value with
+Fortunately, when you just want to return a different abstract result along with
+the default concrete C<Match> object, you may associate your return value with
the current match state using the C<make> function, which works something
like a C<return>, but doesn't clobber the match state:

@@ -2581,7 +2591,7 @@
/;
say $(); # says 'bar'

-The result object is available in the C<Match> object via a C<< .rob >> lookup.
+The abstract object of any C<Match> object is available via the C<< .ast >> method.

=back

@@ -3942,8 +3952,9 @@
method call.)

You'll note from the last example that substitutions only happen on
-the "official" string result of the match, that is, the C<$()> value.
-(Here we captured C<$()> using the C<< <(...)> >> pair; otherwise we
+the "official" string result of the match, that is, the portion of
+the string between the C<$/.from> and C<$/.to> positions.
+(Here we set those explicitly using the C<< <(...)> >> pair; otherwise we
would have had to use lookbehind to match the C<$>.)

=head1 Positional matching, fixed width types

Add comment
DBD::Pg's $dbh->func( "/path/to/file", 'lo_import' ) fails silently Kynn Jones 20:52:48
 Hi! I'm trying to use DBD::Pg to import a Unix file as a large object. For
this I'm using the following:
my $oid = $dbh->func( "/absolute/path/to/­file", 'lo_import' );

When I do this, a new record is added to pg_largeobject, with a
proper-looking non-null loid, but the data field remains empty, and the
variable $oid above gets a return value of undef, i.e. the call to func
fails. No error or warning is ever emitted, as far as I can tell.
($dbh->errstr returns undef.) FWIW, the file passed as the first argument is
world-readable, and the full path to it is world-accessible.

I've consulted the documentation for DBI and DBD::Pg modules, but I can't
find any information that will enable me to troubleshoot/debug this further.
Any suggestions would be greatly appreciated!

TIA!

Kynn
Add comment
a junction or not Richard Hainsworth 19:09:41
 The following (the n:> is to mark the lines) are legal:

1:> my @x = 1,2,3,4; ([+] @x).say; # output 10
2:> my @x = 1|11,2,3,4; ([+] @a).perl.say; # output any(10,20)
3:> my @x = 1|11,2,3,4; ([+] @a).eigenstates.min­.say; # output 10

However, the next line isnt
4:> my @x = 1,2,3,4; ([+] @a).eigenstates.min­.say; # Method
'eigenstates' not found for invocant of class 'Integer'

But suppose I dont know until runtime whether @x contains a junction or
not, eg.,

my @s = 1|11,2,3,4,5,6,7; # as in the value of an ace in 21
my @x;
loop {
@x = @s.pick(3);
([+] @x).eigenstates.min­.say;
};

Eg.
$ perl6
my @s=1|11,2,3,4,5,6;m­y @x; loop {@x=@s.pick(3);([+]
@x).eigenstates.min­.say}
8
6
Method 'eigenstates' not found for invocant of class 'Integer'

I suggested to Masak on irc that an integer is a singleton, hence a
degenerate Junction. He said not.

So, how to determine whether a junction is being used or not?

Richard
comment 18 answers | Add comment
r25880 - docs/Perl6/Spec Guest 04:28:40
 Author: lwall
Date: 2009-03-18 02:28:39 +0100 (Wed, 18 Mar 2009)
New Revision: 25880

Modified:
docs/Perl6/Spec/S03­-operators.pod
docs/Perl6/Spec/S04­-control.pod
Log:
create more semantic distance between terms and 0-ary functions


Modified: docs/Perl6/Spec/S03­-operators.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S03­-operators.pod 2009-03-18 01:03:18 UTC (rev 25879)
+++ docs/Perl6/Spec/S03­-operators.pod 2009-03-18 01:28:39 UTC (rev 25880)
@@ -12,9 +12,9 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 8 Mar 2004
- Last Modified: 12 Mar 2009
+ Last Modified: 17 Mar 2009
Number: 3
- Version: 158
+ Version: 159

=head1 Overview

@@ -303,14 +303,6 @@
its left, so it binds tighter than comma on the left but looser than
comma on the right--see List prefix precedence below.

-=item *
-
-0-ary functions
-
- self
- undef
- rand
-
=back

=head2 Method postfix precedence
@@ -1009,7 +1001,7 @@
to C<$_> in Perl6.

There is no unary C<rand> function in Perl 6, though there is a C<.rand>
-method call and a 0-ary C<rand> term.
+method call and an argumentless C<rand> term.

=over

@@ -1746,7 +1738,7 @@

The function can be 0-ary as well:

- () ... &rand # list of random numbers
+ () ... { rand } # list of random numbers

The function may also be slurpy (*-ary), in which case all the
preceding values are passed in (which means they must all be cached
@@ -3627,7 +3619,7 @@
then you shouldn't worry about it, because unlike previous versions,
Perl6 never guesses whether the next thing is a term or operator.
In this case it is always expecting a term unless C<foo> is predeclared
-to be a 0-ary sub.]
+to be a type or value name.]

The upgrade never happens on the "blunt" end of a hyper. If you write


Modified: docs/Perl6/Spec/S04­-control.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S04­-control.pod 2009-03-18 01:03:18 UTC (rev 25879)
+++ docs/Perl6/Spec/S04­-control.pod 2009-03-18 01:28:39 UTC (rev 25880)
@@ -12,9 +12,9 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 19 Aug 2004
- Last Modified: 4 Mar 2009
+ Last Modified: 17 Mar 2009
Number: 4
- Version: 73
+ Version: 74

This document summarizes Apocalypse 4, which covers the block and
statement syntax of Perl.
@@ -95,7 +95,7 @@
a variable in the current package.

The new C<constant> declarator introduces a lexically scoped name
-for a compile-time constant, either a variable or a 0-ary sub, which
+for a compile-time constant, either a variable or named value, which
may be initialized with a pseudo-assignment:

constant Num $pi = 3;

Add comment
Tuesday, 17 March 2009
ANNOUNCE: IBM DB2 Database Driver for Perl DBI Version 1.7 released Open Source Application Development 19:51:50
 IBM DB2 Database Driver for Perl DBI Version 1.7 has been uploaded on
CPAN. Testers are please welcome to test the new features and report the
bugs.

DBI is an open standard application programming interface (API) that
provides database access for client applications written in Perl. DBI
defines a set of functions, variables, and conventions that provide a
platform-independen­t database interface.
The DBD::DB2 driver works with DBI and a DB2 client to access databases.

**New In Release
- Improved support for Getting Client Info using DB2 CLP "db2 list
applications". Enhancement on previous version defect 160229
- Errors while retrieving multiple resultsets from stored procedures using
db2_more_results defect number 172486
- Support for Decfloat Datatype - 172301
- Support for SQLRowCount to prefetch the number of rows that can be
retured by a Select/Update/Delet­e/Insert query 173018

Special Thanks to Hildo Biersma from Morgan Stanley for helping us gather
a lot of these requirements and making our driver better and useful.

Download Link
http://www.cpan.org­/authors/id/I/IB/IBM­TORDB2/DBD-DB21.6.ta­r.gz

Installation Instructions for both Linux and Unix and PPM repositories
Information
http://www-306.ibm.­com/software/data/db­2/perl/

Support Email Addresses

* This release is supported by Open Source Application Development Team
* You may also report your bugs via the CPAN resolution tracking system:
http://rt.cpan.org/­ by searching for module DBD-DB2
* Such bug reports can be sent by email to bug-DBD-DB2@rt.cpan­.org;
they also get sent to opendev@us.ibm.com,­ etc.

Download DB2 Express-C for free, go to:
http://www-01.ibm.c­om/software/data/db2­/express/download.ht­ml?S_CMP=ECDDWW01&S_­TACT=ACDB201


Getting started with DB2 Express-C:
http://www.ibm.com/­developerworks/wikis­/display/DB2/FREE+Bo­ok-+Getting+Started+­with+DB2+Express-C


Thanks,
Tarun Pasrija
IBM OpenSource Application Development Team
India Software Labs, Bangalore (India)
Add comment
core dump when using dbd oracle under solaris10 x86 Ching Shen 19:37:39
 Dear experts:
I have installed DBI and DBD on my x86 without any problem, but I get core dump when I try to make connection
my $dbh = DBI->connect($dsn, $user, $password );

Could you let me know how to fix the problem? Any suggestions will be greatly appreciated

$uname -a
SunOS deepfrzd 5.10 Generic_125101-06 i86pc i386 i86pc
DBI-1.60
DBD-Oracle-1.22
Oracle client Release 10.2.0.1.0
env set
export ORACLE_HOME=/orahom­e/app/oracle/product­/10.2.0
export LD_LIBRARY_PATH=$OR­ACLE_HOME/lib32:$­ORA­CLE_HOME/perl/lib:$­RACLE_HOME/lib:$­LD_L­IBRARY_PATH
export PATH=$ORACLE_HOME/b­in:$­PATH
export PATH=/usr/local/bin­:$­PATH
export PERLLIB=$ORACLE_HOM­E/lib32:$­ORACLE_HOME­/perl/lib:$­ORACLE_HO­ME/lib:/usr/local/li­b:/usr/local/lib/per­l5/5.8.8/i86pc-solar­is:/usr/local/lib/pe­rl5/site_perl/5.8.8/­i86pc-solaris:/usr/l­ocal/lib/perl5/site_­perl/5.6.1:/usr/loca­l/lib/perl5/5.6.1/su­n4-solaris:/usr/li
b:$­PERLLIB
export NLS_LANGUAGE=AMERIC­AN
export PERL5LIB=$ORACLE_HO­ME/lib32:$­ORACLE_HOM­E/perl/lib:$­ORACLE_H­OME/lib:/usr/local/l­ib:/usr/local/lib/pe­rl5/5.8.8/i86pc-sola­ris:/usr/local/lib/p­erl5/site_perl/5.8.8­/i86pc-solaris:/usr/­local/lib/perl5/site­_perl/5.6.1:/usr/loc­al/lib/perl5/5.6.1/s­un4-solaris:/usr/lib­:$­PERL5LIB

perl -MDevel::CoreStack -e 'stack'

Executing /usr/bin/adb "/usr/local/bin/per­l" "core" ($c)...
core file = core -- program ``/usr/local/bin/pe­rl'' on platform i86pc
SIGSEGV: Segmentation Fault
libclntsh.so.10.1`n­nfgrne+0x25b(febf344­0, 8043f38, 0, febb5e48, 0, 8041ce0)
libclntsh.so.10.1`n­lolgobj+0x669(febf34­40, 8043f38, 16, 8041d44, 8041d48)
libclntsh.so.10.1`n­nfun2a+0x15b(febf344­0, 8043f38, ff, 8043f18, 8041dd0, 1000)
libclntsh.so.10.1`n­nfsn2a+0x36(febf3440­, 8043f38, ff, 8043f18, 8041dd0, 1000)
libclntsh.so.10.1`n­iqname+0x2fb(febf344­0, 1, 8043f38, 8, 8360f4c, 8047170)
libclntsh.so.10.1`k­wfnran+0x184(827ad50­, 8, 804716c, 8047170, 8366f8c, 8366f90)
libclntsh.so.10.1`k­wfcinit+0x1b7(835ce2­c, 827ad50, 8, 804716c, 8047170, 8343388
)
libclntsh.so.10.1`k­puatch+0x7c0(835ce2c­, 835c8a0, 827ad50, 8, 0, 0)
libclntsh.so.10.1`O­CIServerAttach+0x56(­835ce2c, 835c8a0, 827ad50, 8, 0, fed01aca
)
Oracle.so`ora_db_lo­gin6+0x1095(81b8fe4,­ 82a65c0, 827ad50, 81c7620, 81c7698,
81af5d8)
Oracle.so`XS_DBD__O­racle__db__login+0x1­82(8293374, 8047690, 80473e8, 80b31fc)
Perl_pp_entersub+0x­453(81ac7dc, 8047690, 8047408, 8068f3a, 813afec, 4)
Perl_runops_standar­d+0x1e(813afec, 4, 80476a8, 8068b18, 8047670, 0)
S_call_body+0x3d(80­47670, 0, 80476a8, 8068a0d, 81e24d0, 47450)
Perl_call_sv+0x1ae(­81af674, 0, 0, fed4a90d, 80476f0, 4d)
DBI.so`XS_DBI_dispa­tch+0x1934(826d140, 8047c08, 80478e8, 80b31fc)
Perl_pp_entersub+0x­453(8047b68, 8047b48, 8047908, 8068708, 0, 0)
Perl_runops_standar­d+0x1e(0, 0, 8047b48, 806841f, 1, 0)
S_run_body+0x10d(1,­ 0, 0, 80479f4, 80479f8, 8047970)
perl_run+0x86(81317­20, 1, 8047b78, 806592b)
main+0x9b(3, 8047bac, 8047bbc)
_start+0x60(3, 8047c70, 8047c84, 8047c87, 0, 8047c8f)



Thanks
Ching Shen
x7156


Add comment
Monday, 16 March 2009
csv insert leading zeros Zenko Klapko Jr. 21:32:30
 Hi,

I've looked at the mailing list archives and couldn't find an answer to my
question. I'm using DBD::CSV and am inserting SSNs into a table. I've chosen
the datatype of CHAR(9) to describe the column. It works fine for SSNs that
have integers other than 0 leading the number. With SSNs that do start with
zeros, the zeros are removed. Should I use a different data type for the
column? Is there a work around?

-Zenko

--
I would rather be exposed to the inconveniences attending too much liberty
than to those attending too small a degree of it.
- Thomas Jefferson
comment 1 answer | Add comment
New development release (1.18_2) of DBD::ODBC - please read if you use DBD::ODBC Martin Evans 14:22:39
 Hi,

I have released a new development release of DBD::ODBC 1.18_2 which you
can find on CPAN. For a list of changes see the end of this email.

I would like to make a plea to all DBD::ODBC users to download and at
least run the make test and send the output to me, even if you are not
currently planning on upgrading.

Increasingly I am finding it very difficult to keep on top of specific
workarounds for drivers and driver managers. At this time there are at
least 4 ODBC driver managers and well over 50 ODBC drivers used
regularly (just for SQL Server on Windows there are over 10 drivers and
versions which can be used for SQL Server). I cannot possibly have and
test them all and fixing an issue in one driver/driver_manag­er is
increasingly likely to break another sending me into a loop.

The latest test code for DBD::ODBC outputs details of the database and
driver which I can use to create a matrix of working versions. Please,
please at least download the latest DBD::ODBC, run make test and send it
to me.

Issues addressed in 1.18_1 and 1.18_2:

=head2 Changes in DBD::ODBC 1.18_2 March 9, 2009

Added yet another workaround for the SQL Server Native Client driver
version 2007.100.1600.22 and 2005.90.1399.00 (driver version
09.00.1399) which leads to HY104, "Invalid precision value" in the
rt_39841.t test.

=head2 Changes in DBD::ODBC 1.18_1 March 6, 2009

Fixed bug reported by Toni Salom ki leading to a describe failed error
when calling procedures with no results. Test cases added to
20SqlServer.t.

Fixed bug rt 43384 reported by oyse where you cannot insert more than
127 characters into a Microsoft Access text(255) column when DBD::ODBC
is built in unicode mode.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft­.com

comment 3 answer | Add comment
r25854 - docs/Perl6/Spec/S32­-setting-library Guest 11:35:04
 Author: wayland
Date: 2009-03-16 09:35:04 +0100 (Mon, 16 Mar 2009)
New Revision: 25854

Modified:
docs/Perl6/Spec/S32­-setting-library/IO.­pod
Log:
Removed IO::File::Windows, as it's no longer necessary, AFAIK.


Modified: docs/Perl6/Spec/S32­-setting-library/IO.­pod
===================­====================­====================­========
--- docs/Perl6/Spec/S32­-setting-library/IO.­pod 2009-03-16 08:23:53 UTC (rev 25853)
+++ docs/Perl6/Spec/S32­-setting-library/IO.­pod 2009-03-16 08:35:04 UTC (rev 25854)
@@ -1060,18 +1060,6 @@

=back

-=head2 IO::File::Windows
-
- role IO::File::Windows does IO::File {
- method open(Bool :$­BinaryMode) {...}
- }
-
-=item open()
-
-Takes the C<BinaryMode> option to open the file in binary mode.
-
-[XXX bogus, now under Unicode *all* systems must distinguish text from binary.]
-
=head1 Unfiled

=over 4

Add comment
r25853 - docs/Perl6/Spec/S32­-setting-library Guest 11:23:53
 Author: wayland
Date: 2009-03-16 09:23:53 +0100 (Mon, 16 Mar 2009)
New Revision: 25853

Modified:
docs/Perl6/Spec/S32­-setting-library/IO.­pod
Log:
Fix typo for TimToady++ (I like the new changes :)­ )


Modified: docs/Perl6/Spec/S32­-setting-library/IO.­pod
===================­====================­====================­========
--- docs/Perl6/Spec/S32­-setting-library/IO.­pod 2009-03-16 08:03:54 UTC (rev 25852)
+++ docs/Perl6/Spec/S32­-setting-library/IO.­pod 2009-03-16 08:23:53 UTC (rev 25853)
@@ -936,7 +936,7 @@
If the file handle came from a piped open, C<close> will additionally
return C<Failure> (aliased to C<$!>) if one of the other system calls involved fails, or if the
program exits with non-zero status. The exception object will contain any
-pertinent informatoin. Closing a pipe
+pertinent information. Closing a pipe
also waits for the process executing on the pipe to complete, in case you
want to look at the output of the pipe afterwards, and
implicitly puts the exit status value into the C<Failure> object if necessary.

Add comment
Fetchting UTF8 data with DBD::Pg, adding more and storing it back Alexander Farber 06:09:05
 Hello DBI-users,

I'm using phpBB3 as backend for a Flash+Perl card
game in Russian language (at http://preferans.de­ ):

$ perl -v
This is perl, v5.8.8 built for i386-openbsd

$ psql
Welcome to psql 8.2.6, the PostgreSQL interactive terminal.
phpbb=> \l
List of databases
Name | Owner | Encoding
-----------+-------­---+----------
phpbb | postgres | UTF8
phpbb.OLD | postgres | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8

When I fetch player names from the database above,
they don't seem to be recognized as UTF8:

UTF8 off, non-ASCII, 11 characters 11 bytes
UTF8 off, non-ASCII, 8 characters 8 bytes
UTF8 off, ASCII, 4 characters 4 bytes
UTF8 off, ASCII, 5 characters 5 bytes

Then I add some UTF8 data in my Perl program
(I want to log played games as posts in a forum,
so I "use utf8" and add some Russian text and also:

use constant SPADES_HTML => pack ' U', 0x2660;
use constant DIAMONDS_HTML => pack ' U', 0x2666;
use constant CLUBS_HTML => pack ' U', 0x2663;
use constant HEARTS_HTML => pack ' U', 0x2665; )
and try to store it back into the database.

Unfortunately the data is mangled unless
I call decode_utf8() on it before storing:

$game->{BODY} .= decode_utf8($user->­{NAME}) . ': ' . $more_data;

Why is it so complicated? When I use PuTTY with
UTF8 encoding+Cyrillic font to login into my server
and then call psql, everything works wonderfully.
I can see the russian names, can edit them with vim...

Can't DBD::Pg recognize that it's UTF8 data?

Thank you
Alex

PS: Another thing I don't understand is that I have
to call encode_utf8 whenever I want to calculate
a checksum of UTF8 data, but that's another story?

$Sth_create_post->e­xecute('Test 10' . SPADES_HTML,
$game->{BODY}, md5_hex(encode_utf8­($game->{BODY})),

comment 4 answer | Add comment
r25849 - docs/Perl6/Spec Guest 04:24:39
 Author: lwall
Date: 2009-03-16 02:24:38 +0100 (Mon, 16 Mar 2009)
New Revision: 25849

Modified:
docs/Perl6/Spec/S02­-bits.pod
Log:
make blocks transparent to Junctions (in the absence of explicit parameter types)


Modified: docs/Perl6/Spec/S02­-bits.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S02­-bits.pod 2009-03-16 01:23:33 UTC (rev 25848)
+++ docs/Perl6/Spec/S02­-bits.pod 2009-03-16 01:24:38 UTC (rev 25849)
@@ -12,9 +12,9 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 10 Aug 2004
- Last Modified: 7 Mar 2009
+ Last Modified: 15 Mar 2009
Number: 2
- Version: 158
+ Version: 159

This document summarizes Apocalypse 2, which covers small-scale
lexical items and typological issues. (These Synopses also contain
@@ -1028,8 +1028,8 @@
Class Perl 6 standard class namespace
Role Perl 6 standard generic interface/implement­ation
Grammar Perl 6 pattern matching namespace
- Any Perl 6 object (default parameter type, excludes Junction)
- Object Perl 6 object (either Any or Junction)
+ Any Perl 6 object (default routine parameter type, excludes Junction)
+ Object Perl 6 object (default block parameter type, either Any or Junction)

A C<KeyHash> differs from a normal C<Hash> in how it handles default
values. If the value of a C<KeyHash> element is set to the default

Add comment
Sunday, 15 March 2009
Dot forms of adjectives Richard Hainsworth 13:54:21
 But I recently read this on irc:

2009-03-12
23:16 pugs_svn r25809 | lwall++ | This decrease in consistency on
the syntactic level is offset by an
23:16 pugs_svn r25809 | lwall++ | increase in consistency on the
semantic level, as suggested by rouso++.
23:16 pugs_svn r25809 | lwall++ | (We'd already gotten rid of the
dot forms of adverbs some time ago,
23:16 pugs_svn r25809 | lwall++ | for similar reasons. We just
didn't quite carry the idea through.)

and then read this:

S03 Changes to Perl5 Operators
...

if $filename ~~ :e { say "exists" }

is the same as

if $filename.e { say "exists" }

The 1st form actually translates to the latter form, so the object's
class decides how to dispatch methods.


Is there an inconsistency here?

comment 2 answer | Add comment
Saturday, 14 March 2009
r25807 - docs/Perl6/Spec Guest 23:57:24
 Author: lwall
Date: 2009-03-12 22:30:47 +0100 (Thu, 12 Mar 2009)
New Revision: 25807

Modified:
docs/Perl6/Spec/S03­-operators.pod
Log:
Clarify value syntax inconsistency noticed by pmichaud++


Modified: docs/Perl6/Spec/S03­-operators.pod
===================­====================­====================­========
--- docs/Perl6/Spec/S03­-operators.pod 2009-03-12 17:38:06 UTC (rev 25806)
+++ docs/Perl6/Spec/S03­-operators.pod 2009-03-12 21:30:47 UTC (rev 25807)
@@ -12,9 +12,9 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 8 Mar 2004
- Last Modified: 4 Mar 2009
+ Last Modified: 12 Mar 2009
Number: 3
- Version: 157
+ Version: 158

=head1 Overview

@@ -2660,18 +2660,52 @@

A function predeclared with an empty signature is considered 0-ary
at run time but is still parsed as a list prefix operator, and looks
-for a following list. To declare a function that is parsed
-as a simple 0-ary term, you must use the form C<< term:<foo> >>.
-Such a term is never considered a list prefix operator, though it
-allows an optional set of empty parentheses (because it represents a
-C<Code> object). Unlike functions and list operators with arguments
-(see above), a 0-ary term does not require parentheses even if followed
-immediately by a postfix.
+for a following argument list, which it may reject at run time.

+ my sub foo () {...}
+ foo; # okay
+ foo(); # okay
+ foo (),(),(); # okay
+ foo 1; # fails to dispatch
+
+The compiler is allowed to complain about anything it knows cannot
+succeed at run time. Note that a multi may contain () as one
+of its signatures, however:
+
+ my multi foo () {...}
+ my multi foo ($x) {...}
+ foo; # okay
+ foo(); # okay
+ foo (),(),(); # okay
+ foo 1; # okay
+
+To declare an item that is parsed as a simple term, you must use the
+form C<< term:<foo> >>, or some other form of constant declaration such
+as an enum declaration. Such a term never looks for its arguments,
+is never considered a list prefix operator, and may not work with
+subsequent parentheses because it will be parsed as a function call
+instead of the intended term. (The function in question may or
+may not exist.) For example, C<rand> is a simple term in Perl6
+and does not allow parens, because there is no C<rand()> function
+(though there's a C<$n.rand> method). Most constant values such as
+C<e> and C<pi> are in the same category. After parsing one of these
+the parser expects to see a postfix or an infix operator, not a term.
+Therefore any attempt to use a simple value as a list operator is
+destined to fail with an error indicating the parser saw two terms
+in a row.
+
+For those values (such as types) that do respond to parentheses
+(that is, that do the C<Callable> role), the parentheses (parsed as
+a postfix operator) are required in order to invoke the object:
+
+ my $i = Int.($x); # okay
+ my $i = Int($x); # okay
+ my $i = Int $x; # ILLEGAL, two terms in a row
+
=item *

A non-multi sub predeclared with an arity of exactly 1 also still
-parses as a list prefix operator. You must explicitly use the form
+parses as a list prefix operator expecting multiple arguments. You must explicitly use the form
C<< prefix:<foo> >> to declare C<foo> as a named unary in precedence;
it must still take a single positional parameter (though any number of
named parameters are allowed, which can be bound to adverbs).

comment 3 answer | Add comment
r25830 - docs/Perl6/Spec/S32­-setting-library Guest 20:32:42
 Author: lwall
Date: 2009-03-14 18:32:42 +0100 (Sat, 14 Mar 2009)
New Revision: 25830

Modified:
docs/Perl6/Spec/S32­-setting-library/IO.­pod
Log:
[IO] Massive overhaul, long overdue due to neglect of TimToady--


Modified: docs/Perl6/Spec/S32­-setting-library/IO.­pod
===================­====================­====================­========
--- docs/Perl6/Spec/S32­-setting-library/IO.­pod 2009-03-14 17:11:19 UTC (rev 25829)
+++ docs/Perl6/Spec/S32­-setting-library/IO.­pod 2009-03-14 17:32:42 UTC (rev 25830)
@@ -13,11 +13,11 @@
Mark Stosberg <mark@summersault.c­om>
Carl M sak <cmasak@gmail.com>
Moritz Lenz <moritz@faui2k3.org­>
- Tim Nelson <wayland@wayland.id­.au>
+ Tim Nelson <wayland@wayland.id­.au>
Daniel Ruoso <daniel@ruoso.com>
Date: 19 Feb 2009 extracted from S29-functions.pod; added stuff from S16-IO later
Last Modified: 14 Mar 2009
- Version: 4
+ Version: 5

The document is a draft.

@@ -27,97 +27,125 @@

=head2 IO

+[Note: if a method declaration indicates a method name qualified by
+type, it should be taken as shorthand to say which role or class the
+method is actually declared in.]
+
=over 4

+=item open
+
+ multi open (Str $name,
+ Bool :$­rw = False,
+ Bool :$­bin = False,
+ Str :$­enc = "Unicode",
+ Any :$­nl = "\n",
+ Bool :$­chomp = True,
+ ...
+ --> IO
+ ) is export
+
+A convenience method/function that hides most of the OO complexity.
+It will only open normal files. Text is the default. Note that
+the "Unicode" encoding implies figuring out which actual UTF is
+in use, either from a BOM or other heuristics. If heuristics are
+inconclusive, UTF-8 will be assumed. (No 8-bit encoding will ever
+be picked implicitly.) A file opened with C<:bin> may still be
+processed line-by-line, but IO will be in terms of C<Buf> rather
+than C<Str> types.
+
=item getc

- our Bool method getc (IO $self: *@LIST)
+ method getc (Int $chars = 1 --> Char)

See below for details.

=item print

- our Bool method print (IO $self: *@LIST)
- our Bool multi print (*@LIST)
- our Bool method print (Str $self: IO $io)
+ method print (*@LIST --> Bool)
+ multi print (*@LIST --> Bool)
+ method Str::print (IO $io --> Bool)
+ method Array::print (IO $io --> Bool)
+ method Hash::print (IO $io --> Bool)

See below for details.

=item say

- our Bool method say (IO $self: *@LIST)
- our Bool multi say (*@LIST)
- our Bool method say (Str $self: IO $io)
+ method say (*@LIST --> Bool)
+ multi say (*@LIST --> Bool)
+ method Str::say (IO $io --> Bool)
+ method Array::say (IO $io --> Bool)
+ method Hash::say (IO $io --> Bool)

See below for details.

=item printf

- our Bool method printf (IO $self: Str $fmt, *@LIST)
- our Bool multi printf (Str $fmt, *@LIST)
+ method printf (Str $fmt, *@LIST --> Bool)
+ multi printf (Str $fmt, *@LIST --> Bool)

See below for details.

=item uri

- IO::Streamable method uri(Str $uri);
- IO::Streamable sub uri(Str $uri);
+ method uri(Str $uri --> IO::Streamable);
+ sub uri(Str $uri --> IO::Streamable);

-Returns an appropriate IO::Streamable descendant, with the type depending on the uri
+Returns an appropriate C<IO::Streamable> descendant, with the type depending on the uri
passed in. Here are some example mappings:

- URI type IO type
- ======== =======
- file: IO::File or IO::Directory
- ftp: IO::Socket::TCP (data channel)
- http: IO::Socket::TCP
+ URI type IO type
+ ======== =======
+ file: IO::File or IO::Directory
+ ftp: IO::Socket::TCP (data channel)
+ http: IO::Socket::TCP

These can naturally be overridden or added to by other modules.

-=item %*PROTOCOLS global variable
+=item %*PROTOCOLS context variable

-For each protocol, stores a type name that should be instantiated by calling the .uri()
+For each protocol, stores a type name that should be instantiated by calling the C<uri>
constructor on that type, and passing in the appropriate uri.

=back

=head1 Roles

-The functionality of IO objects is broken down into several roles,
+The functionality of C<IO> objects is broken down into several roles,
which should identify the features each object supports.

=head2 IO

-The base role only tags that this is an IO object for more generic
+The base role only tags that this is an C<IO> object for more generic
purposes. It doesn't specify any methods or attributes.

=head2 IO::Readable

This role provides unbuffered read access to the data stream.

-role IO::Readable {
- has $.isReadable;
+ role IO::Readable {
+ has $.isReadable;
+ method read($buf is rw, Int $bytes --> Int)
+ }

- method Int read($buf is rw, Int $bytes)
-}
+When the C<$.isReadable> is set, it tries to change the readability of the filehandle. This
+is not always possible, but can be done in a number of cases. C<IO::Socket> can remove
+readability by calling C<shutdown>, for example.

-When the $.isReadable is set, it tries to change the readability of the filehandle. This
-is not always possible, but can be done in a number of cases. IO::Socket can remove
-readability by calling shutdown(), for example.
-
=over

-=item method Int read($buf is rw, Int $bytes)
+=item method read($buf is rw, Int $bytes --> Int)

-Tries to read $bytes bytes and store in $buf. The contents of $buf
+Tries to read C<$bytes> bytes and store in C<$buf>. The contents of C<$buf>
are replaced and the actual number of bytes read is returned. A return
of 0 means end of file. It might return unthrown failures, to be
-specified by each IO implementation.
+specified by each C<IO> implementation.

It is important to realize that this is "raw" read. You're going to
-have plain octets stored in $buf, if this is actually encoded data,
+have plain octets stored in C<$buf>, if this is actually encoded data,
you're going to need to encode it later, or use "getc" or other
-IO::Readable::Enco­ded methods.
+C<IO::Readable::En­coded> methods.

=back

@@ -125,28 +153,27 @@

This role provides unbuffered write access to the data stream.

-role IO::Writeable {
- has $.isWriteable;
+ role IO::Writeable {
+ has $.isWriteable;
+ method write($buf, Int $bytes --> Int)
+ }

- method Int write($buf, Int $bytes)
-}
-
-When the $.isWriteable is set, it tries to change the writeability of the filehandle.
-This is not always possible, but can be done in a number of cases. IO::Socket can remove
+When the C<$.isWriteable> is set, it tries to change the writeability of the filehandle.
+This is not always possible, but can be done in a number of cases. C<IO::Socket> can remove
writeability by calling shutdown(), for example.

=over

-=item method Int write($buf, Int $bytes)
+=item method write($buf, Int $bytes --> Int)

-Tries to write $bytes bytes of $buf. The actual number of bytes
+Tries to write C<$bytes> bytes of C<$buf>. The actual number of bytes
written is returned. It might return unthrown failures, to be
-specified by each IO implementation.
+specified by each C<IO> implementation.

-It is important to realize that this is "raw" write. $buf should
-contain plain octets that are going to be sent. If $buf contains
+It is important to realize that this is "raw" write. C<$buf> should
+contain plain octets that are going to be sent. If C<$buf> contains
encoded data, you should decode it first, or use "print" or other
-IO::Writeable::Enc­oded methods.
+C<IO::Writeable::E­ncoded> methods.

=back

@@ -154,7 +181,7 @@

=over

-=item method Bool eoi()
+=item method eoi( --> Bool)

EOI = End Of Input -- equivalent to End Of File, but applies to other kinds of sockets as
well.
@@ -162,12 +189,12 @@
Returns true if it's the end of the input (ie. end of file or whatever), returns false if
not, returns undef if we can't say for certain.

-=item method Bool seek(Int $position)
+=item method seek(Int $position --> Bool)

-Position this stream into $position. The meaning of this position is
+Position this stream into C<$position>. The meaning of this position is
always in "octets".

-=item method Int tell()
+=item method tell( --> Int)

Returns the current raw position in the stream in number of "octets".

@@ -180,11 +207,11 @@

=over

-=item method Bool flush()
+=item method flush( --> Bool)

Flushes the buffers associated with this object.

-=item method Bool autoflush() is rw
+=item method autoflush( --> Bool) is rw

Forces this object to keep its buffers empty

@@ -192,9 +219,9 @@
or print on the currently selected output channel.
Default is 0 (regardless of whether the channel is really buffered
by the system or not;
-$OUT_FH.autoflush tells you only whether you've asked Perl
+C<$OUT_FH.autoflus­h> tells you only whether you've asked Perl
explicitly to flush after each write).
-$*OUT will typically be line buffered if output is to the
+C<$*OUT> will typically be line buffered if output is to the
terminal and block buffered otherwise.
Setting this variable is useful primarily when you are
outputting to a pipe or socket,
@@ -210,32 +237,30 @@
This role represents objects that depend on some external resource,
which means that data might not be available at request.

-role IO::Streamable does IO {...}
+ role IO::Streamable does IO {...}

=over

=item new()

- method IO::Streamable new(
- Bool :$­NoOpen,
- );
+ method new( Bool :$­NoOpen --> IO::Streamable) {...}

-Unless the NoOpen option is passed, an open will be done on the IO object when it is
+Unless the NoOpen option is passed, an open will be done on the C<IO> object when it is
created.

-=item method Bool blocking() is rw
+=item method blocking( --> Bool) is rw

-This allows the user to control wether this object should do a
+This allows the user to control whether this object should do a
blocking wait or immediatly return in the case of not having data
available.

=item uri

- method IO::Streamable uri(Str $uri) {...}
+ method uri(Str $uri --> IO::Streamable) {...}

This should be callable on the class, and act like a kind of "new()" function. When given
-a URI, it returns an IO::Streamable of the appropriate type, and throws an error when an
-inappropriate type is passed in. For example, calling IO::File.uri('http:­//....') will
+a URI, it returns an C<IO::Streamable> of the appropriate type, and throws an error when an
+inappropriate type is passed in. For example, calling C<IO::File.uri('htt­p://....')> will
throw an error (but will suggest using just uri('http://...') instead).

=back
@@ -246,9 +271,9 @@

=over

-=item method Str encoding() is rw
+=item method encoding( --> Str) is rw

-=item method Str locale() is rw
+=item method locale( --> Str) is rw

Encoding and locale are required for sane conversions.

@@ -257,16 +282,16 @@
=head2 IO::Readable::Encod­ed

This role provides encoded access to a readable data stream, implies
-IO::Encoded. Might imply IO::Buffered, but that's not a requirement.
+C<IO::Encoded>. Might imply C<IO::Buffered>, but that's not a requirement.

=over

-=item method Int input-line()
+=item method ins( --> Int)

-Returns the number of lines (records) that have been input.
+Returns the number of lines or records that have been input.
Now with cleaned-up localization usage.

-=item method Str input-line-separato­r() is rw
+=item method input-line-separato­r( --> Str) is rw

This regulates how "readline" behaves.

@@ -284,43 +309,46 @@
that the next input character belongs to the next paragraph,
even if it's a newline.

-Remember: the value of input-line-separato­r is a string, not a regex.
-awk has to be better for something. :-)­
+You may also set it to a regular expression. The value of C<$/>
+will be (temporarily) set to the matched separator upon input,
+if you care about the contents of the separator.

-=item method Str input-field-separat­or() is rw
+=item method input-field-separat­or( --> Str) is rw

-This regulates how "readfield" behaves.
+[Deprecated.]

-=item method Str input-escape() is rw
+=item method input-escape( --> Str) is rw

-This allows the definition of a escape character, which should be used
-by readline and readfield.
+[Deprecated.]

-=item method Str readline()
+=item method readline( --> Str)

-Reads the stream before it finds a $.input-line-separa­tor and
-returns it (including the separator). If $.input-escape is set, it
-should pay attention to that.
+Reads the stream before it finds a C<$.input-line-sepa­rator> and
+returns it (autochomped by default).

-=item method Str readfield()
+=item method readfield( --> Str)

-Reads the stream before it finds a $.input-field-separ­ator and returns
-it (including the separator). If a readfield finds a
-$.input-line-separ­ator it consumes the line separator, but returns
-undef. If $.input-escape is set, it should pay attention to that.
+[Deprecated. Use split or comb or an ILS regex.]

-=item method Str getc(Int $char? = 1)
+=item method getc(Int $chars = 1 --> Char)

-Reads the next $char character in the set $.encoding according to
-the $.locale, or the undefined value at end of file, or if there was
-an error (in the latter case C<$!> is set).
+Reads the next C<$char> character in the set C<$.encoding>,
+or C<Failure> at end of file, or if there was
+an error (in either case C<$!> is set). Note that this
+function cannot be used interactively as a C<readkey()> function, since under
+Unicode you can't tell the end of a grapheme until you
+see the beginning of the next one.

+[TODO someone needs to define something like C<readkey()> for terminal IO.
+Though most event-based programs will just want to feed keystrokes into the
+event queue.]
+
=back

=head2 IO::Writeable::Enco­ded

This role provides encoded access to a writeable data stream, implies
-IO::Encoded. Might imply IO::Buffered, but that's not a requirement.
+C<IO::Encoded>. Might imply C<IO::Buffered>, but that's not a requirement.

If these are called in their non-object form, they operate on C<$*OUT>, except in the
case of warn(), which operates on C<$*ERR>. The form with leading dot prints C<$_> to
@@ -328,75 +356,56 @@

=over

-=item method Int output-line()
+=item Int method outs()

-Returns the number of lines (records) that have been output so far.
+Returns the number of lines or records that have been output so far.

-=item method Str output-line-separat­or() is rw
+=item method output-line-separat­or( --> Str) is rw

-This regulates how say and print(%hash) behaves.
+This regulates how say behaves.

-=item method Str output-field-separa­tor() is rw
+=item method output-field-separa­tor( --> Str) is rw

-This regulates how print(@arr), say(@arr), print(%hash) and
-say(%hash) behave.
+[Deprecated.]

-=item method Str output-escape() is rw
+=item method output-escape( --> Str) is rw

-This allows the definition of a escape character, which should be used
-by say and print to preserve the line/field semantics.
+[Deprecated.]

-=item method Bool print(Str $str)
+=item method Str::print (IO $io = $*OUT --> Bool)

-=item method Bool say(Str $str)
+=item method Str::say (IO $io = $*OUT --> Bool)

-Sends $str to the data stream doing proper encoding conversions. Say
-sends an additional $.output-line-separ­ator. This should also
-convert "\n" to the desired $.output-line-separ­ator.
+=item method Array::print(IO $io = $*OUT --> Bool)

-=item method Bool print(Array @arr)
+=item method Array::say(IO $io = $*OUT --> Bool)

-=item method Bool say(Array @arr)
+=item method Hash::print(IO $io = $*OUT --> Bool)

-Sends each element of @arr separated by $.output-field-sepa­rator. Say
-should add an additional $.output-line-separ­ator. If an element
-contains the $.output-line-separ­ator or the
-$.output-field-sea­parator and a $.output-escape is defined, it should
-do the escaping.
+=item method Hash::say(IO $io = $*OUT --> Bool)

-=item method Bool print(Hash %hash)
+Stringifies the invocant (if necessary) and then sends it to the output.
+C<say> should add an additional C<$.output-line-sep­arator>.

-=item method Bool say(Hash %hash)

-Sends each pair of the hash separated by $.output-line-separ­ator,
-with key and value separated by $.output-field-sepa­rator. If one of
-those contains a $.output-line-separ­ator or a
-$.output-field-sea­parator and $.output-escape is set, it should do the
-escaping.
+=item method print (*@LIST --> Bool)

-=item our Bool method print (IO $self: *@LIST)
+=item multi print (*@LIST --> Bool)

-=item our Bool multi print (*@LIST)

-=item our Bool method print (Str $self: IO $io)
+Stringifies each element, concatenates those strings, and sends the
+result to the output.
+Returns C<Bool::True> if successful, C<Failure> otherwise.

-Prints a string or a list of strings. Returns Bool::True if
-successful, Failure otherwise. The IO handle, if supplied, must be
-an object that supports I/O. Indirect objects in Perl 6 must always
-be followed by a colon, and any indirect object more complicated than
-a variable should be put into parentheses.
-
It is a compiler error to use a bare C<print> without arguments.
(However, it's fine if you have an explicit argument list that evaluates to
the empty list at runtime.)

-=item say our Bool method say (IO $self: *@LIST)
+=item method say (*@LIST --> Bool)

-=item our Bool multi say (*@LIST)
+=item multi say (*@LIST --> Bool)

-=item our Bool method say (Str $self: IO $io)
-
-This is identical to print() except that it auto-appends a newline after
+This is identical to print() except that it auto-appends the C<output-line-separ­ator> after
the final argument.

Was: print "Hello, world!\n";
@@ -405,52 +414,57 @@
As with C<print>, it is a compiler error to use a bare C<say> without
arguments.

-=item our Bool method printf (IO $self: Str $fmt, *@LIST)
+=item method printf ($self: Str $fmt, *@LIST --> Bool)

-=item our Bool multi printf (Str $fmt, *@LIST)
+=item multi printf (Str $fmt, *@LIST --> Bool)

-The function form works as in Perl 5 and always prints to $*OUT.
-The method form uses IO handles, not formats, as objects.
+The function form works as in Perl 5 and always prints to C<$*OUT>.

=back

+For any handle marked as textual, all these output calls intercept any newline
+character and translate it to the current C<output-line-separ­ator> if it
+is defined as something other than newline. No such translation is done on
+binary handles, though you may still specify a record separator. In any case,
+escaping separators is the responsibility of the programmer.
+
=head2 IO::Closeable

This role indicates that this object can be closed.

=over

-=item method Bool close()
+=item method close( --> Bool)

Closes the file or pipe associated with the object.

-Returns True on success, but might return an unthrown failure.
-Returns true only if IO buffers are successfully flushed and closes the system
+Returns C<True> on success, but might return an unthrown C<Failure>.
+Returns true only if C<IO> buffers are successfully flushed and closes the system
file descriptor.

-Unlike in Perl 5, an IO object is not a special symbol table entry
+Unlike in Perl 5, an C<IO> object is not a special symbol table entry
neither this object is available magically anywhere else. But as in
-Perl 5, unless stated otherwise, IO::Closeable objects always close
-themselves during destruction
+Perl 5, unless stated otherwise, C<IO::Closeable> objects always close
+themselves during destruction.

=back

=head2 IO::Socket

-role IO::Socket {
- has %.options;
-...
-}
+ role IO::Socket {
+ has %.options;
+ ...
+ }

-Accessing the %.options would on Unix be done with getsockopt/setsocko­pt.
+Accessing the C<%.options> would on Unix be done with I<getsockopt(2)>/I<­setsockopt(2)>.

=over

=item pair

- our List of IO method pair(Int $domain, Int $type, Int $protocol)
+ method pair(Int $domain, Int $type, Int $protocol --> List of IO)

-A wrapper for socketpair(2), returns a pair of IO objects representing the
+A wrapper for I<socketpair(2)>, returns a pair of C<IO> objects representing the
reader and writer ends of the socket.

use Socket;
@@ -463,13 +477,13 @@

=item open

- method open()
+ method open()

- Does a bind() and a listen().
+Does a I<bind(2)> and a I<listen(2)>.

=item accept

- method IO::Socket accept()
+ method accept( --> IO::Socket)

=head2 IO::FileDescriptor

@@ -486,52 +500,52 @@

=head1 Classes

-=head2 IO::File
+=head2 IO::File

This does file input and output.

-class IO::File does IO::Streamable {
-...
-}
+ class IO::File does IO::Streamable {
+ ...
+ }

=over

=item new

- method new(
- FSNode :$­FSNode,
- Str :$­Filename,
- :$­fd
- Bool :$­NoOpen,
- :$­Writeable,
- :$­Readable
- );
+ method new(
+ FSNode :$­FSNode,
+ Str :$­Filename,
+ :$­fd
+ Bool :$­NoOpen,
+ :$­Writeable,
+ :$­Readable
+ );

-The FSNode, Filename and fd options are mutually exclusive. If "use portable" is in
-effect, the Filename option throws an error; use an FSNode instead.
+The C<FSNode>, C<Filename> and C<fd> options are mutually exclusive. If "C<use portable>" is in
+effect, the C<Filename> option throws an error; use an C<FSNode> instead.

-NoOpen is passed to IO::Streamable.new(­)
+C<NoOpen> is passed to C<IO::Streamable.ne­w()>

Examples:

- # Read -- throws errors with 'use portable'
- $fobj = new IO::File(Filename => $filename);
+ # Read -- throws errors with 'use portable'
+ $fobj = new IO::File(Filename => $filename);

- # Write -- works with 'use portable'
- $fobj = new IO::File(
- FSNode => IO::FSNode.new(type­ => 'Unix', Filename => $filename),
- Writeable => 1
- );
+ # Write -- works with 'use portable'
+ $fobj = new IO::File(
+ FSNode => IO::FSNode.new(type­ => 'Unix', Filename => $filename),
+ Writeable => 1
+ );

- # Read using file descriptor
- $fobj = new IO::File(fd => $fd);
+ # Read using file descriptor
+ $fobj = new IO::File(fd => $fd);

-This final example associates an IO object with an already-open file descriptor,
+This final example associates an C<IO> object with an already-open file descriptor,
presumably passed in from the parent process.

=item open()

-This function opens a file that had the "NoOpen" option passed to the new() method.
+This function opens a file that had the C<NoOpen> option passed to the C<new> method.

=item IO.truncate

@@ -541,43 +555,43 @@

=back

-=head2 IO::FileSystem
+=head2 IO::FileSystem

This represents the filesystem.

-class IO::FileSystem does IO::Streamable {
- has Str $.fstype; # ext3, ntfs, vfat, reiserfs, etc
- has Str $.illegal-chars; # ie. /\x0
- has Int $.max-path;
-...
-}
+ class IO::FileSystem does IO::Streamable {
+ has Str $.fstype; # ext3, ntfs, vfat, reiserfs, etc
+ has Str $.illegal-chars; # ie. /\x0
+ has Int $.max-path;
+ ...
+ }

=over 4

=item glob

-Returns FSNode objects
+Returns C<FSNode> objects.

=item find

-Returns FSNode objects
+Returns C<FSNode> objects.

=item rename

=back

-=head2 IO::FSNode
+=head2 IO::FSNode

-class IO::FSNode {
- has Array of IO::FSNodeACL @.ACLs;
- has Hash of %.times;
-...
-}
+ class IO::FSNode {
+ has Array of IO::FSNodeACL @.ACLs;
+ has Hash of %.times;
+ ...
+ }

-The %times has keys that can be eg. ctime, Modification, and Access (and maybe others on
-other operating systems), and the values are all Temporal::Instant objects.
+The C<%times> has keys that can be eg. C<ctime>, C<Modification>, and C<Access> (and maybe others on
+other operating systems), and the values are all C<Temporal::Instant­> objects.

-When .path() is implemented, it should return the path that this was opened with.
+When C<.path> is implemented, it should return the path that this was opened with.

=over 4

@@ -594,41 +608,41 @@
operator takes one argument, either a filename or a filehandle, and
tests the associated file to see if something is true about it.

-A Pair used as a pattern is treated as a file test.
+A C<Pair> used as a pattern is treated as a file test.

- :r File is readable by effective uid/gid.
- :w File is writable by effective uid/gid.
- :x File is executable by effective uid/gid.
- :o File is owned by effective uid.
+ :r File is readable by effective uid/gid.
+ :w File is writable by effective uid/gid.
+ :x File is executable by effective uid/gid.
+ :o File is owned by effective uid.

- :R File is readable by real uid/gid.
- :W File is writable by real uid/gid.
- :X File is executable by real uid/gid.
- :O File is owned by real uid.
+ :R File is readable by real uid/gid.
+ :W File is writable by real uid/gid.
+ :X File is executable by real uid/gid.
+ :O File is owned by real uid.

- :e File exists.
- :z File has zero size (is empty).
- :s File has nonzero size (returns size in bytes).
+ :e File exists.
+ :z File has zero size (is empty).
+ :s File has nonzero size (returns size in bytes).

- :f File is a plain file.
- :d File is a directory.
- :l File is a symbolic link.
- :p­ File is a named pipe (FIFO), or Filehandle is a pipe.
- :S File is a socket.
- :b File is a block special file.
- :c File is a character special file.
- :t Filehandle is opened to a tty.
+ :f File is a plain file.
+ :d File is a directory.
+ :l File is a symbolic link.
+ :p­ File is a named pipe (FIFO), or Filehandle is a pipe.
+ :S File is a socket.
+ :b File is a block special file.
+ :c File is a character special file.
+ :t Filehandle is opened to a tty.

- :u File has setuid bit set.
- :g File has setgid bit set.
- :k File has sticky bit set.
+ :u File has setuid bit set.
+ :g File has setgid bit set.
+ :k File has sticky bit set.

- :T File is an ASCII text file (heuristic guess).
- :B File is a "binary" file (opposite of :T).
+ :T File is an ASCII text file (heuristic guess).
+ :B File is a "binary" file (opposite of :T).

- :M Script start time minus file modification time, in days.
- :A Same for access time.
- :C Same for inode change time (Unix, may differ for other platforms)
+ :M Script start time minus file modification time, in days.
+ :A Same for access time.
+ :C Same for inode change time (Unix, may differ for other platforms)

The interpretation of the file permission operators C<:r>, C<:R>,
C<:w>, C<:W>, C<:x>, and C<:X> is by default based on:
@@ -650,7 +664,7 @@
Also note that, for the superuser on the local filesystems, the C<:r>,
C<:R>, C<:w>, and C<:W> tests always return 1, and C<:x> and C<:X> return 1
if any execute bit is set in the mode. Scripts run by the superuser
-may thus need to do a stat() to determine the actual mode of the file,
+may thus need to do a C<stat> to determine the actual mode of the file,
or temporarily set their effective uid to something else.

The C<:T> and C<:B> switches work as follows. The first block or so of the
@@ -658,7 +672,7 @@
characters with the high bit set. If too many strange characters (>30%)
are found, it's a C<:B> file; otherwise it's a C<:T> file. Also, any file
containing null in the first block is considered a binary file. If C<:T>
-or C<:B> is used on a filehandle, the current IO buffer is examined
+or C<:B> is used on a filehandle, the current C<IO> buffer is examined
rather than the first block. Both C<:T> and C<:B> return true on a null
file, or a file at EOF when testing a filehandle. Because you have to
read a file to do the C<:T> test, on most occasions you want to use a C<:f>
@@ -675,13 +689,13 @@

=item realpath

- method Str realpath();
+ method realpath( --> Str);

Gets the real path to the object, resolving softlinks/shortcuts­, etc

=item === operator

- method infix:<===>(Str $filename);
+ method infix:<===>(Str $filename);

Test whether the specified filename is the same file as this file. On a Unix system,
this would presumably be done by comparing inode numbers or something.
@@ -690,45 +704,45 @@

This is called automatically on object creation.

-multi method new(Array of Str :@PathElements);
-multi method new(Str :$­Type, Str :$­Path, Str :$­Create);
-multi method new(Str :$­Path);
+ multi method new(Array of Str :@PathElements);
+ multi method new(Str :$­Type, Str :$­Path, Str :$­Create);
+ multi method new(Str :$­Path);

-This last throws an error if "use portable" pragma is used.
+This last throws an error if "C<use portable>" pragma is used.

-If the "Create" option is passed in, and the node doesn't exist in the filesystem, it
-attempts to create the node; this can be used for "mkdir", "link", and similar
+If the C<Create> option is passed in, and the node doesn't exist in the filesystem, it
+attempts to create the node; this can be used for I<mkdir>, I<link>, and similar
functionality.

Examples:

- $fsnode = new IO::FSNode(PathElem­ents => ['home', 'wayland']);
- $fsnode = new IO::FSNode(Type => 'Unix', Path => '/home/wayland');
- $fsnode = new IO::FSNode(Path => '/home/wayland'); # portability error
+ $fsnode = new IO::FSNode(PathElem­ents => ['home', 'wayland']);
+ $fsnode = new IO::FSNode(Type => 'Unix', Path => '/home/wayland');
+ $fsnode = new IO::FSNode(Path => '/home/wayland'); # portability error

=item delete

-This deletes the FSNode from the filesystem. If the node has children, it throws an error
-unless the "Recursive" option is specified. Returns the number of nodes deleted.
+This deletes the C<FSNode> from the filesystem. If the node has children, it throws an error
+unless the C<Recursive> option is specified. Returns the number of nodes deleted.

=back

-=head2 IO::FSNodeACL
+=head2 IO::FSNodeACL

This is a basic abstraction; for better control, use the operating-system specific
interfaces, over which this is a thin veneer.

-class IO::FSNodeACL {
- has Str $.type; # "User", "Group", "Everyone", ???
- has Str $.id; # username or groupname; unused for $type eq "Everyone"
- has %.permissions;
- # Unsupported values may (or may not) throw
- # UnsupportedPermissi­on when set or read
- has IO::FSNode $.owningObject;
-...
-}
+ class IO::FSNodeACL {
+ has Str $.type; # "User", "Group", "Everyone", ???
+ has Str $.id; # username or groupname; unused for $type eq "Everyone"
+ has %.permissions;
+ # Unsupported values may (or may not) throw
+ # UnsupportedPermissi­on when set or read
+ has IO::FSNode $.owningObject;
+ ...
+ }

-The permissions used in %permissions are:
+The permissions used in C<%permissions> are:

=over

@@ -750,51 +764,76 @@
=item Default

An ACL of User,fred,Default sets the user "fred" to be the owner of the file. This can be
-done with groups too. Work on Unix, at least.
+done with groups too. Works on Unix, at least.

=back

-The $.owningObject attribute of FSNodeACL shows what the ACL is set on. On a
+The C<$.owningObject> attribute of C<FSNodeACL> shows what the ACL is set on. On a
Windows system, this can be a parent directory, as permissions are inherited.

-=head2 IO::FileNode
+=head2 IO::FileNode

- role IO::FileNode does IO::FSNode {
-...
- }
+ role IO::FileNode does IO::FSNode {
+ ...
+ }

=over

-=item our List multi method lines (IO $handle:)­ is export;
+=item lines

-=item our List multi lines (Str $filename);
+ method lines ($handle:
+ Bool :$­bin = False,
+ Str :$­enc = "Unicode",
+ Any :$­nl = "\n",
+ Bool :$­chomp = True,
+ --> List
+ ) is export

-Returns all the lines of a file as a (lazy) List regardless of context.
-See also C<slurp>.
+ multi lines (Str $filename,
+ Bool :$­bin = False,
+ Str :$­enc = "Unicode",
+ Any :$­nl = "\n",
+ Bool :$­chomp = True,
+ --> List
+ )

-=item our Item multi method slurp (IO $handle: *%opts) is export;
+Returns all the lines of a file as a C<List> regardless of context.
+See also C<slurp>. Note that lists are lazy by default, but you
+can always ask for C<eager lines>.

-=item our Item multi slurp (Str $filename, *%opts);
+=item slurp

-Slurps the entire file into a Str or Buf regardless of context.
-(See also C<lines>.) Whether a Str or Buf is returned depends on
-the options.
+ method slurp ($handle:
+ Bool :$­bin = False,
+ Str :$­enc = "Unicode",
+ --> Str|Buf
+ ) is export
+ multi slurp (Str $filename
+ Bool :$­bin = False,
+ Str :$­enc = "Unicode",
+ --> Str|Buf
+ )

+Slurps the entire file into a C<Str> (or C<Buf> if C<:bin>) regardless of context.
+(See also C<lines>.)
+
=back

-=head2 IO::DirectoryNode
+=head2 IO::DirectoryNode

- role IO::DirectoryNode does IO::FSNode {
-...
- }
+ role IO::DirectoryNode does IO::FSNode {
+ ...
+ }

=item open

- $dir.open();
+ $dir.open(
+ Str :$­enc = "Unicode",
+ );

-Opens a directory for processing, if the new() method was passed the NoOpen option.
+Opens a directory for processing, if the C<new> method was passed the C<NoOpen> option.
Makes the directory looks like
-a list of autochomped lines, so just use ordinary IO operators after the open.
+a list of autochomped lines, so just use ordinary C<IO> operators after the open.

=item rmdir FILENAME
X<rmdir> X<rd> X<directory, remove>
@@ -802,39 +841,39 @@
=item rmdir

Deletes the directory specified by FILENAME if that directory is
-empty. If it succeeds it returns true, otherwise it returns false and
-sets C<$!> (errno). If FILENAME is omitted, uses C<$_>.
+empty. If it succeeds it returns true, otherwise it returns C<Failure> and
+sets C<$!> (errno).

=head2 IO::LinkNode

- role IO::LinkNode does IO::FSNode {
-...
- }
+ role IO::LinkNode does IO::FSNode {
+ ...
+ }

=item new

Creates a new link in the filesystem.

- IO::LinkNode.new(
- Name => '/home/wayland/syml­ink.txt'
- Target => '/home/wayland/real­file.txt',
- Type => 'Hard', # Default is Symbolic
- );
+ IO::LinkNode.new(
+ Name => '/home/wayland/syml­ink.txt'
+ Target => '/home/wayland/real­file.txt',
+ Type => 'Hard', # Default is Symbolic
+ );

Reads in the previously created symlink.

- $link = IO::LinkNode.new(
- Name => '/home/wayland/syml­ink.txt',
- );
- print $link.target; # prints /home/wayland/realf­ile.txt
+ $link = IO::LinkNode.new(
+ Name => '/home/wayland/syml­ink.txt',
+ );
+ print $link.target; # prints /home/wayland/realf­ile.txt

-Neither of these is "use portable" compatible.
+Neither of these is "C<use portable>" compatible.

-=head2 IO::Socket::TCP
+=head2 IO::Socket::TCP

-class IO::Socket::TCP does IO::Socket does IO::Streamable {
-...
-}
+ class IO::Socket::TCP does IO::Socket does IO::Streamable {
+ ...
+ }

=over

@@ -848,32 +887,33 @@

=item new

- method IO::Socket::TCP new(
- Str :$­RemoteHost, Str :$­RemotePort,
- Str :$­LocalHost, Str :$­LocalPort,
- Bool :$­Blocking,
- Bool :$­NoOpen
- );
+ method new(
+ Str :$­RemoteHost, Str :$­RemotePort,
+ Str :$­LocalHost, Str :$­LocalPort,
+ Bool :$­Blocking,
+ Bool :$­NoOpen
+ --> IO::Socket::TCP
+ ) {...}

-The NoOpen option is passed to IO::Streamable.new(­)
+The C<NoOpen> option is passed to C<IO::Streamable.ne­w()>.

IPv6 is supported.

=item open

- method open()
+ method open()

-If it's not an IO::Listening, it does a connect().
+If it's not an C<IO::Listening>, it does a C<connect()>.

It's intended for the case where the creation of the object didn't do one.

-=item method Int read($buf is rw, Int $bytes)
+=item method read($buf is rw, Int $bytes --> Int)

-Does a recv().
+Does a I<recv(2)>.

-=item method Int write($buf, Int $bytes)
+=item method write($buf, Int $bytes --> Int)

-Does a send().
+Does a I<send(2)>.

=item IO.getpeername

@@ -883,63 +923,53 @@

=head2 IO::Pipe

-class IO::Pipe does IO::Streamable {
-...
-}
+ class IO::Pipe does IO::Streamable {
+ ...
+ }

-May also do IO::Readable and IO::Writable, depending on opening method.
+May also do C<IO::Readable> and C<IO::Writable>, depending on opening method.

=over

=item close()

If the file handle came from a piped open, C<close> will additionally
-return false if one of the other system calls involved fails, or if the
-program exits with non-zero status. (If the only problem was that the
-program exited non-zero, C<$!> will be set to C<0>.) Closing a pipe
+return C<Failure> (aliased to C<$!>) if one of the other system calls involved fails, or if the
+program exits with non-zero status. The exception object will contain any
+pertinent informatoin. Closing a pipe
also waits for the process executing on the pipe to complete, in case you
want to look at the output of the pipe afterwards, and
-implicitly puts the exit status value of that command into C<$!>.
+implicitly puts the exit status value into the C<Failure> object if necessary.

-=item Pipe.to
+=item IO::Pipe.to

- our IO method to(Str $command, *%opts)
+ method to(Str $command, *%opts --> Bool)
+ method to(Str *@command, *%opts --> Bool)

-Opens a one-way pipe writing to $command. IO redirection for
-stderr is specified with :err(IO) or :err<Str>. Other IO redirection
+Opens a one-way pipe writing to C<$command>. C<IO> redirection for
+stderr is specified with C<:err(IO)> or C<< :err<Str> >>. Other C<IO> redirection
is done with feed operators. XXX how to specify "2>&1"?

-=item Pipe.from
+=item IO::Pipe.from

- our IO method from(Str $command, *%opts)
+ method from(Str $command, *%opts --> Bool)
+ method from(Str *@command, *%opts --> Bool)

-Opens a one-way pipe reading from $command. IO redirection for
-stderr is specified with :err(IO) or :err<Str>. Other IO redirection
+Opens a one-way pipe reading from $command. C<IO> redirection for
+stderr is specified with C<:err(IO)> or C<< :err<Str> >>. Other C<IO> redirection
is done with feed operators. XXX how to specify "2>&1"?

-=item Pipe.pair
+=item IO::Pipe.pair

- our List of IO method pair()
+ method pair(--> List of IO::Pipe)

-A wrapper for pipe(2), returns a pair of IO objects representing the
+A wrapper for I<pipe(2)>, returns a pair of C<IO> objects representing the
reader and writer ends of the pipe.

- ($r, $w) = Pipe.pair;
+ ($r, $w) = IO::Pipe.pair;

=back

-=head1 Calls that operate on the default IO handle
-
-=over
-
-=item close()
-
-=item open()
-
-...
-
-=back
-
=head1 OS-specific classes

=head2 Unix
@@ -948,7 +978,7 @@

=item chown

- our Int multi chown ($uid = -1, $gid = -1, *@files)
+ multi chown ($uid = -1, $gid = -1, *@files --> Int)

Changes the owner (and group) of a list of files. The first
two elements of the list must be the numeric uid and gid, in
@@ -1004,7 +1034,7 @@

=item IO.stat

- $node.stat(Type => 'Link'); # Type => Link does an lstat instead
+ $node.stat(Bool :$­link); # :link does an lstat instead

Returns a stat buffer. If the lstat succeeds, the stat buffer evaluates
to true, and additional file tests may be performed on the value. If
@@ -1013,18 +1043,18 @@

=head2 IO::POSIX

-Indicates that this object can perform standard posix IO
-operations. It implies IO::Readable and IO::Writeable.
+Indicates that this object can perform standard posix C<IO>
+operations. It implies C<IO::Readable> and C<IO::Writeable>.

=over

-=item method IO dup()
+=item method dup( --> IO)

=item has Bool $.blocking is rw

-=item method Bool flock(:$r,:$­w)
+=item method flock(:$r,:$­w --> Bool)

-=item method Bool funlock()
+=item method funlock( --> Bool)

=item ...

@@ -1032,14 +1062,16 @@

=head2 IO::File::Windows

-role IO::File::Windows does IO::File {
- method open(Bool :$­BinaryMode) {...}
-}
+ role IO::File::Windows does IO::File {
+ method open(Bool :$­BinaryMode) {...}
+ }

=item open()

-Takes the BinaryMode option to open the file in binary mode.
+Takes the C<BinaryMode> option to open the file in binary mode.

+[XXX bogus, now under Unicode *all* systems must distinguish text from binary.]
+
=head1 Unfiled

=over 4
@@ -1052,9 +1084,9 @@

=item prompt

- our Str prompt (Str $prompt)
+ multi prompt (Str $prompt --> Str)

- Should there be an IO::Interactive role?
+Should there be an IO::Interactive role?

=item Str.readpipe

@@ -1072,19 +1104,19 @@

=item IO.eof

-Gone, see IO::Endable
+Gone, see C<IO::Endable>.

=item IO.fileno

-See IO::FileDescriptor
+See C<IO::FileDescripto­r>.

=item lstat

-Use stat() with the Type => 'Link' option.
+Use C<stat> with the C<:link> option.

=item IO.name

-Changed to .path(), but we haven't gotten around to specifying this on all of them.
+Changed to C<.path>, but we haven't gotten around to specifying this on all of them.

The C<.name> method returns the name of the file/socket/uri the handle
was opened with, if known. Returns undef otherwise. There is no
@@ -1100,7 +1132,7 @@

=item IO.shutdown()

-Gone, see IO::Socket.close(),­ $IO::Readable.isRea­dable, and $IO::Writeable.isWr­iteable
+Gone, see C<IO::Socket.close(­)>, C<$IO::Readable.isR­eadable>, and C<$IO::Writeable.is­Writeable>

=item socketpair

@@ -1108,15 +1140,15 @@

=item IO.sysread

-Gone, see IO::Readable.read()­
+Gone, see C<IO::Readable.read­()>.

=item IO.syswrite

-Gone, see IO::Writeable.read(­)
+Gone, see C<IO::Writeable.rea­d()>.

=item utime

-Gone, see %IO::FSNode.times.
+Gone, see C<IO::FSNode.times>­.

=back

@@ -1125,4 +1157,4 @@
Please post errors and feedback to perl6-language. If you are making
a general laundry list, please separate messages by topic.

-=cut
+=for vim:set expandtab sw=4:

Add comment

Add new topic:

How:  Register )
 
Login:   Password:   
Comments by: Premoderation:
Topic:
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > Perl web-programmingGo to page: « previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | next »

see also:
Replication over SSL
Redhat 7.3 and JDBC
Re: [pgsql-general] Daily Digest V1…
pass tests:
see also:
How to convert DVD and Video to AVI
Free Ping of death tool, coded by…
How to Convert any Video(including Mod…

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .