Skip to content

Commit

Permalink
Use Moose and make_immutable consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
rwstauner committed May 7, 2015
1 parent 0ab0ddc commit 28b31b4
Show file tree
Hide file tree
Showing 44 changed files with 150 additions and 20 deletions.
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Sitemap.pm
Expand Up @@ -118,4 +118,6 @@ sub process {
return;
}

__PACKAGE__->meta->make_immutable;

1;
1 change: 1 addition & 0 deletions lib/MetaCPAN/Web.pm
Expand Up @@ -47,5 +47,6 @@ sub token {
}

__PACKAGE__->setup();
__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller.pm
Expand Up @@ -9,3 +9,5 @@ BEGIN { extends 'Catalyst::Controller'; }
with('MetaCPAN::Web::Role::Elasticsearch::Adapter');

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/About.pm
Expand Up @@ -44,4 +44,6 @@ sub metadata : Local {
$c->stash( template => 'about/metadata.html' );
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Account.pm
Expand Up @@ -92,4 +92,6 @@ sub profile : Local {
}
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Account/Favorite.pm
Expand Up @@ -92,3 +92,5 @@ sub _add_fav_list_to_stash {
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Account/Turing.pm
Expand Up @@ -35,3 +35,5 @@ sub index : Path('') {
}

__PACKAGE__->meta->make_immutable;

1;
10 changes: 7 additions & 3 deletions lib/MetaCPAN/Web/Controller/Activity.pm
@@ -1,7 +1,9 @@
package MetaCPAN::Web::Controller::Activity;
use strict;
use warnings;
use base 'MetaCPAN::Web::Controller';

use Moose;

BEGIN { extends 'MetaCPAN::Web::Controller' }

use DateTime;

my %res = ( week => '1w', month => 'month' );
Expand Down Expand Up @@ -71,4 +73,6 @@ sub index : Path {

}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Changes.pm
Expand Up @@ -64,4 +64,6 @@ sub get : Private {
}
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Diff.pm
Expand Up @@ -22,4 +22,6 @@ sub diff_files : Chained('index') : PathPart('file') : Args(0) {
$c->stash( { diff => $diff, template => 'diff.html', type => 'source' } );
}

__PACKAGE__->meta->make_immutable;

1;
7 changes: 4 additions & 3 deletions lib/MetaCPAN/Web/Controller/Favorite.pm
@@ -1,7 +1,6 @@
package MetaCPAN::Web::Controller::Favorite;
use strict;
use warnings;
use base 'MetaCPAN::Web::Controller';
use Moose;
BEGIN { extends 'MetaCPAN::Web::Controller' }

sub recent : Path('/favorite/recent') {
my ( $self, $c ) = @_;
Expand Down Expand Up @@ -55,4 +54,6 @@ sub index : Path('/favorite/leaderboard') {
);
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Feed.pm
Expand Up @@ -171,4 +171,6 @@ sub end : Private {
$c->res->body( $c->stash->{feed} );
}

__PACKAGE__->meta->make_immutable;

1;
3 changes: 2 additions & 1 deletion lib/MetaCPAN/Web/Controller/Lab.pm
Expand Up @@ -73,5 +73,6 @@ sub dashboard : Chained('index') : PathPart {
);
}

1;
__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Login.pm
Expand Up @@ -28,6 +28,8 @@ sub index : Path {
}
}

__PACKAGE__->meta->make_immutable;

use Plack::Middleware::Session::Cookie;

package Plack::Middleware::Session::Cookie;
Expand Down
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Mirrors.pm
Expand Up @@ -64,4 +64,6 @@ sub index : Path {
);
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Module.pm
Expand Up @@ -29,4 +29,6 @@ sub redirect_to_pod : PathPart('module') : Chained('/') : Args {
$c->detach();
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/News.pm
Expand Up @@ -17,4 +17,6 @@ sub news : Local : Path('/news') {
$c->stash( template => 'news.html', news => $news );
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Pod.pm
Expand Up @@ -188,4 +188,6 @@ sub view : Private {
}
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Raw.pm
Expand Up @@ -33,4 +33,6 @@ sub index : PathPart('raw') : Chained('/') : Args {
}
}

__PACKAGE__->meta->make_immutable;

1;
7 changes: 4 additions & 3 deletions lib/MetaCPAN/Web/Controller/Recent.pm
@@ -1,7 +1,6 @@
package MetaCPAN::Web::Controller::Recent;
use strict;
use warnings;
use base 'MetaCPAN::Web::Controller';
use Moose;
BEGIN { extends 'MetaCPAN::Web::Controller' }

sub index : Path {
my ( $self, $c ) = @_;
Expand Down Expand Up @@ -37,4 +36,6 @@ sub faves : Path('/recent/favorites') {
$c->detach;
}

__PACKAGE__->meta->make_immutable;

1;
7 changes: 4 additions & 3 deletions lib/MetaCPAN/Web/Controller/Recent/TopUploaders.pm
@@ -1,7 +1,6 @@
package MetaCPAN::Web::Controller::Recent::TopUploaders;
use strict;
use warnings;
use base 'MetaCPAN::Web::Controller';
use Moose;
BEGIN { extends 'MetaCPAN::Web::Controller' }

sub weekly : Local {
my ( $self, $c ) = @_;
Expand Down Expand Up @@ -48,4 +47,6 @@ sub topuploaders : Private {
);
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Release.pm
Expand Up @@ -136,4 +136,6 @@ sub view : Private {
);
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Requires.pm
Expand Up @@ -64,4 +64,6 @@ sub module : Chained('index') : PathPart : Args(1) : Does('Sortable') {
);
}

__PACKAGE__->meta->make_immutable;

1;
1 change: 1 addition & 0 deletions lib/MetaCPAN/Web/Controller/Search.pm
Expand Up @@ -110,4 +110,5 @@ sub index : Path {
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Search/AutoComplete.pm
Expand Up @@ -19,4 +19,6 @@ sub index : Path {
);
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Controller/Source.pm
Expand Up @@ -104,4 +104,6 @@ sub detect_filetype {
return 'plain';
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Model/API.pm
Expand Up @@ -184,4 +184,6 @@ sub raw_api_response {
return +{ raw => $data };
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Model/API/Changes.pm
Expand Up @@ -140,4 +140,6 @@ sub filter_release_changes {
return $changelog;
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Model/API/Changes/Parser.pm
Expand Up @@ -191,4 +191,6 @@ sub _expand_tab {
return $string;
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Model/API/Diff.pm
Expand Up @@ -30,4 +30,6 @@ sub digest {
return $digest;
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Model/API/Favorite.pm
Expand Up @@ -193,3 +193,5 @@ sub plusser_by_id {
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Model/API/File.pm
Expand Up @@ -42,4 +42,6 @@ sub dir {
);
}

__PACKAGE__->meta->make_immutable;

1;
1 change: 0 additions & 1 deletion lib/MetaCPAN/Web/Model/API/Lab.pm
Expand Up @@ -172,4 +172,3 @@ sub fetch_latest_distros {
__PACKAGE__->meta->make_immutable;

1;

2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Model/API/Module.pm
Expand Up @@ -478,3 +478,5 @@ sub requires {
}

__PACKAGE__->meta->make_immutable;

1;
1 change: 1 addition & 0 deletions lib/MetaCPAN/Web/Model/API/Rating.pm
Expand Up @@ -78,6 +78,7 @@ sub get {
);
return $cv;
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/Model/API/User.pm
Expand Up @@ -46,4 +46,6 @@ sub turing {
);
}

__PACKAGE__->meta->make_immutable;

1;
1 change: 1 addition & 0 deletions lib/MetaCPAN/Web/Model/ReleaseInfo.pm
Expand Up @@ -220,4 +220,5 @@ sub normalize_issue_url {
}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 2 additions & 0 deletions lib/MetaCPAN/Web/User.pm
Expand Up @@ -47,3 +47,5 @@ sub supports {
}

__PACKAGE__->meta->make_immutable( inline_constructor => 0 );

1;
7 changes: 4 additions & 3 deletions lib/MetaCPAN/Web/View/HTML.pm
@@ -1,8 +1,7 @@
package MetaCPAN::Web::View::HTML;

use strict;
use warnings;
use base 'Catalyst::View::TT::Alloy';
use Moose;
extends 'Catalyst::View::TT::Alloy';

use mro;
use Digest::MD5 qw(md5_hex);
Expand Down Expand Up @@ -218,4 +217,6 @@ Template::Alloy->define_vmethod(
},
);

__PACKAGE__->meta->make_immutable( inline_constructor => 0 );

1;
6 changes: 6 additions & 0 deletions lib/MetaCPAN/Web/View/JSON.pm
@@ -1,4 +1,10 @@
package MetaCPAN::Web::View::JSON;

use Moose;

extends 'Catalyst::View::JSON';

# Catalyst::View::JSON is not a Moose.
__PACKAGE__->meta->make_immutable( inline_constructor => 0 );

1;
7 changes: 4 additions & 3 deletions lib/MetaCPAN/Web/View/Raw.pm
@@ -1,8 +1,7 @@
package MetaCPAN::Web::View::Raw;

use strict;
use warnings;
use base 'MetaCPAN::Web::View::HTML';
use Moose;
extends 'MetaCPAN::Web::View::HTML';

sub COMPONENT {
my $self = shift;
Expand All @@ -12,4 +11,6 @@ sub COMPONENT {
return $self->SUPER::COMPONENT( $app, $config );
}

__PACKAGE__->meta->make_immutable( inline_constructor => 0 );

1;
2 changes: 2 additions & 0 deletions t/lib/TestApp.pm
Expand Up @@ -13,4 +13,6 @@ sub token {
return;
}

__PACKAGE__->meta->make_immutable;

1;

0 comments on commit 28b31b4

Please sign in to comment.