[svn:perl6-synopsis] r13564 - doc/trunk/design/syn

2007-02-02 Thread larry
Author: larry
Date: Fri Feb  2 01:07:36 2007
New Revision: 13564

Modified:
   doc/trunk/design/syn/S03.pod
   doc/trunk/design/syn/S12.pod

Log:
Also allow colon pair syntax for a methodlike kind of filetest.
A bit of junctional cleanup.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podFri Feb  2 01:07:36 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 1 Feb 2007
+  Last Modified: 2 Feb 2007
   Number: 3
-  Version: 95
+  Version: 96
 
 =head1 Overview
 
@@ -29,7 +29,7 @@
 Level   Examples
 =   
 Terms   42 3.14 "eek" qq["foo"] $x :!verbose
-Method postfix  .meth .+ .? .* .() .[] .{} .<> .«» .:: .= .^
+Method postfix  .meth .+ .? .* .() .[] .{} .<> .«» .:: .= .^ .:
 Autoincrement   ++ --
 Exponentiation  **
 Symbolic unary  ! + - ~ ? $ @ % & | +^ ~^ ?^ \ ^ =
@@ -1408,12 +1408,23 @@
 
 =item *
 
-The filetest operators are gone.  We now use a Pair as a pattern to
-get the same effect:
+The filetest operators are gone.  We now use a Pair as either a
+pattern or a method name to get the same effect:
 
 if $filename ~~ :e { say "exists" }
+if $filename.:e { say "exists" }
 
-These tests may be combined via junctions:
+Both of these forms actually translate to
+
+if $filename.TEST(:e) { say "exists" }
+
+which which is a generic mechanism that dispatches to the object's
+class to find the definition of C.  (It just happens that C
+(filenames) and C (filehandles) default to the expected filetest
+semantics, but C<$regex.:i> might tell you whether the regex is case
+insensitive, for instance.)
+
+Using the pattern form, multiple tests may be combined via junctions:
 
 given $handle {
 when all :r :w :x {...}
@@ -1421,14 +1432,24 @@
 when *{...}
 }
 
+The advantage of the method form is that it can be used in places that
+require tighter precedence than C<~~> provides:
+
+sort { $^a.:M <=> $^b.:M }, @files
+
+though that's a silly example since you could just write:
+
+sort { .:M }, @files
+
+But that demonstrates the other advantage of the method form.
+
 In general, the user need not worry about caching the stat buffer.
-The stat buffer will automatically be reused if the same object is
-queried and the stat buffer has not "expired", where that is defined
-as older than a second or so.  If this is a concern, an explicit stat()
-or lstat() will automatically reset the stat buffer, as will switching
-to a different filename or handle.
+The stat buffer will automatically be reused if the same object has
+recently been queried, where "recently" is defined as less than a
+second or so.  If this is a concern, an explicit stat() or lstat()
+on that file will automatically reset the stat buffer for that file.
 
-Note that C<$file ~~ :s> still returns the filesize, but C<:!s> is true
+Note that C<:s> still returns the filesize, but C<:!s> is true
 only if the file is of size 0.
 
 =item *
@@ -1832,10 +1853,14 @@
 
 Junctions are specifically unordered.  So if you say
 
-for all(@foo) {...}
+foo() | bar() | baz() == 42
 
-it indicates to the compiler that there is no coupling between loop
-iterations and they can be run in any order or even in parallel.  XXX bogus
+it indicates to the compiler that there is no coupling between
+the junctional arguments.  They can be evaluated in any order or in
+parallel.  They can short-circuit as soon as any of them return 42,
+and not run the others at all.  Or if running in parallel, the first
+successful thread may terminate the other threads abruptly.  In general
+you probably want to avoid code with side effects in junctions.
 
 Use of negative operators with syntactically recognizable junctions may
 produce a warning on code that works differently in English than in Perl.

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podFri Feb  2 01:07:36 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 1 Feb 2007
+  Last Modified: 2 Feb 2007
   Number: 12
-  Version: 36
+  Version: 37
 
 =head1 Overview
 
