Skip Menu |

This queue is for tickets about the GnuPG-Interface CPAN distribution.

Report information
The Basics
Id: 88445
Status: resolved
Priority: 0/
Queue: GnuPG-Interface

People
Owner: Nobody in particular
Requestors: intrigeri [...] boum.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Please migrate to Moo
Date: Thu, 05 Sep 2013 20:03:57 +0200
To: bug-GnuPG-Interface [...] rt.cpan.org
From: intrigeri <intrigeri [...] boum.org>
Hi, Any::Moose is deprecated, and its authors recommend to now use Moo instead. Could you please consider migrating GnuPG::Interface to Moo? (I've just migrated one of to Moo, which was quite easy thanks to MooX::late... and now the only remaining dependency that loads Mouse is GnuPG::Interface.) Cheers, -- intrigeri | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc
Subject: Re: [rt.cpan.org #88445] Please migrate to Moo
Date: Fri, 6 Sep 2013 01:47:27 +0400
To: bug-GnuPG-Interface [...] rt.cpan.org
From: Ruslan Zakirov <ruz [...] bestpractical.com>
Hi, I don't think we mind migration. Do you care enough to provide a patch/pull request? On Thu, Sep 5, 2013 at 10:04 PM, intrigeri via RT < bug-GnuPG-Interface@rt.cpan.org> wrote: Show quoted text
> Thu Sep 05 14:04:30 2013: Request 88445 was acted upon. > Transaction: Ticket created by intrigeri@boum.org > Queue: GnuPG-Interface > Subject: Please migrate to Moo > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: intrigeri@boum.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=88445 > > > > Hi, > > Any::Moose is deprecated, and its authors recommend to now use Moo > instead. Could you please consider migrating GnuPG::Interface to Moo? > > (I've just migrated one of to Moo, which was quite easy thanks to > MooX::late... and now the only remaining dependency that loads Mouse > is GnuPG::Interface.) > > Cheers, > -- > intrigeri > | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc > | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc > >
-- Best regards, Ruslan.
Subject: Re: [rt.cpan.org #88445] Please migrate to Moo
Date: Fri, 06 Sep 2013 11:46:58 +0200
To: bug-GnuPG-Interface [...] rt.cpan.org
From: intrigeri <intrigeri [...] boum.org>
Ruslan Zakirov via RT wrote (05 Sep 2013 21:47:42 GMT) : Show quoted text
> I don't think we mind migration.
Great :) Show quoted text
> Do you care enough to provide a patch/pull request?
Not on the short term, but I'd be happy to test Moo -based dev releases against a few reverse dependencies to make sure there's no regression for my usecases :)
Subject: Patch
On Fri Sep 06 05:47:19 2013, intrigeri@boum.org wrote: Show quoted text
> Ruslan Zakirov via RT wrote (05 Sep 2013 21:47:42 GMT) :
> > Do you care enough to provide a patch/pull request?
> > Not on the short term, but I'd be happy to test Moo -based dev > releases against a few reverse dependencies to make sure there's > no regression for my usecases :)
I've changed my mind. The attached patch converts this distribution to Moo. I've successfully tested it against a reverse dependencies I'm maintaining, and the test suite passes entirely. Please consider for merging and releasing :)
Subject: GnuPG-Interface-to-Moo.diff
commit 0d83bd386f96e82a136afc952373af0f761d5c77 Author: intrigeri <intrigeri@boum.org> Date: Tue Dec 24 11:56:47 2013 +0000 Convert to Moo. ... using MooX::late to ease the transition. Notes: * __PACKAGE__->meta->make_immutable is now useless: Moo does it automatically the first time ->new is called on a class. * auto_deref is not supported by Moo, so we explicitly dereference things in the few places where they were automatically dereferenced before. * Instead of __PACKAGE__->meta->add_method (that would trigger the load of Moose, and require a dependency on it), use MooX::HandlesVia NativeTrait-like behaviour to generate push_$list methods. * The test suite still passes successfully. diff --git a/META.yml b/META.yml index 1beaef2..fc4ebb6 100644 --- a/META.yml +++ b/META.yml @@ -20,7 +20,9 @@ no_index: - t - test requires: - Any::Moose: 0.04 + Moo: 0.091011 + MooX::HandlesVia: 0.001004 + MooX::late: 0.014 Math::BigInt: 1.78 resources: license: http://dev.perl.org/licenses/ diff --git a/Makefile.PL b/Makefile.PL index 8156e7f..1be9418 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -16,7 +16,9 @@ author 'Frank J. Tobin'; abstract 'supply object methods for interacting with GnuPG'; name 'GnuPG-Interface'; version_from 'lib/GnuPG/Interface.pm'; -requires 'Any::Moose' => '0.04'; +requires 'Moo' => '0.091011'; +requires 'MooX::HandlesVia' => '0.001004'; +requires 'MooX::late' => '0.014'; requires 'Math::BigInt' => '1.78'; license 'perl'; diff --git a/lib/GnuPG/Fingerprint.pm b/lib/GnuPG/Fingerprint.pm index 871e02a..fcb1028 100644 --- a/lib/GnuPG/Fingerprint.pm +++ b/lib/GnuPG/Fingerprint.pm @@ -14,7 +14,8 @@ # package GnuPG::Fingerprint; -use Any::Moose; +use Moo; +use MooX::late; with qw(GnuPG::HashInit); has as_hex_string => ( @@ -36,8 +37,6 @@ sub hex_data return $self->as_hex_string(); } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/Handles.pm b/lib/GnuPG/Handles.pm index fabf31c..b30ca57 100644 --- a/lib/GnuPG/Handles.pm +++ b/lib/GnuPG/Handles.pm @@ -14,7 +14,8 @@ # package GnuPG::Handles; -use Any::Moose; +use Moo; +use MooX::late; with qw(GnuPG::HashInit); use constant HANDLES => qw( @@ -57,8 +58,6 @@ sub BUILD { $self->hash_init(%$args); } -__PACKAGE__->meta->make_immutable; - 1; =head1 NAME diff --git a/lib/GnuPG/HashInit.pm b/lib/GnuPG/HashInit.pm index 9daa6a9..a278b09 100644 --- a/lib/GnuPG/HashInit.pm +++ b/lib/GnuPG/HashInit.pm @@ -1,5 +1,5 @@ package GnuPG::HashInit; -use Any::Moose 'Role'; +use Moo::Role; sub hash_init { my ($self, %args) = @_; diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm index 5d80eeb..93cb051 100644 --- a/lib/GnuPG/Interface.pm +++ b/lib/GnuPG/Interface.pm @@ -12,7 +12,8 @@ # package GnuPG::Interface; -use Any::Moose; +use Moo; +use MooX::late; with qw(GnuPG::HashInit); use English qw( -no_match_vars ); @@ -867,7 +868,7 @@ decryption, verification, and key-listing parsing. =head2 How Data Member Accessor Methods are Created Each module in the GnuPG::Interface bundle relies -on Any::Moose to generate the get/set methods +on Moo to generate the get/set methods used to set the object's data members. I<This is very important to realize.> This means that any data member which is a list has special @@ -1351,8 +1352,5 @@ Frank J. Tobin, ftobin@cpan.org was the original author of the package. =cut - -__PACKAGE__->meta->make_immutable; - 1; diff --git a/lib/GnuPG/Key.pm b/lib/GnuPG/Key.pm index fbdda52..ea14a6a 100644 --- a/lib/GnuPG/Key.pm +++ b/lib/GnuPG/Key.pm @@ -14,7 +14,8 @@ # package GnuPG::Key; -use Any::Moose; +use Moo; +use MooX::late; with qw(GnuPG::HashInit); has [ @@ -124,8 +125,6 @@ sub compare { return 1; } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/Options.pm b/lib/GnuPG/Options.pm index bbfd67a..c81f60e 100644 --- a/lib/GnuPG/Options.pm +++ b/lib/GnuPG/Options.pm @@ -14,7 +14,9 @@ # package GnuPG::Options; -use Any::Moose; +use Moo; +use MooX::late; +use MooX::HandlesVia; with qw(GnuPG::HashInit); use constant BOOLEANS => qw( @@ -71,17 +73,15 @@ has $_ => ( for my $list (LISTS) { has $list => ( - isa => 'ArrayRef', - is => 'rw', - lazy => 1, - clearer => "clear_$list", - default => sub { [] }, - auto_deref => 1, + handles_via => 'Array', + is => 'rw', + lazy => 1, + clearer => "clear_$list", + default => sub { [] }, + handles => { + "push_$list" => 'push', + }, ); - __PACKAGE__->meta->add_method("push_$list" => sub { - my $self = shift; - push @{ $self->$list }, @_; - }); } sub BUILD { @@ -110,7 +110,7 @@ sub get_args { return ( $self->get_meta_args(), $self->get_option_args(), - $self->extra_args(), + @{$self->extra_args()}, ); } @@ -147,8 +147,8 @@ sub get_option_args { push @args, '--command-fd', $self->command_fd() if defined $self->command_fd(); - push @args, map { ( '--recipient', $_ ) } $self->recipients(); - push @args, map { ( '--encrypt-to', $_ ) } $self->encrypt_to(); + push @args, map { ( '--recipient', $_ ) } @{$self->recipients}; + push @args, map { ( '--encrypt-to', $_ ) } @{$self->encrypt_to}; return @args; } @@ -172,15 +172,14 @@ sub get_meta_args { if $self->meta_signing_key(); push @args, - map { ( '--recipient', $_ ) } $self->meta_recipients_key_ids(); + map { ( '--recipient', $_ ) } @{$self->meta_recipients_key_ids}; + use Data::Dumper::Concise; push @args, - map { ( '--recipient', $_->hex_id() ) } $self->meta_recipients_keys(); + map { ( '--recipient', $_->hex_id() ) } @{$self->meta_recipients_keys}; return @args; } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/PrimaryKey.pm b/lib/GnuPG/PrimaryKey.pm index d36d0b9..d3c745e 100644 --- a/lib/GnuPG/PrimaryKey.pm +++ b/lib/GnuPG/PrimaryKey.pm @@ -14,22 +14,21 @@ # package GnuPG::PrimaryKey; -use Any::Moose; +use Moo; +use MooX::late; +use MooX::HandlesVia; BEGIN { extends qw( GnuPG::Key ) } for my $list (qw(user_ids subkeys user_attributes)) { has $list => ( - isa => 'ArrayRef', - is => 'rw', - default => sub { [] }, - auto_deref => 1, + handles_via => 'Array', + is => 'rw', + default => sub { [] }, + handles => { + "push_$list" => 'push', + }, ); - - __PACKAGE__->meta->add_method("push_$list" => sub { - my $self = shift; - push @{ $self->$list }, @_; - }); } has $_ => ( @@ -71,9 +70,6 @@ sub compare { return $self->SUPER::compare($other, $deep); } - -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/PublicKey.pm b/lib/GnuPG/PublicKey.pm index 69609b3..62a7963 100644 --- a/lib/GnuPG/PublicKey.pm +++ b/lib/GnuPG/PublicKey.pm @@ -14,12 +14,10 @@ # package GnuPG::PublicKey; -use Any::Moose; +use Moo; BEGIN { extends qw( GnuPG::PrimaryKey ) } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/Revoker.pm b/lib/GnuPG/Revoker.pm index 151a2f5..0bd79dd 100644 --- a/lib/GnuPG/Revoker.pm +++ b/lib/GnuPG/Revoker.pm @@ -15,7 +15,8 @@ # package GnuPG::Revoker; -use Any::Moose; +use Moo; +use MooX::late; has [qw( algo_num @@ -70,8 +71,6 @@ sub compare { return 1; } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/SecretKey.pm b/lib/GnuPG/SecretKey.pm index 18cc161..eead427 100644 --- a/lib/GnuPG/SecretKey.pm +++ b/lib/GnuPG/SecretKey.pm @@ -14,12 +14,10 @@ # package GnuPG::SecretKey; -use Any::Moose; +use Moo; BEGIN { extends qw( GnuPG::PrimaryKey ) } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/Signature.pm b/lib/GnuPG/Signature.pm index c2ba189..5020bb7 100644 --- a/lib/GnuPG/Signature.pm +++ b/lib/GnuPG/Signature.pm @@ -14,7 +14,8 @@ # package GnuPG::Signature; -use Any::Moose; +use Moo; +use MooX::late; has [qw( validity @@ -62,8 +63,6 @@ sub compare { return 1; } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/SubKey.pm b/lib/GnuPG/SubKey.pm index 1e5f606..f5d7872 100644 --- a/lib/GnuPG/SubKey.pm +++ b/lib/GnuPG/SubKey.pm @@ -14,8 +14,9 @@ # package GnuPG::SubKey; -use Any::Moose; use Carp; +use Moo; +use MooX::late; BEGIN { extends qw( GnuPG::Key ) } has [qw( validity owner_trust local_id )] => ( @@ -43,8 +44,6 @@ sub signature { } } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/UserAttribute.pm b/lib/GnuPG/UserAttribute.pm index 22ffbd1..ddc7ead 100644 --- a/lib/GnuPG/UserAttribute.pm +++ b/lib/GnuPG/UserAttribute.pm @@ -15,7 +15,8 @@ # package GnuPG::UserAttribute; -use Any::Moose; +use Moo; +use MooX::late; has [qw( validity subpacket_count subpacket_total_size )] => ( isa => 'Any', @@ -42,8 +43,6 @@ sub push_revocations { push @{ $self->revocations }, @_; } -__PACKAGE__->meta->make_immutable; - 1; __END__ diff --git a/lib/GnuPG/UserId.pm b/lib/GnuPG/UserId.pm index eef2da1..8c4124f 100644 --- a/lib/GnuPG/UserId.pm +++ b/lib/GnuPG/UserId.pm @@ -14,7 +14,8 @@ # package GnuPG::UserId; -use Any::Moose; +use Moo; +use MooX::late; has [qw( validity as_string )] => ( isa => 'Any', @@ -77,8 +78,6 @@ sub user_id_string { return $self->as_string(); } -__PACKAGE__->meta->make_immutable; - 1; __END__
Ping? Did you get a chance to have a look at this patch?
Subject: Re: [rt.cpan.org #88445] Please migrate to Moo
Date: Mon, 27 Jan 2014 17:02:35 -0500
To: bug-GnuPG-Interface [...] rt.cpan.org
From: Alex Vandiver <alex [...] chmrr.net>
On Mon, 2014-01-27 at 04:17 -0500, intrigeri via RT wrote: Show quoted text
> Ping? Did you get a chance to have a look at this patch?
Thanks; applied. Sorry for the delay. I'll push a dev release shortly, and follow that up with an official release. - Alex
Subject: Re: [rt.cpan.org #88445] Please migrate to Moo
Date: Mon, 10 Mar 2014 11:36:27 -0400
To: bug-GnuPG-Interface [...] rt.cpan.org
From: Alex Vandiver <alex [...] chmrr.net>
On Mon, 2014-01-27 at 17:02 -0500, Alex Vandiver via RT wrote: Show quoted text
> Thanks; applied. Sorry for the delay. I'll push a dev release shortly, > and follow that up with an official release.
Released as 0.47. - Alex