1 |
commit: 327a4ed4a91cc5803d80fa1134cdcaac8b22dd3b |
2 |
Author: Kent Fredric <kentfredric <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Oct 31 18:04:47 2011 +0000 |
4 |
Commit: Kent Fredric <kentfredric <AT> gmail <DOT> com> |
5 |
CommitDate: Mon Oct 31 18:04:47 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/perl-overlay.git;a=commit;h=327a4ed4 |
7 |
|
8 |
[scripts/dual-life.pl] Tidy code |
9 |
|
10 |
--- |
11 |
scripts/dual-life.pl | 57 +++++++++++++++++++++++-------------------------- |
12 |
1 files changed, 27 insertions(+), 30 deletions(-) |
13 |
|
14 |
diff --git a/scripts/dual-life.pl b/scripts/dual-life.pl |
15 |
index 458e1f9..9d7fe80 100644 |
16 |
--- a/scripts/dual-life.pl |
17 |
+++ b/scripts/dual-life.pl |
18 |
@@ -23,9 +23,7 @@ my $perls = { |
19 |
stable => CoreGroup->new( name => 'stable', perls => [qw( 5.12.3 5.12.4 )] ), |
20 |
}; |
21 |
|
22 |
- |
23 |
-pp $perls->{masked_future}->get_perl(qw( 5.14.2 ))->delta( |
24 |
- $perls->{stable}->get_perl(qw( 5.12.4 )) ); |
25 |
+pp $perls->{masked_future}->get_perl(qw( 5.14.2 ))->delta( $perls->{stable}->get_perl(qw( 5.12.4 )) ); |
26 |
|
27 |
#for my $group ( $perls->{masked_future} ) { |
28 |
# for my $perl ( values $group->perls ) { |
29 |
@@ -83,49 +81,47 @@ BEGIN { |
30 |
|
31 |
__PACKAGE__->meta->make_immutable; |
32 |
|
33 |
- |
34 |
sub delta { |
35 |
- my ( $self, $other ) = @_ ; |
36 |
- my ( %all ) = map { $_ , 1 } |
37 |
+ my ( $self, $other ) = @_; |
38 |
+ my (%all) = map { $_, 1 } |
39 |
$self->module_names, |
40 |
$other->module_names; |
41 |
my %diffs; |
42 |
for my $module ( keys %all ) { |
43 |
- if( $self->has_module( $module ) and not $other->has_module( $module ) ) { |
44 |
+ if ( $self->has_module($module) and not $other->has_module($module) ) { |
45 |
$diffs{$module} = { |
46 |
- kind => 'ours', |
47 |
- available_in => $self->perl_version, |
48 |
- not_available_in => $other->perl_version, |
49 |
- module => $module, |
50 |
- available_version => $self->module( $module )->version, |
51 |
+ kind => 'ours', |
52 |
+ available_in => $self->perl_version, |
53 |
+ not_available_in => $other->perl_version, |
54 |
+ module => $module, |
55 |
+ available_version => $self->module($module)->version, |
56 |
}; |
57 |
next; |
58 |
} |
59 |
- if( not $self->has_module( $module ) and $other->has_module( $module ) ) { |
60 |
+ if ( not $self->has_module($module) and $other->has_module($module) ) { |
61 |
$diffs{$module} = { |
62 |
- kind => 'theirs', |
63 |
- available_in => $other->perl_version, |
64 |
- not_available_in => $self->perl_version, |
65 |
- module => $module, |
66 |
- available_version => $other->module( $module )->version, |
67 |
+ kind => 'theirs', |
68 |
+ available_in => $other->perl_version, |
69 |
+ not_available_in => $self->perl_version, |
70 |
+ module => $module, |
71 |
+ available_version => $other->module($module)->version, |
72 |
}; |
73 |
next; |
74 |
} |
75 |
- if ( ( $self->module( $module )->version // 'undef' ) ne ( $other->module($module)->version // 'undef' ) ) { |
76 |
- $diffs{$module} = { |
77 |
- kind => 'cross', |
78 |
- module => $module, |
79 |
- our_version => $self->module( $module )->version, |
80 |
- their_version => $other->module( $module )->version, |
81 |
- our_perl => $self->perl_version, |
82 |
- their_perl => $other->perl_version, |
83 |
+ if ( ( $self->module($module)->version // 'undef' ) ne ( $other->module($module)->version // 'undef' ) ) { |
84 |
+ $diffs{$module} = { |
85 |
+ kind => 'cross', |
86 |
+ module => $module, |
87 |
+ our_version => $self->module($module)->version, |
88 |
+ their_version => $other->module($module)->version, |
89 |
+ our_perl => $self->perl_version, |
90 |
+ their_perl => $other->perl_version, |
91 |
}; |
92 |
} |
93 |
|
94 |
} |
95 |
return \%diffs; |
96 |
} |
97 |
- |
98 |
|
99 |
# BUILDERS |
100 |
sub _build_perl_version { |
101 |
@@ -184,16 +180,17 @@ BEGIN { |
102 |
__PACKAGE__->meta->make_immutable; |
103 |
|
104 |
sub get_perl { |
105 |
- my ($self,$perlv) = @_; |
106 |
- if ( not exists $self->perls->{$perlv} ) { |
107 |
+ my ( $self, $perlv ) = @_; |
108 |
+ if ( not exists $self->perls->{$perlv} ) { |
109 |
die "No key $perlv"; |
110 |
} |
111 |
return $self->perls->{$perlv}; |
112 |
} |
113 |
+ |
114 |
# BUILDERS |
115 |
sub _build_perls { |
116 |
my $self = shift; |
117 |
- return { map { $_ , CoreList::Single->new( coregroup => $self->name, perl => $_ ) } @{ $self->_perls } }; |
118 |
+ return { map { $_, CoreList::Single->new( coregroup => $self->name, perl => $_ ) } @{ $self->_perls } }; |
119 |
} |
120 |
|
121 |
} |