@@ -607,6 +607,27 @@
 
 my Dog $spot .= new(:tail :legs);
 
+=head1 Pair query methods
+
+Certain classes such as filehandles allow colon pairs to be used as if they
+were methods.  When you say:
+
+$filehandle.:e
+$filehandle.:!x
+
+it actually calls
+
+$filehandle.TEST(:e)
+$filehandle.TEST(:!x)
+
+which is expected to return a value that can be used as a boolean.
+While this is primarily intended for use by file tests, other classes
+may define a C method to provide a simil

[svn:perl6-synopsis] r13565 - doc/trunk/design/syn

2007-02-02 Thread larry
Author: larry
Date: Fri Feb  2 01:22:38 2007
New Revision: 13565

Modified:
   doc/trunk/design/syn/S12.pod

Log:
More thinking about .:mumble{...}


Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podFri Feb  2 01:22:38 2007
@@ -628,6 +628,22 @@
 C method--they are not inherited independently.  The C method
 must explicitly pass the query on to other classes in such cases.)
 
+Depending on the class, the pairs in question may have arguments.
+The C class in particular makes use of pair syntax for subscript
+modifiers:
+
+%hash.:exists{$key}
+%hash.:delete{$key}
+
+This has the advantage that pair's argument is actually parsed exactly
+as a subscript would be.  A C<.exists()> method could not easily make
+such a guarantee about its arguments.
+
+Conjecture, the trailing subscript adverbs could be brought up front as
+well:
+
+@array.:[EMAIL PROTECTED]
+
 =head1 Calling sets of methods
 
 For any method name, there may be some number of candidate methods


[svn:perl6-synopsis] r13566 - doc/trunk/design/syn

2007-02-02 Thread larry
Author: larry
Date: Fri Feb  2 01:28:24 2007
New Revision: 13566

Modified:
   doc/trunk/design/syn/S12.pod

Log:
Random cleanup.


Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podFri Feb  2 01:28:24 2007
@@ -624,9 +624,12 @@
 While this is primarily intended for use by file tests, other classes
 may define a C method to provide a similar mechanism for interrogating
 lightweight properties without having to define methods for all of them.
-(Note, though, that I such queries are answered by the first located
+
+Note, though, that I such queries are answered by the first located
 C method--they are not inherited independently.  The C method
-must explicitly pass the query on to other classes in such cases.)
+must explicitly pass the query on to other classes in such cases.  Likewise,
+if conflicting C methods are composed from two different roles, they
+must be disambiguated as any other conflicting method would be.
 
 Depending on the class, the pairs in question may have arguments.
 The C class in particular makes use of pair syntax for subscript
@@ -635,7 +638,7 @@
 %hash.:exists{$key}
 %hash.:delete{$key}
 
-This has the advantage that pair's argument is actually parsed exactly
+This has the advantage that the pair's argument is actually parsed exactly
 as a subscript would be.  A C<.exists()> method could not easily make
 such a guarantee about its arguments.
 
@@ -643,6 +646,7 @@
 well:
 
 @array.:[EMAIL PROTECTED]
+%hash.:[EMAIL PROTECTED]
 
 =head1 Calling sets of methods
 


Q on PIR vs PASM

2007-02-02 Thread Klaas-Jan Stol

hi,

IIRC, IMCC started as a kind of pre-processor for PASM, in other words, 
it allowed more readable shortcuts for several constructs. Eventually, 
everything was translated to pure PASM, that is, 1 long list of real 
Parrot instructions (no .sub/.end blocks etc).


At some point, IMCC was merged with Parrot as its parser. Since then, a 
lot of additions have been done, like the .sub pragmas like :load 
,:main, :init, :outer etc. (When Perl6 and Parrot essentials was 
written, these flags were not there)


Now, my question, is it still true that every PIR construct has a PASM 
form as well, can every PIR construct be translated directly to PASM? 
That is, can one still get the same behaviour that is achieved by all 
those high-level PIR constructs like :outer(...), in PASM as well?


thanks in advance,
klaas-jan


[PATCH] Update copyright for Parrot --version

