r52110 - in /trunk/libdata-visitor-perl: Changes META.yml Makefile.PL SIGNATURE debian/changelog debian/control lib/Data/Visitor.pm lib/Data/Visitor/Callback.pm t/base.t t/globs.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Wed Feb 3 16:32:29 UTC 2010
Author: jawnsy-guest
Date: Wed Feb 3 16:32:22 2010
New Revision: 52110
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52110
Log:
* New upstream release
* Rewrite control description
* Standards-Version 3.8.4 (no changes)
* Drop dependency on Test::MockObject
Modified:
trunk/libdata-visitor-perl/Changes
trunk/libdata-visitor-perl/META.yml
trunk/libdata-visitor-perl/Makefile.PL
trunk/libdata-visitor-perl/SIGNATURE
trunk/libdata-visitor-perl/debian/changelog
trunk/libdata-visitor-perl/debian/control
trunk/libdata-visitor-perl/lib/Data/Visitor.pm
trunk/libdata-visitor-perl/lib/Data/Visitor/Callback.pm
trunk/libdata-visitor-perl/t/base.t
trunk/libdata-visitor-perl/t/globs.t
Modified: trunk/libdata-visitor-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/Changes?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/Changes (original)
+++ trunk/libdata-visitor-perl/Changes Wed Feb 3 16:32:22 2010
@@ -1,3 +1,7 @@
+0.27
+ - Improve synopsis of Data::Visitor::Callback.
+ - Remove the Test::MockObject dependency.
+
0.26
- remove Any::Moose, one too many failures to subclass. When/if Mouse can be
subclassed by Moose we can consider putting it back
Modified: trunk/libdata-visitor-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/META.yml?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/META.yml (original)
+++ trunk/libdata-visitor-perl/META.yml Wed Feb 3 16:32:22 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Data-Visitor
-version: 0.26
+version: 0.27
abstract: ~
author: []
license: unknown
@@ -13,7 +13,6 @@
Moose: 0.89
namespace::clean: 0.08
Task::Weaken: 0
- Test::MockObject: 1.04
Test::More: 0
Test::use::ok: 0
Tie::ToObject: 0.01
@@ -21,7 +20,7 @@
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.55_02
+generated_by: ExtUtils::MakeMaker version 6.56
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: trunk/libdata-visitor-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/Makefile.PL?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/Makefile.PL (original)
+++ trunk/libdata-visitor-perl/Makefile.PL Wed Feb 3 16:32:22 2010
@@ -7,7 +7,6 @@
'PREREQ_PM' => {
'Moose' => '0.89',
'namespace::clean' => '0.08',
- 'Test::MockObject' => '1.04',
'Test::More' => '0',
'Test::use::ok' => '0',
'Tie::ToObject' => '0.01',
Modified: trunk/libdata-visitor-perl/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/SIGNATURE?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/SIGNATURE (original)
+++ trunk/libdata-visitor-perl/SIGNATURE Wed Feb 3 16:32:22 2010
@@ -1,5 +1,5 @@
This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.55.
+signed via the Module::Signature module, version 0.61.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
@@ -14,26 +14,26 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 d291dec0f0d68e8ca7d4e13f6cdd545917990f6a Changes
+SHA1 01ad9fcc3019192733f69a1207d7ce4f6e3f85c0 Changes
SHA1 11833dd37a9d42763f59fb6d4b595c294c50c453 MANIFEST
SHA1 be688d6b494c6b54da61359d6a40dbfae00cd487 MANIFEST.SKIP
-SHA1 fa5935e40a2ab24963d4d92fb63e8adb67a12d09 META.yml
-SHA1 e84436ee74b342007c95b7ab132500d4a1e87944 Makefile.PL
-SHA1 427315bb45feeb30ce37c4a9ac720879109cfc2e lib/Data/Visitor.pm
-SHA1 676a6e8ca194b32c668a35b67a52c4667f4f7aec lib/Data/Visitor/Callback.pm
-SHA1 5979c9ecf150b843cb7750f761c0a9c0c1211a41 t/base.t
+SHA1 a42ae60021a64e6913609d53d6fafeb8d04524db META.yml
+SHA1 4ee69cf23e55609af86d04b591e10e185f29aa80 Makefile.PL
+SHA1 86a3155cb025adaef60338021168435e6d48acaf lib/Data/Visitor.pm
+SHA1 6d30870c3bb5fa24dacea14c816bc55228ec37fc lib/Data/Visitor/Callback.pm
+SHA1 72d03be5f19b3f45d993e7cdd14c7d7cb9ed68d5 t/base.t
SHA1 85ffd870fe37f7fd4ce1fc783f366bc50c253a02 t/bugs.t
SHA1 a784785f789346f921612b88468e040dc5273bc3 t/callback.t
SHA1 7868c691e6865c8e19be0030435f8a1524f6d237 t/callback_aliasing.t
SHA1 8e12aee89dd53a62f46ac2c8bd0a55d35d01972c t/callback_hash_entry.t
SHA1 ba502603afe759f9f22026c8c6527d1753fa6174 t/circular_refs.t
-SHA1 54affd2088fa25d8eec562fb8d39e1abd0d123c7 t/globs.t
+SHA1 2cc650274f202a589665859b65d72da00d66d02b t/globs.t
SHA1 8bd93450c072afbef10a423dd360e8f55cdacd40 t/magic.t
SHA1 66d201c2ce83481cee0a2838f118b5cce35c8bcc t/weak.t
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.7 (Darwin)
+Version: GnuPG v1.4.9 (GNU/Linux)
-iD8DBQFKn5xvVCwRwOvSdBgRAgHdAKCHjrl40X3LopQEGxEPStuDh8NhpQCgvKo5
-lRW+T7adlXJw1i/r3qwq0/s=
-=lYS5
+iEYEARECAAYFAktpI6gACgkQdC8qQo5jWl4pvwCfVDMQQVbe6a+X6njT/0mur85n
+HaMAn0f1AFSxkA2jO4uLeWGi1chUhghb
+=KM/E
-----END PGP SIGNATURE-----
Modified: trunk/libdata-visitor-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/debian/changelog?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/debian/changelog (original)
+++ trunk/libdata-visitor-perl/debian/changelog Wed Feb 3 16:32:22 2010
@@ -1,3 +1,12 @@
+libdata-visitor-perl (0.27-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ * Rewrite control description
+ * Standards-Version 3.8.4 (no changes)
+ * Drop dependency on Test::MockObject
+
+ -- Jonathan Yu <jawnsy at cpan.org> Wed, 03 Feb 2010 11:46:50 -0500
+
libdata-visitor-perl (0.26-1) unstable; urgency=low
[ Jonathan Yu ]
Modified: trunk/libdata-visitor-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/debian/control?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/debian/control (original)
+++ trunk/libdata-visitor-perl/debian/control Wed Feb 3 16:32:22 2010
@@ -2,26 +2,25 @@
Section: perl
Priority: optional
Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: perl, libtest-use-ok-perl,
- libtest-mockobject-perl (>= 1.05), libclass-accessor-perl, libtie-toobject-perl,
- libnamespace-clean-perl (>= 0.08), libdata-alias-perl, libmoose-perl (>= 0.89)
+Build-Depends-Indep: perl, libclass-accessor-perl, libnamespace-clean-perl,
+ libdata-alias-perl, libtest-use-ok-perl, libtie-toobject-perl,
+ libdata-alias-perl, libmoose-perl (>= 0.89)
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Krzysztof Krzyzaniak (eloy) <eloy at debian.org>,
gregor herrmann <gregoa at debian.org>, Jonathan Yu <jawnsy at cpan.org>,
Jose Luis Rivas <ghostbar38 at gmail.com>, Ryan Niebur <ryan at debian.org>,
Ansgar Burchardt <ansgar at 43-1.org>
-Standards-Version: 3.8.3
+Standards-Version: 3.8.4
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libdata-visitor-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libdata-visitor-perl/
Homepage: http://search.cpan.org/dist/Data-Visitor/
Package: libdata-visitor-perl
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libtest-use-ok-perl,
- libtest-mockobject-perl (>= 1.05), libclass-accessor-perl, libtie-toobject-perl,
- libdata-alias-perl, libnamespace-clean-perl (>= 0.08), libmoose-perl (>= 0.89)
-Description: visitor for Perl data structures
- Data::Visitor is a simple visitor implementation for Perl values.
- .
- It has a main dispatcher method, visit, which takes a single perl value and
- then calls the methods appropriate for that value.
+Depends: ${perl:Depends}, ${misc:Depends}, libnamespace-clean-perl,
+ libtest-use-ok-perl, libclass-accessor-perl, libmoose-perl (>= 0.89),
+ libtie-toobject-perl, libdata-alias-perl
+Description: visitor implementation for Perl data structures
+ Data::Visitor is a simple visitor implementation for Perl data structures. It
+ has a main dispatcher method, visit, which takes a single Perl value and then
+ calls the methods appropriate for that value.
Modified: trunk/libdata-visitor-perl/lib/Data/Visitor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/lib/Data/Visitor.pm?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/lib/Data/Visitor.pm (original)
+++ trunk/libdata-visitor-perl/lib/Data/Visitor.pm Wed Feb 3 16:32:22 2010
@@ -16,7 +16,7 @@
# the double not makes this no longer undef, so exempt from useless constant warnings in older perls
use constant DEBUG => not not our $DEBUG || $ENV{DATA_VISITOR_DEBUG};
-our $VERSION = "0.26";
+our $VERSION = "0.27";
has tied_as_objects => (
isa => "Bool",
Modified: trunk/libdata-visitor-perl/lib/Data/Visitor/Callback.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/lib/Data/Visitor/Callback.pm?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/lib/Data/Visitor/Callback.pm (original)
+++ trunk/libdata-visitor-perl/lib/Data/Visitor/Callback.pm Wed Feb 3 16:32:22 2010
@@ -297,9 +297,28 @@
use Data::Visitor::Callback;
my $v = Data::Visitor::Callback->new(
+ # you can provide callbacks
+ # $_ will contain the visited value
+
value => sub { ... },
array => sub { ... },
- object => "visit_ref", # can also use method names
+
+
+ # you can also delegate to method names
+ # this specific example will force traversal on objects, by using the
+ # 'visit_ref' callback which normally traverse unblessed references
+
+ object => "visit_ref",
+
+
+ # you can also use class names as callbacks
+ # the callback will be invoked on all objects which inherit that class
+
+ 'Some::Class' => sub {
+ my ( $v, $obj ) = @_; # $v is the visitor
+
+ ...
+ },
);
$v->visit( $some_perl_value );
Modified: trunk/libdata-visitor-perl/t/base.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/t/base.t?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/t/base.t (original)
+++ trunk/libdata-visitor-perl/t/base.t Wed Feb 3 16:32:22 2010
@@ -4,7 +4,6 @@
use warnings;
use Test::More tests => 32;
-use Test::MockObject::Extends;
my $m;
use ok $m = "Data::Visitor";
@@ -26,53 +25,74 @@
can_ok( $o, "visit_array" );
-my $mock = Test::MockObject::Extends->new( $o );
+my $mock;
+my %called;
+
+{
+ my $meta = Class::MOP::class_of($o);
+
+ my $class;
+ $class = $meta->create_anon_class(
+ superclasses => [$meta->name],
+ methods => {
+ meta => sub { $class },
+ map {
+ my $e = $_;
+ ($e->[0] => sub { $called{ $e->[0] }++; $e->[1]->(@_) })
+ } (
+ [ visit_value => sub { 'magic' } ],
+ [ visit_object => sub { 'magic' } ],
+ [ visit_hash_key => sub { $_[1] } ],
+ [ visit_hash => sub { shift->Data::Visitor::visit_hash(@_) } ],
+ [ visit_array => sub { shift->Data::Visitor::visit_array(@_) } ],
+ )
+ },
+ );
+
+ $mock = $class->rebless_instance($o);
+}
+
# cause logging
-$mock->set_always( $_ => "magic" ) for qw/visit_value visit_object/;
-$mock->mock( visit_hash_key => sub { $_[1] } );
-$mock->mock( visit_hash => sub { shift->Data::Visitor::visit_hash( @_ ) } );
-$mock->mock( visit_array => sub { shift->Data::Visitor::visit_array( @_ ) } );
+%called = ();
+$mock->visit( "foo" );
+ok($called{visit_value});
-$mock->clear;
+%called = ();
+$mock->visit( 1 );
+ok($called{visit_value});
+
+%called = ();
+$mock->visit( undef );
+ok($called{visit_value});
+
+%called = ();
+$mock->visit( [ ] );
+ok($called{visit_array});
+ok(!$called{visit_value}, "visit_value not called");
+
+%called = ();
+$mock->visit( [ "foo" ] );
+ok($called{visit_array});
+ok($called{visit_value});
+
+%called = ();
$mock->visit( "foo" );
-$mock->called_ok( "visit_value" );
+ok($called{visit_value});
-$mock->clear;
-$mock->visit( 1 );
-$mock->called_ok( "visit_value" );
+%called = ();
+$mock->visit( {} );
+ok($called{visit_hash});
+ok(!$called{visit_value}, "visit_value not called");
-$mock->clear;
-$mock->visit( undef );
-$mock->called_ok( "visit_value" );
+%called = ();
+$mock->visit( { foo => "bar" } );
+ok($called{visit_hash});
+ok($called{visit_value});
-$mock->clear;
-$mock->visit( [ ] );
-$mock->called_ok( "visit_array" );
-ok( !$mock->called( "visit_value" ), "visit_value not called" );
-
-$mock->clear;
-$mock->visit( [ "foo" ] );
-$mock->called_ok( "visit_array" );
-$mock->called_ok( "visit_value" );
-
-$mock->clear;
-$mock->visit( "foo" );
-$mock->called_ok( "visit_value" );
-
-$mock->clear;
-$mock->visit( {} );
-$mock->called_ok( "visit_hash" );
-ok( !$mock->called( "visit_value" ), "visit_value not called" );
-
-$mock->clear;
-$mock->visit( { foo => "bar" } );
-$mock->called_ok( "visit_hash" );
-$mock->called_ok( "visit_value" );
-
-$mock->clear;
+%called = ();
$mock->visit( bless {}, "Foo" );
-$mock->called_ok( "visit_object" );
+ok($called{visit_object});
is_deeply( $mock->visit( undef ), "magic", "fmap behavior on value" );
is_deeply( $mock->visit( { foo => "bar" } ), { foo => "magic" }, "fmap behavior on hash" );
Modified: trunk/libdata-visitor-perl/t/globs.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-visitor-perl/t/globs.t?rev=52110&op=diff
==============================================================================
--- trunk/libdata-visitor-perl/t/globs.t (original)
+++ trunk/libdata-visitor-perl/t/globs.t Wed Feb 3 16:32:22 2010
@@ -4,7 +4,6 @@
use warnings;
use Test::More tests => 10;
-use Test::MockObject::Extends;
use ok "Data::Visitor";
@@ -19,9 +18,28 @@
my $structure = [ $glob ];
-my $mock = Test::MockObject::Extends->new( "Data::Visitor" );
-$mock->mock( "visit_$_" => eval 'sub { shift->Data::Visitor::visit_' . $_ . '( @_ ) }' ) for qw/hash glob value array/;
+my $mock;
+my %called;
+{
+ my $meta = Class::MOP::class_of('Data::Visitor');
+
+ my $class;
+ $class = $meta->create_anon_class(
+ superclasses => [$meta->name],
+ methods => {
+ meta => sub { $class },
+ map {
+ my $e = $_;
+ ($e => sub { $called{$e}++; shift->${\"Data::Visitor::$e"}(@_) })
+ } map { "visit_$_" } qw(hash glob value array)
+ },
+ );
+
+ $mock = $class->name->new;
+}
+
+%called = ();
my $mapped = $mock->visit( $structure );
# structure sanity
@@ -29,7 +47,7 @@
is( ref ( $mapped->[0] ), "GLOB", "glob ref" );
is( ${ *{$mapped->[0]}{SCALAR} }, 3, "value in glob's scalar slot");
-$mock->called_ok( "visit_array" );
-$mock->called_ok( "visit_glob" );
-$mock->called_ok( "visit_value" );
-$mock->called_ok( "visit_hash" );
+ok($called{visit_array});
+ok($called{visit_glob});
+ok($called{visit_value});
+ok($called{visit_hash});
More information about the Pkg-perl-cvs-commits
mailing list