r13245 - in /branches/upstream/libtie-toobject-perl: ./ current/ current/MANIFEST current/MANIFEST.SKIP current/META.yml current/Makefile.PL current/SIGNATURE current/lib/ current/lib/Tie/ current/lib/Tie/ToObject.pm current/t/ current/t/tie.t
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Tue Jan 22 11:54:50 UTC 2008
Author: eloy
Date: Tue Jan 22 11:54:50 2008
New Revision: 13245
URL: http://svn.debian.org/wsvn/?sc=1&rev=13245
Log:
[svn-inject] Installing original source of libtie-toobject-perl
Added:
branches/upstream/libtie-toobject-perl/
branches/upstream/libtie-toobject-perl/current/
branches/upstream/libtie-toobject-perl/current/MANIFEST
branches/upstream/libtie-toobject-perl/current/MANIFEST.SKIP
branches/upstream/libtie-toobject-perl/current/META.yml
branches/upstream/libtie-toobject-perl/current/Makefile.PL
branches/upstream/libtie-toobject-perl/current/SIGNATURE
branches/upstream/libtie-toobject-perl/current/lib/
branches/upstream/libtie-toobject-perl/current/lib/Tie/
branches/upstream/libtie-toobject-perl/current/lib/Tie/ToObject.pm
branches/upstream/libtie-toobject-perl/current/t/
branches/upstream/libtie-toobject-perl/current/t/tie.t
Added: branches/upstream/libtie-toobject-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-toobject-perl/current/MANIFEST?rev=13245&op=file
==============================================================================
--- branches/upstream/libtie-toobject-perl/current/MANIFEST (added)
+++ branches/upstream/libtie-toobject-perl/current/MANIFEST Tue Jan 22 11:54:50 2008
@@ -1,0 +1,7 @@
+lib/Tie/ToObject.pm
+Makefile.PL
+MANIFEST This list of files
+MANIFEST.SKIP
+t/tie.t
+META.yml Module meta-data (added by MakeMaker)
+SIGNATURE Public-key signature (added by MakeMaker)
Added: branches/upstream/libtie-toobject-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-toobject-perl/current/MANIFEST.SKIP?rev=13245&op=file
==============================================================================
--- branches/upstream/libtie-toobject-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libtie-toobject-perl/current/MANIFEST.SKIP Tue Jan 22 11:54:50 2008
@@ -1,0 +1,38 @@
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+\bSCCS\b
+,v$
+\B\.svn\b
+\b_darcs\b
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$ # 6.18 through 6.25 generated this
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+
+# Avoid Devel::Cover files.
+\bcover_db\b
+
+### DEFAULT MANIFEST.SKIP ENDS HERE ####
+
+\.DS_Store$
+\.sw.$
+\.tar\.gz$
+^(\w+-)*(\w+)-\d\.\d+$
+
Added: branches/upstream/libtie-toobject-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-toobject-perl/current/META.yml?rev=13245&op=file
==============================================================================
--- branches/upstream/libtie-toobject-perl/current/META.yml (added)
+++ branches/upstream/libtie-toobject-perl/current/META.yml Tue Jan 22 11:54:50 2008
@@ -1,0 +1,16 @@
+--- #YAML:1.0
+name: Tie-ToObject
+version: 0.03
+abstract: ~
+license: ~
+author: ~
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
+ Scalar::Util: 0
+ Test::More: 0
+ Test::use::ok: 0
+ Tie::RefHash: 0
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
Added: branches/upstream/libtie-toobject-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-toobject-perl/current/Makefile.PL?rev=13245&op=file
==============================================================================
--- branches/upstream/libtie-toobject-perl/current/Makefile.PL (added)
+++ branches/upstream/libtie-toobject-perl/current/Makefile.PL Tue Jan 22 11:54:50 2008
@@ -1,0 +1,20 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Tie::ToObject',
+ VERSION_FROM => 'lib/Tie/ToObject.pm',
+ INSTALLDIRS => 'site',
+ SIGN => 1,
+ PL_FILES => { },
+ PREREQ_PM => {
+ 'Tie::RefHash' => 0, # core, used in test
+ 'Test::use::ok' => 0,
+ 'Test::More' => 0,
+ 'Scalar::Util' => 0,
+ },
+);
+
Added: branches/upstream/libtie-toobject-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-toobject-perl/current/SIGNATURE?rev=13245&op=file
==============================================================================
--- branches/upstream/libtie-toobject-perl/current/SIGNATURE (added)
+++ branches/upstream/libtie-toobject-perl/current/SIGNATURE Tue Jan 22 11:54:50 2008
@@ -1,0 +1,29 @@
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.55.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+ % cpansign -v
+
+It will check each file's integrity, as well as the signature's
+validity. If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+SHA1 fb2fc606ec8ec47a725c0224429647883bc36560 MANIFEST
+SHA1 ddb918d4e02cc06f4b9fe77adeca65403f8fdd56 MANIFEST.SKIP
+SHA1 b11bf61883c59b77ca02c9e18a2351b10e8f0471 META.yml
+SHA1 5a18083d49df16d04410f8619e8d5a9c8e1f14fd Makefile.PL
+SHA1 884c8c13e56b56f5f12c63d4c56680411f60c579 lib/Tie/ToObject.pm
+SHA1 d0253da0e8838eec69ab366f7e4c59e2d12fb97d t/tie.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.7 (Darwin)
+
+iD8DBQFHjqHFVCwRwOvSdBgRAqW4AKC3aHaNf6hOMCvbtNXrJPb0NhsdjQCfTbhK
+dKHJ9bwz17NqxUEO7RmBvR0=
+=5SpD
+-----END PGP SIGNATURE-----
Added: branches/upstream/libtie-toobject-perl/current/lib/Tie/ToObject.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-toobject-perl/current/lib/Tie/ToObject.pm?rev=13245&op=file
==============================================================================
--- branches/upstream/libtie-toobject-perl/current/lib/Tie/ToObject.pm (added)
+++ branches/upstream/libtie-toobject-perl/current/lib/Tie/ToObject.pm Tue Jan 22 11:54:50 2008
@@ -1,0 +1,80 @@
+#!/usr/bin/perl
+
+package Tie::ToObject;
+
+use strict;
+#use warnings;
+
+use vars qw($VERSION $AUTOLOAD);
+
+use Carp qw(croak);
+use Scalar::Util qw(blessed);
+
+$VERSION = "0.03";
+
+sub AUTOLOAD {
+ my ( $self, $tied ) = @_;
+ my ( $method ) = ( $AUTOLOAD =~ /([^:]+)$/ );
+
+ if ( $method =~ /^TIE/ ) {
+ if ( blessed($tied) ) {
+ return $tied;
+ } else {
+ croak "You must supply an object as the argument to tie()";
+ }
+ } else {
+ croak "Unsupported method for $method, this module is only for tying to existing objects";
+ }
+}
+
+__PACKAGE__
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Tie::ToObject - Tie to an existing object.
+
+=head1 SYNOPSIS
+
+ use Tie::ToObject;
+
+ my $stolen = tied(%something);
+
+ tie %something_else, 'Tie::ToObject', $stolen;
+
+=head1 DESCRIPTION
+
+While L<perldoc/tie> allows tying to an arbitrary object, the class in question
+must support this in it's implementation of C<TIEHASH>, C<TIEARRAY> or
+whatever.
+
+This class provides a very tie constructor that simply returns the object it
+was given as it's first argument.
+
+This way side effects of calling C<< $object->TIEHASH >> are avoided.
+
+This is used in L<Data::Visitor> in order to tie a variable to an already
+existing object. This is also useful for cloning, when you want to clone the
+internal state object instead of going through the tie interface for that
+variable.
+
+=head1 VERSION CONTROL
+
+This module is maintained using Darcs. You can get the latest version from
+L<http://nothingmuch.woobling.org/code>, and use C<darcs send> to commit
+changes.
+
+=head1 AUTHOR
+
+Yuval Kogman E<lt>nothingmuch at woobling.orgE<gt>
+
+=head1 COPYRIGHT
+
+ Copyright (c) 2008 Yuval Kogman. All rights reserved
+ This program is free software; you can redistribute
+ it and/or modify it under the same terms as Perl itself.
+
+=cut
Added: branches/upstream/libtie-toobject-perl/current/t/tie.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtie-toobject-perl/current/t/tie.t?rev=13245&op=file
==============================================================================
--- branches/upstream/libtie-toobject-perl/current/t/tie.t (added)
+++ branches/upstream/libtie-toobject-perl/current/t/tie.t Tue Jan 22 11:54:50 2008
@@ -1,0 +1,40 @@
+#!/usr/bin/perl
+
+use strict;
+#use warnings;
+
+use Test::More tests => 10;
+
+use Tie::RefHash;
+
+tie my %hash, 'Tie::RefHash';
+
+$hash{ [ 1, 2, 3 ] } = "an array";
+
+$hash{foo} = "a stringy";
+
+use ok 'Tie::ToObject';
+
+tie my %new_hash, 'Tie::ToObject', tied %hash;
+
+is( tied(%new_hash), tied(%hash), "tied is the same" );
+
+is_deeply( \%new_hash, \%hash, "is_deeply" );
+
+is( Tie::ToObject->TIEHASH(tied %hash), tied(%hash), "tie is just the identity function" );
+
+eval { tie my %other_hash, 'Tie::ToObject' };
+my $e = $@;
+ok($e, "error" );
+like( $e, qr/object.*tie/i, "right error" );
+
+eval { tie my %other_hash, 'Tie::ToObject', { } };
+$e = $@;
+ok($e, "error" );
+like( $e, qr/object.*tie/i, "right error" );
+
+eval { Tie::ToObject->blah(tied(%hash)) };
+$e = $@;
+ok($e, "error" );
+like( $e, qr/method.*blah/i, "right error" );
+
More information about the Pkg-perl-cvs-commits
mailing list