2007-02-02 Thread Klaas-Jan Stol
attached a patch that makes ./parrot --version respond copyright 
2001-2007, instead of 2001-2006.


regards,
kjs
Index: compilers/imcc/main.c
===
--- compilers/imcc/main.c	(revision 16864)
+++ compilers/imcc/main.c	(working copy)
@@ -127,7 +127,7 @@
 if (PARROT_REVISION != rev) {
 printf( "Warning: used Configure.pl revision %d!\n", rev);
 }
-printf("Copyright (C) 2001-2006, The Perl Foundation.\n\
+printf("Copyright (C) 2001-2007, The Perl Foundation.\n\
 \n\
 Parrot may be copied only under the terms of either the Artistic License or the\
 \n\


Copyright chang script and test

2007-02-02 Thread Klaas-Jan Stol

hi,

attached are 2 files: a script that checks all files for the Last 
Changed Date according to SVN, and updates the file if its year > 
copyright notice in the file. I'm not very good with Perl, so it might 
be badly programmed... However, it only needs running once.


The 2nd file is a test, and again, this only needs to run once a year.

Issues with the test file:
* I redirect stderr to stdout, maybe it needs to be restored later, but 
I can imagine each test is a new invocation of perl, so in that case 
it's not necessary.
* if it finds a file that is literally out of date (it needs copyright 
notice update), it will only give an error message, not the file name 
(which should really be the case, otherwise, you don't know what file to 
fix)


* on ctrl-c it won't stop (well, for 1 second after which it 
continues...) I guess it has to do with me using File::Find...


The test file can just be put in the parrot/t/configure directory, that 
one will be run first when doing make test (so you don't have to wait 
for it to run)


hope this helps,
klaas-jan


#! perl
# Copyright (C) 2007, The Perl Foundation.

=head1 NAME

adjustcopyright.t - check copyright for all files in the parrot distr.

=head1 SYNOPSIS



=head1 DESCRIPTION

This test checks the "Last Changed Date" according to SVN for the year
it was changed. Then it looks in the file being processed for a copyright
notice, and extracts the year. Then, if $SVNYear > $fileYear, fail test
(and the copyright should be updated).

=head1 ISSUES

=over 4

=item *

C^C won't stop the testing...

=item *

How to restore stderr after having it redirected to stdout?






=cut

use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );

use File::Find;
use Parrot::Test;
use Parrot::Config;
use Test::More;


# don't know how many files will be tested:
plan tests => 1;

sub vdiag(@) { &diag if $ENV{TEST_VERBOSE} }


sub checkCopyright {

my $file = $_;

# only handle files, not directories
return unless -f $file;

# only handle text files
return unless -T $file;

# if there's '.svn' in the filename, it's the directory 
(probably?) 
return if $File::Find::name =~ m/.*\.svn.*/;
  
my $cmd = "svn info $File::Find::name";

#
# FIXME: restore stderr->stdout after we're done.
#
my $output = `$cmd 2>&1`;

my $SVNYear = undef;# to 
store the year according to SVN

if ($output =~ m/.*Last Changed Date:\s+(\d\d\d\d).*/) {

$SVNYear = $1;  
}
else {
return;
}

open(FILE, "< $File::Find::name") or die "cannot open file 
$File::Find::name";
   
while() {

# on failure, it should emit the failing file's name so 
we can fix it!  

# check for copyright lines containing only 1 year; note the matching 
space here.
if ($_ =~ m/.*[cC]opyright[^[\d\d\d\d\-]]*(\d\d\d\d).*/ ) { # check for 
match

# ok found it, now compare with $SVNYear
# only change when SVN Year > current
is($1, $SVNYear);
}
# check for copyright lines like X-Y
elsif ($_ =~ m/.*[cC]opyright[^\d]*\d\d\d\d\-(\d\d\d\d).*/ ) {  

is($1, $SVNYear);
}
   } 
   
   close(FILE);

}


