Permalink
Browse files

perltidy

  • Loading branch information...
1 parent 8daed8a commit 788010b9d4279b6a90d5ac393611cc69543bef0b @bricas bricas committed May 9, 2012
View
@@ -7,34 +7,35 @@ use Catalyst::Runtime 5.80;
use Catalyst qw/
ConfigLoader
Static::Simple
-/;
+ /;
extends 'Catalyst';
our $VERSION = '0.01';
__PACKAGE__->config(
- name => 'SixteenColors::Paste',
+ name => 'SixteenColors::Paste',
disable_component_resolution_regex_fallback => 1,
- enable_catalyst_header => 1, # Send X-Catalyst header
+ enable_catalyst_header => 1, # Send X-Catalyst header
);
# Start the application
__PACKAGE__->setup();
sub fillform {
- my $c = shift;
- my $fdat = shift || $c->request->parameters;
+ my $c = shift;
+ my $fdat = shift || $c->request->parameters;
my $additional_params = shift;
- return 1 unless ($c->response->{body});
+ return 1 unless ( $c->response->{ body } );
$c->response->output(
HTML::FillInForm->new->fill(
- scalarref => \$c->response->{body},
+ scalarref => \$c->response->{ body },
fdat => $fdat,
%$additional_params,
- ) || ''
+ )
+ || ''
);
}
@@ -8,63 +8,64 @@ use Image::TextMode::Loader;
use Image::TextMode::Renderer::GD;
use HTML::FillInForm;
-__PACKAGE__->config(namespace => '');
+__PACKAGE__->config( namespace => '' );
-sub index :Path :Args(0) {
+sub index : Path : Args(0) {
my ( $self, $c ) = @_;
- if( lc( $c->req->method ) eq 'post' && $c->req->params->{ file } ) {
+ if ( lc( $c->req->method ) eq 'post' && $c->req->params->{ file } ) {
my $paste = $c->model( 'DB::Paste' )->create( {} );
my $id = $paste->url_fragment;
my $upload = $c->req->upload( 'file' );
- my( $ext ) = $upload->basename =~ m{\.([^.]+)$};
+ my ( $ext ) = $upload->basename =~ m{\.([^.]+)$};
$ext = lc( $ext );
$upload->copy_to( $c->path_to( "root/static/paste/${id}.${ext}" ) );
$c->stash(
- id => $id,
+ id => $id,
template => 'uploaded.tt',
- url => $c->uri_for( '/', $id ),
+ url => $c->uri_for( '/', $id ),
);
return;
}
}
-sub instance :Chained('/') PathPart('') CaptureArgs(1) {
+sub instance : Chained('/') PathPart('') CaptureArgs(1) {
my ( $self, $c, $id ) = @_;
- my $paste = $c->model( 'DB::Paste' )->find( { url_fragment => $id }, { key => 'paste_url_fragment' } );
+ my $paste = $c->model( 'DB::Paste' )
+ ->find( { url_fragment => $id }, { key => 'paste_url_fragment' } );
- if( !$paste ) {
+ if ( !$paste ) {
$c->response->body( 'Page not found' );
- $c->response->status(404);
+ $c->response->status( 404 );
return;
}
my $dir = Path::Class::Dir->new( $c->path_to( "root/static/paste/" ) );
my $file;
- while( $file = $dir->next ) {
+ while ( $file = $dir->next ) {
last if $file->basename =~ m{^$id\.};
}
$c->stash(
- id => $id,
- file => $file,
+ id => $id,
+ file => $file,
paste => $paste
);
}
-sub view :Chained('instance') PathPart('') Args(0) {
- my ( $self, $c) = @_;
+sub view : Chained('instance') PathPart('') Args(0) {
+ my ( $self, $c ) = @_;
$c->stash( fillform => 1 );
}
-sub render :Chained('instance') PathPart('render') Args(0) {
+sub render : Chained('instance') PathPart('render') Args(0) {
my ( $self, $c ) = @_;
- my $opts = $c->req->params;
+ my $opts = $c->req->params;
my $read_opts = { width => delete $opts->{ width } };
my $file = $c->stash->{ file };
@@ -75,10 +76,10 @@ sub render :Chained('instance') PathPart('render') Args(0) {
$c->res->content_type( 'image/png' );
}
-sub default :Path {
+sub default : Path {
my ( $self, $c ) = @_;
$c->response->body( 'Page not found' );
- $c->response->status(404);
+ $c->response->status( 404 );
}
sub end : Private {
@@ -87,7 +88,8 @@ sub end : Private {
$c->fillform( $c->req->params ) if $c->stash->{ fillform };
}
-sub render_view : ActionClass('RenderView') { }
+sub render_view : ActionClass('RenderView') {
+}
__PACKAGE__->meta->make_immutable;
@@ -32,7 +32,8 @@ __PACKAGE__->add_unique_constraint( [ 'url_fragment' ] );
sub insert {
my ( $self, @args ) = @_;
$self->next::method( @args );
- $self->update( { url_fragment => Encode::Base58::encode_base58( $self->id ) } );
+ $self->update(
+ { url_fragment => Encode::Base58::encode_base58( $self->id ) } );
return $self;
}
@@ -6,8 +6,8 @@ extends 'Catalyst::View::TT';
__PACKAGE__->config(
TEMPLATE_EXTENSION => '.tt',
- render_die => 1,
- WRAPPER => 'wrapper.tt',
+ render_die => 1,
+ WRAPPER => 'wrapper.tt',
);
=head1 NAME

0 comments on commit 788010b

Please sign in to comment.