r24929 - in /trunk/libclass-std-utils-perl: ./ debian/ lib/ lib/Class/ lib/Class/Std/ t/
xaviero-guest at users.alioth.debian.org
xaviero-guest at users.alioth.debian.org
Tue Sep 9 11:39:28 UTC 2008
Author: xaviero-guest
Date: Tue Sep 9 11:39:22 2008
New Revision: 24929
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=24929
Log:
[svn-inject] Installing original source of libclass-std-utils-perl
Added:
trunk/libclass-std-utils-perl/
trunk/libclass-std-utils-perl/Build.PL
trunk/libclass-std-utils-perl/Changes
trunk/libclass-std-utils-perl/MANIFEST
trunk/libclass-std-utils-perl/META.yml
trunk/libclass-std-utils-perl/Makefile.PL
trunk/libclass-std-utils-perl/README
trunk/libclass-std-utils-perl/debian/
trunk/libclass-std-utils-perl/debian/changelog
trunk/libclass-std-utils-perl/debian/compat
trunk/libclass-std-utils-perl/debian/control
trunk/libclass-std-utils-perl/debian/copyright
trunk/libclass-std-utils-perl/debian/rules (with props)
trunk/libclass-std-utils-perl/debian/watch
trunk/libclass-std-utils-perl/lib/
trunk/libclass-std-utils-perl/lib/Class/
trunk/libclass-std-utils-perl/lib/Class/Std/
trunk/libclass-std-utils-perl/lib/Class/Std/Utils.pm
trunk/libclass-std-utils-perl/t/
trunk/libclass-std-utils-perl/t/00.load.t
trunk/libclass-std-utils-perl/t/anon_scalar.t
trunk/libclass-std-utils-perl/t/extract_initializers_from.t
trunk/libclass-std-utils-perl/t/ident.t
trunk/libclass-std-utils-perl/t/pod-coverage.t
trunk/libclass-std-utils-perl/t/pod.t
Added: trunk/libclass-std-utils-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/Build.PL?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/Build.PL (added)
+++ trunk/libclass-std-utils-perl/Build.PL Tue Sep 9 11:39:22 2008
@@ -1,0 +1,19 @@
+use strict;
+use warnings;
+use Module::Build;
+
+my $builder = Module::Build->new(
+ module_name => 'Class::Std::Utils',
+ license => 'perl',
+ dist_author => 'Damian Conway <DCONWAY at cpan.org>',
+ dist_version_from => 'lib/Class/Std/Utils.pm',
+ requires => {
+ 'Test::More' => 0,
+ 'List::Util' => 0,
+ 'Scalar::Util' => 0,
+ 'version' => 0,
+ },
+ add_to_cleanup => [ 'Class-Std-Utils-*' ],
+);
+
+$builder->create_build_script();
Added: trunk/libclass-std-utils-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/Changes?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/Changes (added)
+++ trunk/libclass-std-utils-perl/Changes Tue Sep 9 11:39:22 2008
@@ -1,0 +1,12 @@
+Revision history for Class-Std-Utils
+
+0.0.1 Sat Apr 9 09:54:03 2005
+ Initial release.
+
+
+0.0.2 Sun May 22 05:44:09 2005
+
+ - added dependency on version.pm
+
+0.0.3 Sat Nov 24 10:05:42 2007
+ - rt 18163
Added: trunk/libclass-std-utils-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/MANIFEST?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/MANIFEST (added)
+++ trunk/libclass-std-utils-perl/MANIFEST Tue Sep 9 11:39:22 2008
@@ -1,0 +1,13 @@
+Build.PL
+Changes
+MANIFEST
+META.yml # Will be created by "make dist"
+Makefile.PL
+README
+lib/Class/Std/Utils.pm
+t/00.load.t
+t/anon_scalar.t
+t/extract_initializers_from.t
+t/ident.t
+t/pod-coverage.t
+t/pod.t
Added: trunk/libclass-std-utils-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/META.yml?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/META.yml (added)
+++ trunk/libclass-std-utils-perl/META.yml Tue Sep 9 11:39:22 2008
@@ -1,0 +1,14 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Class-Std-Utils
+version: v0.0.3
+version_from: lib/Class/Std/Utils.pm
+installdirs: site
+requires:
+ List::Util: 0
+ Scalar::Util: 0
+ Test::More: 0
+ version: 0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30
Added: trunk/libclass-std-utils-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/Makefile.PL?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/Makefile.PL (added)
+++ trunk/libclass-std-utils-perl/Makefile.PL Tue Sep 9 11:39:22 2008
@@ -1,0 +1,19 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Class::Std::Utils',
+ AUTHOR => 'Damian Conway <DCONWAY at cpan.org>',
+ VERSION_FROM => 'lib/Class/Std/Utils.pm',
+ ABSTRACT_FROM => 'lib/Class/Std/Utils.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ 'List::Util' => 0,
+ 'Scalar::Util' => 0,
+ 'version' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'Class-Std-Utils-*' },
+);
Added: trunk/libclass-std-utils-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/README?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/README (added)
+++ trunk/libclass-std-utils-perl/README Tue Sep 9 11:39:22 2008
@@ -1,0 +1,43 @@
+Class::Std::Utils version 0.0.3
+
+This module provides three utility subroutines:
+
+ anon_scalar()
+
+ ident($some_ref)
+
+ extract_initializers_from(\%hash)
+
+These subs simplify the creation of "inside-out" classes. See Chapters
+15 and 16 of "Perl Best Practices" (O'Reilly, 2005) for details.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+
+Alternatively, to install with Module::Build, you can use the following commands:
+
+ perl Build.PL
+ ./Build
+ ./Build test
+ ./Build install
+
+
+
+DEPENDENCIES
+
+None.
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2005, Damian Conway
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
Added: trunk/libclass-std-utils-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/debian/changelog?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/debian/changelog (added)
+++ trunk/libclass-std-utils-perl/debian/changelog Tue Sep 9 11:39:22 2008
@@ -1,0 +1,5 @@
+libclass-std-utils-perl (0.0.3-1) unstable; urgency=low
+
+ * Initial Release (Closes: #498347)
+
+ -- Xavier Oswald <x.oswald at free.fr> Tue, 9 Sep 2008 13:04:55 +0200
Added: trunk/libclass-std-utils-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/debian/compat?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/debian/compat (added)
+++ trunk/libclass-std-utils-perl/debian/compat Tue Sep 9 11:39:22 2008
@@ -1,0 +1,1 @@
+5
Added: trunk/libclass-std-utils-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/debian/control?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/debian/control (added)
+++ trunk/libclass-std-utils-perl/debian/control Tue Sep 9 11:39:22 2008
@@ -1,0 +1,20 @@
+Source: libclass-std-utils-perl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 5), libmodule-build-perl
+Build-Depends-Indep: perl (>= 5.6.10-12), libtest-simple-perl, libtest-pod-perl, libtest-pod-coverage-perl
+Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
+Uploaders: Xavier Oswald <x.oswald at free.fr>
+Standards-Version: 3.8.0
+Homepage: http://search.cpan.org/dist/Class-Std-Utils/
+Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libclass-std-utils-perl/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/
+DM-Upload-Allowed: yes
+
+Package: libclass-std-utils-perl
+Architecture: all
+Depends: ${perl:Depends}, ${misc:Depends}
+Description: Utility subroutines for building "inside-out" objects
+ This module provides three utility subroutines that simplify the creation of
+ "inside-out" classes. See Chapters 15 and 16 of "Perl Best Practices"
+ (O'Reilly, 2005) for details.
Added: trunk/libclass-std-utils-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/debian/copyright?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/debian/copyright (added)
+++ trunk/libclass-std-utils-perl/debian/copyright Tue Sep 9 11:39:22 2008
@@ -1,0 +1,25 @@
+This is the debian package for the Class-Std-Utils module.
+It was created by Xavier Oswald <x.oswald at free.fr> using dh-make-perl.
+
+It was downloaded from http://search.cpan.org/dist/Class-Std-Utils/
+
+The upstream author is: Damian Conway <DCONWAY at cpan.org>
+Copyright: Copyright (c) 2005 Damian Conway <DCONWAY at cpan.org>
+
+This program is free software, you can redistribute it and/or modify it under
+the same terms as Perl itself.
+
+License:
+
+ a) the GNU General Public License as published by the Free Software
+ Foundation; either version 1, or (at your option) any later
+ version, or
+
+ b) the "Artistic License" which comes with Perl.
+
+ On Debian GNU/Linux systems, the complete text of the GNU General
+ Public License can be found in /usr/share/common-licenses/GPL' and
+ the Artistic Licence in /usr/share/common-licenses/Artistic'.
+
+The Debian packaging is (C) 2008, Xavier Oswald <x.oswald at free.fr> and
+is licensed under the same terms as the software itself (see above).
Added: trunk/libclass-std-utils-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/debian/rules?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/debian/rules (added)
+++ trunk/libclass-std-utils-perl/debian/rules Tue Sep 9 11:39:22 2008
@@ -1,0 +1,47 @@
+#!/usr/bin/make -f
+
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ $(PERL) Build.PL installdirs=vendor
+ $(PERL) Build
+ $(PERL) Build test
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ dh_clean build-stamp install-stamp
+ [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
+
+install: install-stamp
+install-stamp: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ $(PERL) Build install destdir=$(TMP) create_packlist=0
+ touch $@
+
+binary-arch:
+
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+ dh_installdocs README
+ dh_installchangelogs Changes
+ dh_perl
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Propchange: trunk/libclass-std-utils-perl/debian/rules
------------------------------------------------------------------------------
svn:executable =
Added: trunk/libclass-std-utils-perl/debian/watch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/debian/watch?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/debian/watch (added)
+++ trunk/libclass-std-utils-perl/debian/watch Tue Sep 9 11:39:22 2008
@@ -1,0 +1,2 @@
+version=3
+http://search.cpan.org/dist/Class-Std-Utils/ .*/Class-Std-Utils-v?(\d[\d_.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)
Added: trunk/libclass-std-utils-perl/lib/Class/Std/Utils.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/lib/Class/Std/Utils.pm?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/lib/Class/Std/Utils.pm (added)
+++ trunk/libclass-std-utils-perl/lib/Class/Std/Utils.pm Tue Sep 9 11:39:22 2008
@@ -1,0 +1,263 @@
+package Class::Std::Utils;
+
+use version; $VERSION = qv('0.0.3');
+
+use warnings;
+use strict;
+use Carp;
+use Scalar::Util qw( refaddr );
+
+sub import {
+ my $caller = caller;
+
+ no strict qw( refs );
+ *{ $caller . '::anon_scalar' } = \&anon_scalar;
+ *{ $caller . '::ident' } = \&refaddr;
+ *{ $caller . '::extract_initializers_from' } = \&extract_initializers_from;
+}
+
+sub anon_scalar { return \my $scalar; }
+
+use List::Util qw( first );
+
+sub extract_initializers_from {
+ my ($arg_ref) = @_;
+
+ my $class_name = caller;
+
+ # Find the class-specific sub-hash (if any)...
+ my $specific_inits_ref
+ = first {defined $_} $arg_ref->{$class_name}, {};
+ croak "$class_name initializer must be a nested hash" if ref $specific_inits_ref ne 'HASH';
+ # Return initializers, overriding general initializers from the top level
+ # with any second-level initializers that are specific to the class....
+ return ( %{$arg_ref}, %{$specific_inits_ref} );
+}
+
+
+1; # Magic true value required at end of module
+__END__
+
+=head1 NAME
+
+Class::Std::Utils - Utility subroutines for building "inside-out" objects
+
+
+=head1 VERSION
+
+This document describes Class::Std::Utils version 0.0.3
+
+
+=head1 SYNOPSIS
+
+ use Class::Std::Utils;
+
+ # Constructor for anonymous scalars...
+ my $new_object = bless anon_scalar(), $class;
+
+ # Convert an object reference into a unique ID number...
+ my $ID_num = ident $new_object;
+
+ # Extract class-specific arguments from a hash reference...
+ my %args = extract_initializers_from($arg_ref);
+
+
+=head1 DESCRIPTION
+
+This module provides three utility subroutines that simplify the creation of
+"inside-out" classes. See Chapters 15 and 16 of "Perl Best Practices"
+(O'Reilly, 2005) for details.
+
+=head1 INTERFACE
+
+=over
+
+=item C<anon_scalar()>
+
+This subroutine is always exported. It takes no arguments and returns a
+reference to an anonymous scalar, suitable for blessing as an object.
+
+=item C<ident()>
+
+This subroutine is always exported. It takes one argument--a reference--
+and acts exactly like the C<Scalar::Util::refaddr()>, returning a unique
+integer value suitable for identifying the referent.
+
+=item C<extract_initializers_from()>
+
+This subroutine is always exported. It takes one argument--a hash reference--
+and returns a "flattened" set of key/value pairs extracted from that hash.
+
+The typical usage is:
+
+ my %class_specific_args = extract_initializers_from($args_ref);
+
+The argument hash is flattened as described in Chapter 16 of "Perl Best
+Practices":
+
+=over
+
+I<The subroutine is always called with the original multi-level argument
+hash from the constructor. It then looks up the class's own name (i.e.
+its C<caller> package) in the argument hash, to see if an initializer
+with that key has been defined. Finally, C<extract_initializers_for()>
+returns the flattened set of key/value pairs for the class's initializer
+set, by appending the class-specific initializer subhash to the end of
+the original generic initializer hash. Appending the specific
+initializers after the generic ones means that any key in the class-
+specific set will override any key in the generic set, thereby ensuring
+that the most relevant initializers are always selected, but that
+generic initializers are still available where no class-specific value
+has been passed in.>
+
+=back
+
+In other words, given:
+
+ my $arg_ref = {
+ key_1 => 'generic value 1',
+ key_2 => 'generic value 2',
+
+ 'Base::Class' => {
+ key_1 => 'base value 1'
+ },
+
+ 'Der::Class' => {
+ key_1 => 'der value 1'
+ key_2 => 'der value 2'
+ },
+ };
+
+ package Base::Class;
+ use Class::Std::Utils;
+
+ my %base_args = extract_initializers_from($arg_ref);
+
+ package Der::Class;
+ use Class::Std::Utils;
+
+ my %der_args = extract_initializers_from($arg_ref);
+
+then C<%base_args> would be initialized to:
+
+ (
+ key_1 => 'base value 1',
+ key_2 => 'generic value 2',
+
+ 'Base::Class' => {
+ key_1 => 'base value 1',
+ },
+
+ 'Der::Class' => {
+ key_1 => 'der value 1',
+ key_2 => 'der value 2',
+ },
+ )
+
+whilst C<%der_args> would be initialized to:
+
+ (
+ key_1 => 'der value 1',
+ key_2 => 'der value 2',
+
+ 'Base::Class' => {
+ key_1 => 'base value 1',
+ },
+
+ 'Der::Class' => {
+ key_1 => 'der value 1',
+ key_2 => 'der value 2',
+ },
+ )
+
+That is, the top-level entries would be replaced by any second-level
+entries with the same key that appear in a top-level entry of the same name as
+the calling package.
+
+This means that each class can just refer to C<$args{key_1}> and
+C<$args{key_2}> and be confident that the resulting values will be the
+most specific available for that class.
+
+=back
+
+=head1 DIAGNOSTICS
+
+=over
+
+=item C<< %s initializer must be a nested hash >>
+
+Thrown by C<extract_initializers_from()>. You specified a top-level key
+that has the same name of the current class, but the value of that key
+wasn't a hash reference.
+
+=back
+
+
+=head1 CONFIGURATION AND ENVIRONMENT
+
+Class::Std::Utils requires no configuration files or environment variables.
+
+
+=head1 DEPENDENCIES
+
+Thsi module requires both the C<Scalar::Util> and C<List::Util> modules,
+which are standard in Perl 5.8 and available from the CPAN for earlier
+versions of Perl.
+
+
+=head1 INCOMPATIBILITIES
+
+None reported.
+
+
+=head1 SEE ALSO
+
+The C<Class::Std> module
+
+"Perl Best Practices", O'Reilly, 2005.
+
+
+=head1 BUGS AND LIMITATIONS
+
+No bugs have been reported.
+
+Please report any bugs or feature requests to
+C<bug-class-std-utils at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org>.
+
+
+=head1 AUTHOR
+
+Damian Conway C<< <DCONWAY at cpan.org> >>
+
+
+=head1 LICENCE AND COPYRIGHT
+
+Copyright (c) 2005, Damian Conway C<< <DCONWAY at cpan.org> >>. All rights reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+
+=head1 DISCLAIMER OF WARRANTY
+
+BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
+YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR, OR CORRECTION.
+
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
+LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
+THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
Added: trunk/libclass-std-utils-perl/t/00.load.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/t/00.load.t?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/t/00.load.t (added)
+++ trunk/libclass-std-utils-perl/t/00.load.t Tue Sep 9 11:39:22 2008
@@ -1,0 +1,7 @@
+use Test::More tests => 1;
+
+BEGIN {
+use_ok( 'Class::Std::Utils' );
+}
+
+diag( "Testing Class::Std::Utils $Class::Std::Utils::VERSION" );
Added: trunk/libclass-std-utils-perl/t/anon_scalar.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/t/anon_scalar.t?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/t/anon_scalar.t (added)
+++ trunk/libclass-std-utils-perl/t/anon_scalar.t Tue Sep 9 11:39:22 2008
@@ -1,0 +1,9 @@
+use Class::Std::Utils;
+use Test::More 'no_plan';
+
+my $anon_1 = anon_scalar();
+my $anon_2 = anon_scalar();
+
+is ref($anon_1), 'SCALAR' => 'anon_scalar returns scalar ref';
+ok !defined(${$anon_1}) => 'anon_scalar returns empty scalar';
+ok $anon_1 != $anon_2 => 'anon_scalar returns distinct ref';
Added: trunk/libclass-std-utils-perl/t/extract_initializers_from.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/t/extract_initializers_from.t?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/t/extract_initializers_from.t (added)
+++ trunk/libclass-std-utils-perl/t/extract_initializers_from.t Tue Sep 9 11:39:22 2008
@@ -1,0 +1,93 @@
+use Test::More 'no_plan';
+
+my %hash = (
+ top_1 => 'def val top 1',
+ top_2 => 'def val top 2',
+ top_3 => 'def val top 3',
+
+ Classname_1 => {
+ top_2 => 'class 1 val top 2',
+ },
+
+ Classname_2 => {
+ top_1 => 'class 2 val top 1',
+ top_2 => 'class 2 val top 2',
+ top_3 => 'class 2 val top 3',
+ },
+
+ Bad => 'class',
+);
+
+my %orig_hash = %hash;
+
+my %expect_1 = (
+ top_1 => 'def val top 1',
+ top_2 => 'class 1 val top 2',
+ top_3 => 'def val top 3',
+
+ Classname_1 => {
+ top_2 => 'class 1 val top 2',
+ },
+
+ Classname_2 => {
+ top_1 => 'class 2 val top 1',
+ top_2 => 'class 2 val top 2',
+ top_3 => 'class 2 val top 3',
+ },
+
+ Bad => 'class',
+);
+
+my %expect_2 = (
+ top_1 => 'class 2 val top 1',
+ top_2 => 'class 2 val top 2',
+ top_3 => 'class 2 val top 3',
+
+ Classname_1 => {
+ top_2 => 'class 1 val top 2',
+ },
+
+ Classname_2 => {
+ top_1 => 'class 2 val top 1',
+ top_2 => 'class 2 val top 2',
+ top_3 => 'class 2 val top 3',
+ },
+
+ Bad => 'class',
+);
+
+package Classname_1;
+use Class::Std::Utils;
+
+my %args1 = extract_initializers_from(\%hash);
+
+::is_deeply \%hash, \%orig_hash => 'Original args unchanged in class 1';
+::is_deeply \%args1, \%expect_1 => 'Extracted as expected in class 1';
+
+
+package Classname_2;
+use Class::Std::Utils;
+
+my %args2 = extract_initializers_from(\%hash);
+
+::is_deeply \%hash, \%orig_hash => 'Original args unchanged in class 2';
+::is_deeply \%args2, \%expect_2 => 'Extracted as expected in class 2';
+
+package Classname_3;
+use Class::Std::Utils;
+
+my %args3 = extract_initializers_from(\%hash);
+
+::is_deeply \%hash, \%orig_hash => 'Original args unchanged in class 2';
+::is_deeply \%args3, \%hash => 'Extracted as expected in class 3';
+
+
+package Bad;
+use Class::Std::Utils;
+
+::ok !eval { extract_initializers_from(\%hash); 1 }
+ => 'Exception for bad specification';
+
+::like $@, qr/^Bad initializer must be a nested hash/
+ => 'Correct exception thrown';
+
Added: trunk/libclass-std-utils-perl/t/ident.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/t/ident.t?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/t/ident.t (added)
+++ trunk/libclass-std-utils-perl/t/ident.t Tue Sep 9 11:39:22 2008
@@ -1,0 +1,22 @@
+use Scalar::Util 'refaddr';
+use Class::Std::Utils;
+use Test::More 'no_plan';
+
+my @objects = (
+ do{\my $scalar},
+ { hash => 'anon' },
+ [ 1..10 ],
+ sub {},
+ qr//,
+);
+
+for my $ref (@objects) {
+ is ident $ref, refaddr $ref => 'ident acts like refaddr on '.ref $ref;
+ is ident $ref, int $ref => 'ident acts like int on '.ref $ref;
+}
+
+bless $_ for @objects;
+
+for my $ref (@objects) {
+ is ident $ref, refaddr $ref => 'ident acts like refaddr on object';
+}
Added: trunk/libclass-std-utils-perl/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/t/pod-coverage.t?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/t/pod-coverage.t (added)
+++ trunk/libclass-std-utils-perl/t/pod-coverage.t Tue Sep 9 11:39:22 2008
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
Added: trunk/libclass-std-utils-perl/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-std-utils-perl/t/pod.t?rev=24929&op=file
==============================================================================
--- trunk/libclass-std-utils-perl/t/pod.t (added)
+++ trunk/libclass-std-utils-perl/t/pod.t Tue Sep 9 11:39:22 2008
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
More information about the Pkg-perl-cvs-commits
mailing list