{

# set $parrotRootDir to parrot build directory: 
my $parrotRootDir = $PConfig{'build_dir'};

# find takes an array containing directories to 
# be processed, we only have 1 directory: parrot
my @dirlist = ();   
push @dirlist, $parrotRootDir;

# check copyright for each file.
find(\&checkCopyright, @dirlist);
}
#
# Start of a script to recursively process all files in a directory to change 
the copyright notice.
#
use File::Find;
use strict;
use warnings;

my @unhandled_files = ();
my @handled_files = ();

sub process_file {
my $oldValue = 2006;# the minimal value for a year 
to be replaced   

my $shouldChange = 0;   # flag only set when file was changed in a year 
later than it's copyright notice year.

my $file = $_;

# only handle files, not directories
return unless -f $file;

# only handle text files
return unless -T $file;

# only handle file if it is writable
return unless -w $file;

# open file for 

Re: [svn:perl6-synopsis] r13558 - doc/trunk/design/syn

2007-02-02 Thread Nicholas Clark
On Wed, Jan 31, 2007 at 01:01:13PM -0800, [EMAIL PROTECTED] wrote:

> +by C and the value matchis represented by C.  (C,

"matchis" must be a typo :-)

Nicholas Clark


[svn:perl6-synopsis] r13567 - doc/trunk/design/syn

2007-02-02 Thread larry
Author: larry
Date: Fri Feb  2 09:07:05 2007
New Revision: 13567

Modified:
   doc/trunk/design/syn/S05.pod

Log:
Nick++ noticed where I spaced out.  Just glad someone's reading these things...


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podFri Feb  2 09:07:05 2007
@@ -728,7 +728,7 @@
 
 If the hash has the property "is parsed(...)", the pattern provided
 is considered to wrap every match, where the key match is represent
-by C and the value matchis represented by C.  (C,
+by C and the value match is represented by C.  (C,
 if present, must come at the beginning.  If omitted, the key must be
 explicitly reparsed by this rule or by the value rule.  If C
 is omitted, it is assumed to be at the end.)  The intent of this


S03 nit

2007-02-02 Thread Thom Boyer

[EMAIL PROTECTED] wrote:
> +++ doc/trunk/design/syn/S03.pod   Fri Feb  2 01:07:36 2007
> +Both of these forms actually translate to
> +
> +if $filename.TEST(:e) { say "exists" }
> +
> +which which is a generic mechanism that dispatches to the object's
> +class to find the definition of C.  (It just happens that

s/which which/which/

Which reminds me of an old puzzle:

  Punctuate the following sentence so it makes sense.
  Ann where Bob had had had had had had had had had had had a better
  effect on the teacher.


[EMAIL PROTECTED] wrote:
> Nick++ noticed where I spaced out.  Just glad someone's reading these
> things...

Yeah, some of us are reading these documents. I wish more of us 
understood more of them. Myself, particularly. :-) I hope to get caught 
up enough on current semantics that I can do more checking of meaning 
and less picking of grammatical and spelling nits. Perl6 is growing in 
ways I really like, but I'm having serious trouble keeping up!


=thom
I'll give you an exact definition. When the happiness of another person
becomes as essential to yourself as your own, then the state of love 
exists. -- Jubal Harshaw to Ben Caxton in Stranger in a Strange Land


[svn:perl6-synopsis] r13568 - doc/trunk/design/syn

2007-02-02 Thread larry
Author: larry
Date: Fri Feb  2 11:14:34 2007
New Revision: 13568

Modified:
   doc/trunk/design/syn/S03.pod

Log:
typo <== thom++


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podFri Feb  2 11:14:34 2007
@@ -1418,7 +1418,7 @@
 
 if $filename.TEST(:e) { say "exists" }
 
-which which is a generic mechanism that dispatches to the object's
+which is a generic mechanism that dispatches to the object's
 class to find the definition of C.  (It just happens that C
 (filenames) and C (filehandles) default to the expected filetest
 semantics, but C<$regex.:i> might tell you whether the regex is case


Re: [svn:perl6-synopsis] r13567 - doc/trunk/design/syn

2007-02-02 Thread Dr.Ruud
[EMAIL PROTECTED] schreef:

> Just glad someone's reading these things...

Of course we are. But it is hard to react when the syntax isn't in your
muscle memory yet.

>From r13565:

> +%hash.:exists{$key}


I would expect

  %hash.exists{$key}

with the shortcut

  %hash.:{$key}

to test (at run-time) for existance of the element, and expect

  %hash.:exists

to test (at compile time if possible) for the validity of 'exists', more
like

  %hash.can('exists');

  %hash.has('exists');

  %hash.does('exists');

-- 
Affijn, Ruud

"Gewoon is een tijger."



Re: Copyright chang script and test

2007-02-02 Thread chromatic
On Friday 02 February 2007 07:45, Klaas-Jan Stol wrote:

> attached are 2 files: a script that checks all files for the Last
> Changed Date according to SVN, and updates the file if its year
> copyright notice in the file. I'm not very good with Perl, so it might
> be badly programmed... However, it only needs running once.

I'll take a look at these this afternoon; I have a couple of ideas for polish 
on the Perl program.

Thanks,
-- c


Re: [svn:perl6-synopsis] r13564 - doc/trunk/design/syn

2007-02-02 Thread Smylers
[EMAIL PROTECTED] writes:

> +++ doc/trunk/design/syn/S03.pod  Fri Feb  2 01:07:36 2007
>  
>  if $filename ~~ :e { say "exists" }
> +if $filename.:e { say "exists" }
>  
> +Both of these forms actually translate to
> +
> +if $filename.TEST(:e) { say "exists" }

Hey, that looks good.

I've got a slight concern over the name C though.  The Perl QA
folk already seem to have enough trouble coming up with enough
permutations of "test", "tests", "Test", "TEST", and so on for labelling
tests, test frameworks, and things that relate to testing.  Which this
isn't.

(But I have't got a suggestion for a better name.)

Smylers


Re: [svn:perl6-synopsis] r13564 - doc/trunk/design/syn

2007-02-02 Thread Larry Wall
On Fri, Feb 02, 2007 at 08:06:56PM +, Smylers wrote:
: I've got a slight concern over the name C though.  The Perl QA
: folk already seem to have enough trouble coming up with enough
: permutations of "test", "tests", "Test", "TEST", and so on for labelling
: tests, test frameworks, and things that relate to testing.  Which this
: isn't.

Hmm, TEST doesn't work all that well to describe .:delete{$key} either.

: (But I have't got a suggestion for a better name.)

.OPT
.ALT
.TRY
.MAYBE
.WHEN
.WHETHER
.ASK
.QUERY
.STATUS
.PAIR
.ADV

I think I like STATUS the best at the moment.  But I can just imagine
some coding standard mandating that it must be written:

if not STATUS "/tmp/foo": :r { die; }

Larry


Re: [svn:perl6-synopsis] r13567 - doc/trunk/design/syn

2007-02-02 Thread Larry Wall
On Fri, Feb 02, 2007 at 08:14:53PM +0100, Dr.Ruud wrote:
: I would expect
: 
:   %hash.exists{$key}
: 

Except $foo.bar{$key} is interpreted as $foo.bar().{$key}.  Things like
"exists" and "delete" need to evaluate the key before calling the method
in question, not after.

: with the shortcut
: 
:   %hash.:{$key}
: 
: to test (at run-time) for existance of the element, and expect
: 
:   %hash.:exists
: 
: to test (at compile time if possible) for the validity of 'exists', more
: like
: 
:   %hash.can('exists');
: 
:   %hash.has('exists');
: 
:   %hash.does('exists');

Why would you expect colon to do that?  I don't see the prior art...

Larry


[perl #41425] [BUG] and [PATCH]: Refactoring of lib/Parrot/Pmc2c/Utils.pm -> test failure

2007-02-02 Thread via RT
# New Ticket Created by  James Keenan 
# Please include the string:  [perl #41425]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41425 >


Refactoring of code in lib/Parrot/Pmc2c/Utils.pm can and should be  
tested with the test suite I provided several weeks ago in t/tools/ 
pmc2cutils/*.t.

One internally used subroutine was refactored out of that module  
today, but apparently the test suite was not run before the file was  
committed to trunk:

[parrot] 507 $ prove t/tools/pmc2cutils/*.t
t/tools/pmc2cutils/00-qualifyok
t/tools/pmc2cutils/01-pmc2cutils.NOK 3/27
# Failed test (t/tools/pmc2cutils/01-pmc2cutils.t at line 34)
# Parrot::Pmc2c::Utils->can('get_included_paths') failed
# Looks like you failed 1 test of 27.
t/tools/pmc2cutils/01-pmc2cutils.dubious
 Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 3
 Failed 1/27 tests, 96.30% okay
...

The patch attached remedies this by eliminating the 'can_ok' test for  
the deleted subroutine.

kid51



01-pmc2cutils.t.patch
Description: Binary data


Re: PMC Tools Test Failure: t/tools/pmc2cutils/04-dump_pmc.t test #106

2007-02-02 Thread James E Keenan

chromatic wrote:


Hi there,

I see one failure with the buildtools tests, run right after make realclean 
and a fresh Configure.


t/tools/pmc2cutils/04-dump_pmc...ok 103/119  
# Failed test (t/tools/pmc2cutils/04-dump_pmc.t at line 533)
t/tools/pmc2cutils/04-dump_pmc...NOK 106/119#  got: '1170302523' 
# expected: '1170302526'

# Looks like you failed 1 test of 119.
t/tools/pmc2cutils/04-dump_pmc...dubious 
	Test returned status 1 (wstat 256, 0x100)

DIED. FAILED test 106
Failed 1/119 tests, 99.16% okay

-- c


and later chromatic further wrote:
> On Thursday 01 February 2007 04:07, James E Keenan wrote:
>
>
>>IIRC, in order to be able to get full coverage on a branch, I
>>have to determine whether a file was overwritten or not, which I'm doing
>>with a comparison of mtimes.
>
>
> Hm, that's a tricky test to write.  You have to dodge questions of 
process and
> IO ordering, as well as the granularity of time the filesystem can 
handle.

>
> The last time I wrote a similar test, I used sleep() for a couple of 
seconds.

> That may or may not be desirable.
>

And I tried sleep()ing as well; see below.

But first let me note that this was one place in the refactoring of 
pmc2c.pl that I found particularly puzzling and difficult to test.  The 
puzzling code is a foreach loop found in lib/Parrot/Pmc2c/Utils.pm, 
method dump_pmc(), which starts at line 371 in the latest revision. 
Here's that loop, which starts at line 404 -- complete with my comments 
in the code (I rebroke some long lines):


DO_A_DUMP: foreach my $name (keys %{$all}) {
my $file = $all->{$name}->{file};
my $dumpfile = $file;
$dumpfile =~ s/\.\w+$/.dump/;

my $existing = $self->find_file($dumpfile);

# Am confused about what's intended here.
# If the .dump file is OLDER
# than the corresponding .pmc file (e.g., if it's
# some .dump file from
# an earlier run of 'make'), shouldn't it be overwritten
# so that we
# have an up-to-date .dump file?
if (defined $existing && dump_is_newer($existing)) {
if ($dumpfile =~ /default\.dump$/) {
# don't overwrite default.dump
# skip all preparations for dumping
next DO_A_DUMP;
}
else {
# overwrite anything else
# continue with preparations for dumping
# And what good is assigning the name of the existing
# dump file to
# that of the newly-to-be-created dumpfile.
# Wouldn't they have the
# same name in any case?  (Or are we dealing
# with the possibility that
# find_file() will return a file of the same basename but in a
# different directory?  Is that a real possibility?)
$dumpfile = $existing;
}
}

$all = $self->gen_parent_list($name, $all);

my $class = gen_super_meths($name, $all, $vt);
my $Dumper = Data::Dumper->new([$class], ['class']);
$Dumper->Indent(1);
my $fh = open_file( ">", $dumpfile );
print $fh $Dumper->Dump;
close $fh;
} # end foreach loop

The test that failed for chromatic was one in a block whose purpose was 
to test all the conditions implicit in this line:


  if (defined $existing && dump_is_newer($existing)) {

I had to construct a test case in which file default.dump was *not* 
overwritten but in which any other .dump file (in this case, array.dump) 
supplied as an argument *was* overwritten.  So the mtimes of 
default.dump "before" and "after" had to be identical, while the mtimes 
of array.dump "before" and "after" had to differ.  "before" and "after" 
mean before and after a *second* call to dump_pmc in the same block -- 
something which may not actually take place when pmc2c.pl is invoked by 
'make'.  The relevant test code starts at line 474 of 
t/tools/pmc2cutils/04-dump_pmc.t; here are excerpts:


# @args hold default.pmc and one other .pmc
# test 2nd calls
{
... # skip setup of temporary directories for testing
my @include = ($tdir, $temppmcdir, @include_orig);

@args = (
qq{$temppmcdir/default.pmc},
qq{$temppmcdir/array.pmc},
);
$self = Parrot::Pmc2c::Utils->new( {
include => [EMAIL PROTECTED],
opt => \%opt,
args=> [ @args ],
} );
isa_ok($self, q{Parrot::Pmc2c::Utils});
$dump_file = $self->dump_vtable("$main::topdir/vtable.tbl");
ok(-e $dump_file, "dump_vtable created vtable.dump");

# First call to dump_pmc() is on the next line:
ok($self->dump_pmc(), "dump_pmc succeeded");
ok(-f qq{$temppmcdir/default.dump},
"default.dump created as expected");
ok(-f qq{$temppmcdir/array.dump},
"array.dump created as expected");

my @mtimes;

$mtimes[0]{default} = (stat(qq{$temppmcdir/default.dump}))[9];
 

[svn:parrot-pdd] r16879 - trunk/docs/pdds

2007-02-02 Thread allison
Author: allison
Date: Fri Feb  2 21:25:56 2007
New Revision: 16879

Modified:
   trunk/docs/pdds/pdd22_io.pod

Log:
[pdd]: Add status object return value to .open and .close I/O methods.


Modified: trunk/docs/pdds/pdd22_io.pod
==
--- trunk/docs/pdds/pdd22_io.pod(original)
+++ trunk/docs/pdds/pdd22_io.podFri Feb  2 21:25:56 2007
@@ -113,17 +113,18 @@
 
 =item open
 
-  $P0.open()
-  $P0.open($S1)
-  $P0.open($S1, $S2)
-
-Opens a stream on an existing I/O stream object. With no arguments, it
-can be used to reopen a previously opened I/O stream. $S1 is a file path
-and $S2 is an optional mode for the stream (read, write, read/write,
-etc), using the same format as the C opcode: 'r' for read, 'w' for
-write, 'a' for append, and 'p' for pipe. When the mode is set to write
-or append, a file is created without warning if none exists. When the
-mode is read (without write), a nonexistent file is an error.
+  $P0 = $P1.open()
+  $P0 = $P1.open($S2)
+  $P0 = $P1.open($S2, $S2)
+
+Opens a stream on an existing I/O stream object, and returns a status
+object. With no arguments, it can be used to reopen a previously opened
+I/O stream. $S2 is a file path and $S3 is an optional mode for the
+stream (read, write, read/write, etc), using the same format as the
+C opcode: 'r' for read, 'w' for write, 'a' for append, and 'p' for
+pipe. When the mode is set to write or append, a file is created without
+warning if none exists. When the mode is read (without write), a
+nonexistent file is an error.
 
 The asynchronous version takes a PMC callback as an additional final
 argument. When the open operation is complete, it invokes the callback
@@ -132,10 +133,11 @@
 
 =item close
 
-  $P0.close()
-  $P0.close($P1)
+  $P0 = $P1.close()
+  $P0 = $P1.close($P2)
 
-Closes an I/O stream, but leaves destruction of the I/O object to the GC.
+Closes an I/O stream, but leaves destruction of the I/O object to the
+GC. The C method returns a PMC status object.
 
 The asynchronous version takes an additional final PMC callback argument
 $P1. When the close operation is complete, it invokes the callback,