[Bps-public-commit] GnuPG-Interface branch, master, updated. 2eea6c34b2de0b6f36ba924918bd7d2ce85a3c01

sartak at bestpractical.com sartak at bestpractical.com
Tue Apr 21 05:55:54 EDT 2009


The branch, master has been updated
       via  2eea6c34b2de0b6f36ba924918bd7d2ce85a3c01 (commit)
      from  7675c07b94dcc1d82eea3463763c99ee12a458d5 (commit)

Summary of changes:
 Makefile.PL             |    1 -
 lib/GnuPG/Handles.pm    |   10 +++++++---
 lib/GnuPG/Options.pm    |   25 ++++++++++++++-----------
 lib/GnuPG/PrimaryKey.pm |   22 +++++++++++++---------
 lib/GnuPG/UserId.pm     |   12 +++++++-----
 5 files changed, 41 insertions(+), 29 deletions(-)

- Log -----------------------------------------------------------------
commit 2eea6c34b2de0b6f36ba924918bd7d2ce85a3c01
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Apr 21 05:55:45 2009 -0400

    Remove use of MooseX::AttributeHelpers

diff --git a/Makefile.PL b/Makefile.PL
index deb8596..0d06293 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -17,7 +17,6 @@ WriteMakefile
     VERSION_FROM => 'lib/GnuPG/Interface.pm',
     PREREQ_PM    => {
 		     'Moose' => 0.61,
-		     'MooseX::AttributeHelpers' => 0.14,
 		    },
     clean        => { FILES => "test/*-keys*/*.out test/random_seed test/trustdb.gpg test/temp" }
   );
diff --git a/lib/GnuPG/Handles.pm b/lib/GnuPG/Handles.pm
index 83eab79..c8bd20d 100644
--- a/lib/GnuPG/Handles.pm
+++ b/lib/GnuPG/Handles.pm
@@ -15,7 +15,6 @@
 
 package GnuPG::Handles;
 use Moose;
-use MooseX::AttributeHelpers;
 with qw(GnuPG::HashInit);
 
 use constant HANDLES => qw(
@@ -38,10 +37,15 @@ has _options => (
     isa        => 'HashRef',
     is         => 'rw',
     lazy_build => 1,
-    metaclass  => 'Collection::Hash',
-    provides   => { get => 'options' },
 );
 
+sub options {
+    my $self = shift;
+    my $key = shift;
+
+    return $self->_options->{$key};
+}
+
 sub _build__options { {} }
 
 sub BUILD {
diff --git a/lib/GnuPG/Options.pm b/lib/GnuPG/Options.pm
index e04c933..71c0b24 100644
--- a/lib/GnuPG/Options.pm
+++ b/lib/GnuPG/Options.pm
@@ -15,7 +15,6 @@
 
 package GnuPG::Options;
 use Moose;
-use MooseX::AttributeHelpers;
 with qw(GnuPG::HashInit);
 
 use constant BOOLEANS => qw(
@@ -70,16 +69,20 @@ has $_ => (
     clearer => 'clear_' . $_,
 ) for SCALARS;
 
-has $_ => (
-    isa        => 'ArrayRef',
-    is         => 'rw',
-    lazy       => 1,
-    clearer    => 'clear_' . $_,
-    default    => sub { [] },
-    auto_deref => 1,
-    metaclass  => 'Collection::Array',
-    provides   => { push => 'push_' . $_ },
-) for LISTS;
+for my $list (LISTS) {
+    has $list => (
+        isa        => 'ArrayRef',
+        is         => 'rw',
+        lazy       => 1,
+        clearer    => "clear_$list",
+        default    => sub { [] },
+        auto_deref => 1,
+    );
+    __PACKAGE__->meta->add_method("push_$list" => sub {
+        my $self = shift;
+        push @{ $self->$list }, @_;
+    });
+}
 
 sub BUILD {
     my ( $self, $args ) = @_;
diff --git a/lib/GnuPG/PrimaryKey.pm b/lib/GnuPG/PrimaryKey.pm
index 7a027d2..6709060 100644
--- a/lib/GnuPG/PrimaryKey.pm
+++ b/lib/GnuPG/PrimaryKey.pm
@@ -15,18 +15,22 @@
 
 package GnuPG::PrimaryKey;
 use Moose;
-use MooseX::AttributeHelpers;
 
 BEGIN { extends qw( GnuPG::Key ) }
 
-has $_ => (
-    isa        => 'ArrayRef',
-    is         => 'rw',
-    default    => sub { [] },
-    auto_deref => 1,
-    metaclass  => 'Collection::Array',
-    provides   => { push => 'push_' . $_ },
-) for qw( user_ids subkeys  );
+for my $list (qw(user_ids subkeys)) {
+    has $list => (
+        isa        => 'ArrayRef',
+        is         => 'rw',
+        default    => sub { [] },
+        auto_deref => 1,
+    );
+
+    __PACKAGE__->meta->add_method("push_$list" => sub {
+        my $self = shift;
+        push @{ $self->$list }, @_;
+    });
+}
 
 has $_ => (
     isa     => 'Any',
diff --git a/lib/GnuPG/UserId.pm b/lib/GnuPG/UserId.pm
index 05e1913..9ccf5ec 100644
--- a/lib/GnuPG/UserId.pm
+++ b/lib/GnuPG/UserId.pm
@@ -15,20 +15,22 @@
 
 package GnuPG::UserId;
 use Moose;
-use MooseX::AttributeHelpers;
 
 has [qw( validity as_string )] => (
     isa => 'Any',
     is  => 'rw',
 );
 
-has $_ => (
+has signatures => (
     isa       => 'ArrayRef',
     is        => 'rw',
     default   => sub { [] },
-    metaclass => 'Collection::Array',
-    provides  => { push => 'push_' . $_ },
-) for qw(signatures);
+);
+
+sub push_signatures {
+    my $self = shift;
+    push @{ $self->signatures }, @_;
+}
 
 # DEPRECATED
 sub user_id_string {

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list