r49904 - in /branches/upstream/libmoosex-multiinitarg-perl: ./ current/ current/lib/ current/lib/MooseX/ current/lib/MooseX/MultiInitArg/ current/t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sat Jan 2 02:11:06 UTC 2010
Author: jawnsy-guest
Date: Sat Jan 2 02:11:00 2010
New Revision: 49904
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=49904
Log:
[svn-inject] Installing original source of libmoosex-multiinitarg-perl
Added:
branches/upstream/libmoosex-multiinitarg-perl/
branches/upstream/libmoosex-multiinitarg-perl/current/
branches/upstream/libmoosex-multiinitarg-perl/current/Changes
branches/upstream/libmoosex-multiinitarg-perl/current/MANIFEST
branches/upstream/libmoosex-multiinitarg-perl/current/META.yml
branches/upstream/libmoosex-multiinitarg-perl/current/Makefile.PL
branches/upstream/libmoosex-multiinitarg-perl/current/README
branches/upstream/libmoosex-multiinitarg-perl/current/lib/
branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/
branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/
branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg.pm
branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Attribute.pm
branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Trait.pm
branches/upstream/libmoosex-multiinitarg-perl/current/t/
branches/upstream/libmoosex-multiinitarg-perl/current/t/00-load.t
branches/upstream/libmoosex-multiinitarg-perl/current/t/01-main.t
branches/upstream/libmoosex-multiinitarg-perl/current/t/pod.t
Added: branches/upstream/libmoosex-multiinitarg-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/Changes?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/Changes (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/Changes Sat Jan 2 02:11:00 2010
@@ -1,0 +1,5 @@
+Revision history for MooseX-MultiInitArg
+
+0.01 Wed Apr 2
+ Initial Release!
+
Added: branches/upstream/libmoosex-multiinitarg-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/MANIFEST?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/MANIFEST (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/MANIFEST Sat Jan 2 02:11:00 2010
@@ -1,0 +1,11 @@
+Changes
+MANIFEST
+Makefile.PL
+README
+lib/MooseX/MultiInitArg.pm
+lib/MooseX/MultiInitArg/Trait.pm
+lib/MooseX/MultiInitArg/Attribute.pm
+t/00-load.t
+t/01-main.t
+t/pod.t
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libmoosex-multiinitarg-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/META.yml?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/META.yml (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/META.yml Sat Jan 2 02:11:00 2010
@@ -1,0 +1,15 @@
+--- #YAML:1.0
+name: MooseX-MultiInitArg
+version: 0.01
+abstract: Attributes with aliases for constructor arguments.
+license: ~
+author:
+ - Paul Driver <frodwith at cpan.org>
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
+ Moose: 0
+ Test::More: 0
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
Added: branches/upstream/libmoosex-multiinitarg-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/Makefile.PL?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/Makefile.PL (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/Makefile.PL Sat Jan 2 02:11:00 2010
@@ -1,0 +1,17 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'MooseX::MultiInitArg',
+ AUTHOR => 'Paul Driver <frodwith at cpan.org>',
+ VERSION_FROM => 'lib/MooseX/MultiInitArg.pm',
+ ABSTRACT_FROM => 'lib/MooseX/MultiInitArg.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ 'Moose' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'MooseX-MultiInitArg-*' },
+);
Added: branches/upstream/libmoosex-multiinitarg-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/README?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/README (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/README Sat Jan 2 02:11:00 2010
@@ -1,0 +1,32 @@
+MooseX-MultiInitArg
+
+Specify aliases to be used in your constructor for Moose attributes.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the
+perldoc command.
+
+ perldoc MooseX::MultiInitArg
+
+You can also look for information at:
+
+ Search CPAN
+ http://search.cpan.org/dist/MooseX-MultInitArg
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008 Paul Driver
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
Added: branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg.pm?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg.pm (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg.pm Sat Jan 2 02:11:00 2010
@@ -1,0 +1,66 @@
+package MooseX::MultiInitArg;
+
+use strict;
+use warnings;
+
+our $VERSION = '0.01';
+
+use MooseX::MultiInitArg::Attribute;
+use MooseX::MultiInitArg::Trait;
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::MultiInitArg - Attributes with aliases for constructor arguments.
+
+=head1 SYNOPSIS
+
+ package Thinger;
+ use Moose;
+ use MooseX::MultiInitArg;
+
+ has 'data' => (
+ metaclass => 'MultiInitArg',
+
+ # For composability, you could use the following:
+ # traits => ['MooseX::MultiInitArg::Trait'],
+
+ is => 'ro',
+ isa => 'Str',
+ init_args => [qw(munge frobnicate)],
+ );
+
+ package main;
+
+ # All these are equivalent
+ my $foo = Thinger->new(data => 'foo');
+ my $foo = Thinger->new(munge => 'foo');
+ my $foo = Thinger->new(frobnicate => 'foo');
+
+=head1 DESCRIPTION
+
+If you've ever wanted to be able to call an attribute any number of things
+while you're passing arguments to your object constructor, Now You Can.
+
+The primary motivator is that I have some attributes that were named
+inconsistently, and I wanted to rename them without breaking backwards
+compatibility with my existing API.
+
+=head1 AUTHOR
+
+Paul Driver, C<< <frodwith at cpan.org> >>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007-2008 by Paul Driver.
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
Added: branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Attribute.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Attribute.pm?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Attribute.pm (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Attribute.pm Sat Jan 2 02:11:00 2010
@@ -1,0 +1,43 @@
+package MooseX::MultiInitArg::Attribute;
+use Moose;
+
+extends q(Moose::Meta::Attribute);
+with q(MooseX::MultiInitArg::Trait);
+
+no Moose;
+
+package # Move along, PAUSE...
+ Moose::Meta::Attribute::Custom::MultiInitArg;
+
+sub register_implementation { q(MooseX::MultiInitArg::Attribute) }
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::MultiInitArg::Attribute - A custom attribute metaclass to add multiple init arguments to your attributes.
+
+=head1 DESCRIPTION
+
+This is a custom attribute metaclass which you can add to an attribute so that
+you can specify a list of aliases for your attribute to be recognized as
+constructor arguments. Use L<MooseX::MultiInitArg::Trait> for a way to use
+this with other attribute modifiers.
+
+=head1 AUTHOR
+
+Paul Driver, C<< <frodwith at cpan.org> >>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007-2008 by Paul Driver.
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
Added: branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Trait.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Trait.pm?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Trait.pm (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/lib/MooseX/MultiInitArg/Trait.pm Sat Jan 2 02:11:00 2010
@@ -1,0 +1,70 @@
+package MooseX::MultiInitArg::Trait;
+use Moose::Role;
+use Carp qw(confess);
+
+has init_args => (
+ is => 'ro',
+ isa => 'ArrayRef',
+ predicate => 'has_init_args',
+);
+
+around initialize_instance_slot => sub {
+ my $original = shift;
+ my ($self, $meta_instance, $instance, $params) = @_;
+ if ($self->has_init_args)
+ {
+ if(my @supplied = grep { exists $params->{$_} } @{ $self->init_args })
+ {
+ if ($self->has_init_arg and exists $params->{ $self->init_arg })
+ {
+ push(@supplied, $self->init_arg);
+ }
+
+ if (@supplied > 1)
+ {
+ confess 'Conflicting init_args: (' . join(', ', @supplied) . ')';
+ }
+
+ $self->_set_initial_slot_value(
+ $meta_instance,
+ $instance,
+ $params->{$supplied[0]},
+ );
+
+ return;
+ }
+ }
+ $original->(@_);
+};
+
+no Moose::Role;
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::MultiInitArg::Trait - A composable role to add multiple init arguments
+to your attributes.
+
+=head1 DESCRIPTION
+
+This is a composable trait which you can add to an attribute so that you can
+specify a list of aliases for your attribute to be recognized as constructor
+arguments.
+
+=head1 AUTHOR
+
+Paul Driver, C<< <frodwith at cpan.org> >>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007-2008 by Paul Driver.
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
Added: branches/upstream/libmoosex-multiinitarg-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/t/00-load.t?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/t/00-load.t (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/t/00-load.t Sat Jan 2 02:11:00 2010
@@ -1,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'MooseX::MultiInitArg' );
+}
+
+diag( "Testing MooseX::MultiInitArg $MooseX::MultiInitArg::VERSION, Perl $], $^X" );
Added: branches/upstream/libmoosex-multiinitarg-perl/current/t/01-main.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/t/01-main.t?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/t/01-main.t (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/t/01-main.t Sat Jan 2 02:11:00 2010
@@ -1,0 +1,45 @@
+package main;
+our @args = qw(foo bar baz);
+
+package WithMeta;
+use Moose;
+use MooseX::MultiInitArg;
+
+has x => (
+ metaclass => 'MultiInitArg',
+ is => 'ro',
+ isa => 'Str',
+ init_args => \@main::args,
+ required => 1,
+);
+
+package WithTrait;
+use Moose;
+use MooseX::MultiInitArg;
+
+has x => (
+ traits => ['MooseX::MultiInitArg::Trait'],
+ is => 'ro',
+ isa => 'Str',
+ init_args => \@main::args,
+ required => 1,
+);
+
+package main;
+use Test::More tests => 10;
+
+foreach my $class qw(WithTrait WithMeta)
+{
+ my $foo = $class->new(x => 'x');
+ is($foo->x, 'x', "$class x works");
+
+ foreach my $arg (@args)
+ {
+ my $x = $class->new($arg => $arg);
+ is($x->x, $arg, "$class $arg works.");
+ }
+
+ eval {my $fail = $class->new(x => 'y', foo => 'bar')};
+ ok($@, "Supplying more than one arg to $class causes death.");
+}
+
Added: branches/upstream/libmoosex-multiinitarg-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-multiinitarg-perl/current/t/pod.t?rev=49904&op=file
==============================================================================
--- branches/upstream/libmoosex-multiinitarg-perl/current/t/pod.t (added)
+++ branches/upstream/libmoosex-multiinitarg-perl/current/t/pod.t Sat Jan 2 02:11:00 2010
@@ -1,0 +1,12 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();
More information about the Pkg-perl-cvs-commits
mailing list