Permalink
Browse files

Remove specific accessors for git/ref stuff. It's up to the user of t…

…his module now
  • Loading branch information...
1 parent 72adf42 commit a132af5d0f196d47b6f52832f49476e15b3af23c @miyagawa committed Sep 20, 2013
Showing with 6 additions and 17 deletions.
  1. +6 −17 lib/Module/CPANfile/Requirement.pm
@@ -1,32 +1,21 @@
package Module::CPANfile::Requirement;
use strict;
-sub options {
- my $self = shift;
-
- my $hash = { %$self }; # clone
- delete $hash->{$_} for qw( name version );
-
- $hash;
-}
-
sub new {
my ($class, %args) = @_;
$args{version} ||= 0;
bless +{
- name => $args{name},
- version => $args{version},
- (exists $args{git} ? (git => $args{git}) : ()),
- (exists $args{ref} ? (ref => $args{ref}) : ()),
+ name => delete $args{name},
+ version => delete $args{version},
+ options => \%args,
}, $class;
}
-sub name { shift->{name} }
-sub version { shift->{version} }
+sub name { $_[0]->{name} }
+sub version { $_[0]->{version} }
-sub git { shift->{git} }
-sub ref { shift->{ref} }
+sub options { $_[0]->{options} }
1;

0 comments on commit a132af5

Please sign in to comment.