Skip to content

Commit

Permalink
use Angelos::Class
Browse files Browse the repository at this point in the history
  • Loading branch information
dann committed Jan 16, 2009
1 parent 26ad799 commit 657880f
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 98 deletions.
17 changes: 7 additions & 10 deletions angelos-core/lib/Angelos.pm
Expand Up @@ -40,8 +40,8 @@ has 'host' => (
); );


has 'port' => ( has 'port' => (
is => 'rw', is => 'rw',
isa => 'Int', isa => 'Int',
default => 3000, default => 3000,
); );


Expand Down Expand Up @@ -105,9 +105,7 @@ sub setup_debug_plugins {


sub setup_home { sub setup_home {
my $self = shift; my $self = shift;
my $home = Angelos::Home->home(ref $self); my $home = Angelos::Home->home( ref $self );
# my $home = Angelos::Home->guess_home( ref $self );
# Angelos::Home->set_home($home) if -d $home;
return $home; return $home;
} }


Expand All @@ -120,8 +118,7 @@ sub setup_engine {
server => $self->server, server => $self->server,
conf => $self->conf, conf => $self->conf,
); );
$engine->load_plugin( $_->{module} ) $engine->load_plugin( $_->{module} ) for $self->config->plugins('engine');
for $self->config->plugins('engine');
$self->engine($engine); $self->engine($engine);
$engine; $engine;
} }
Expand Down Expand Up @@ -169,7 +166,7 @@ sub is_debug {
return $is_debug; return $is_debug;
} }


__END_CLASS__ __END_OF_CLASS__


__END__ __END__
Expand All @@ -181,9 +178,9 @@ Angelos -
package MyApp; package MyApp;
use Mouse; use Angelos::Class;
extends 'Angelos'; extends 'Angelos';
1; __END_OF_CLASS__
use MyApp; use MyApp;
my $app = MyApp->new; my $app = MyApp->new;
Expand Down
6 changes: 3 additions & 3 deletions angelos-core/lib/Angelos/Class.pm
Expand Up @@ -19,9 +19,9 @@ sub import {
return if $caller eq 'main'; return if $caller eq 'main';


no strict 'refs'; no strict 'refs';
*{"$caller\::__END_CLASS__"} = sub { *{"$caller\::__END_OF_CLASS__"} = sub {
my $caller = caller(0); my $caller = caller(0);
__END_CLASS__($caller); __END_OF_CLASS__($caller);
}; };


strict->import; strict->import;
Expand All @@ -32,7 +32,7 @@ sub import {
Mouse->export_to_level(1); Mouse->export_to_level(1);
} }


sub __END_CLASS__ { sub __END_OF_CLASS__ {
my ( $caller, ) = @_; my ( $caller, ) = @_;


Mouse::unimport; Mouse::unimport;
Expand Down
8 changes: 2 additions & 6 deletions angelos-core/lib/Angelos/Component/Loader.pm
@@ -1,5 +1,5 @@
package Angelos::Component::Loader; package Angelos::Component::Loader;
use Mouse; use Angelos::Class;
use Module::Pluggable::Object; use Module::Pluggable::Object;
use Angelos::Utils; use Angelos::Utils;
use Devel::InnerPackage; use Devel::InnerPackage;
Expand All @@ -14,8 +14,6 @@ has 'components' => (


with 'Angelos::Class::Configurable'; with 'Angelos::Class::Configurable';


no Mouse;

sub load_components { sub load_components {
my ( $self, $class ) = @_; my ( $self, $class ) = @_;


Expand Down Expand Up @@ -136,6 +134,4 @@ sub _application_class {
Angelos::Config->application_class; Angelos::Config->application_class;
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__

1;
8 changes: 2 additions & 6 deletions angelos-core/lib/Angelos/Console.pm
@@ -1,5 +1,5 @@
package Angelos::Console; package Angelos::Console;
use Mouse; use Angelos::Class;
use Term::ReadLine; use Term::ReadLine;
use Devel::EvalContext; use Devel::EvalContext;
with 'Angelos::Class::Pluggable'; with 'Angelos::Class::Pluggable';
Expand All @@ -23,8 +23,6 @@ has 'out_fh' => (
default => sub { shift->term->OUT || \*STDOUT; } default => sub { shift->term->OUT || \*STDOUT; }
); );


no Mouse;

sub run { sub run {
my ($self) = @_; my ($self) = @_;


Expand Down Expand Up @@ -108,6 +106,4 @@ sub print {
print $fh "\n" if $self->term->ReadLine =~ /Gnu/; print $fh "\n" if $self->term->ReadLine =~ /Gnu/;
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__

1;
5 changes: 2 additions & 3 deletions angelos-core/lib/Angelos/Context.pm
@@ -1,5 +1,5 @@
package Angelos::Context; package Angelos::Context;
use Mouse; use Angelos::Class;
use Carp (); use Carp ();


with 'Angelos::Class::Pluggable'; with 'Angelos::Class::Pluggable';
Expand Down Expand Up @@ -79,9 +79,8 @@ sub redirect {
} }
} }


__PACKAGE__->meta->make_immutable( inline_destructor => 1 ); __END_OF_CLASS__


1;
__END__ __END__
=head1 NAME =head1 NAME
Expand Down
7 changes: 2 additions & 5 deletions angelos-core/lib/Angelos/Controller.pm
@@ -1,5 +1,5 @@
package Angelos::Controller; package Angelos::Controller;
use Mouse; use Angelos::Class;
use Carp (); use Carp ();
use Angelos::Exceptions; use Angelos::Exceptions;


Expand All @@ -25,8 +25,6 @@ has 'after_filters' => (
} }
); );


no Mouse;

sub SETUP {} sub SETUP {}


sub _call_filters { sub _call_filters {
Expand Down Expand Up @@ -72,9 +70,8 @@ sub ACTION {
$self->$action( $context, $params ); $self->$action( $context, $params );
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__


1;
__END__ __END__
=head1 NAME =head1 NAME
Expand Down
7 changes: 2 additions & 5 deletions angelos-core/lib/Angelos/Dispatcher.pm
@@ -1,5 +1,5 @@
package Angelos::Dispatcher; package Angelos::Dispatcher;
use Mouse; use Angelos::Class;
use Angelos::Dispatcher::Dispatch; use Angelos::Dispatcher::Dispatch;
use HTTP::Router; use HTTP::Router;


Expand All @@ -11,8 +11,6 @@ has 'router' => (
handles => [qw(uri_for)], handles => [qw(uri_for)],
); );


no Mouse;

sub dispatch_class { sub dispatch_class {
'Angelos::Dispatcher::Dispatch'; 'Angelos::Dispatcher::Dispatch';
} }
Expand All @@ -29,9 +27,8 @@ sub set_routeset {
$self->router->routeset($routeset); $self->router->routeset($routeset);
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__


1;
__END__ __END__
=head1 NAME =head1 NAME
Expand Down
8 changes: 2 additions & 6 deletions angelos-core/lib/Angelos/Dispatcher/Routes/Builder.pm
@@ -1,13 +1,11 @@
package Angelos::Dispatcher::Routes::Builder; package Angelos::Dispatcher::Routes::Builder;
use Mouse; use Angelos::Class;
use Angelos::Config; use Angelos::Config;
use HTTP::Router; use HTTP::Router;
use Angelos::Exceptions; use Angelos::Exceptions;


with 'Angelos::Class::Configurable'; with 'Angelos::Class::Configurable';


no Mouse;

sub build_from_config { sub build_from_config {
my $self = shift; my $self = shift;
my $conf_path = $self->config->routes_config_path; my $conf_path = $self->config->routes_config_path;
Expand All @@ -29,6 +27,4 @@ sub build {
\@routeset; \@routeset;
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__

1;
5 changes: 2 additions & 3 deletions angelos-core/lib/Angelos/Engine.pm
@@ -1,5 +1,5 @@
package Angelos::Engine; package Angelos::Engine;
use Mouse; use Angelos::Class;
use Carp (); use Carp ();
use Scalar::Util (); use Scalar::Util ();
use HTTP::Engine::Response; use HTTP::Engine::Response;
Expand Down Expand Up @@ -89,9 +89,8 @@ sub HANDLE_EXCEPTION {
$c->res->body( 'Internal Error:' . $error ); $c->res->body( 'Internal Error:' . $error );
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__


1;
__END__ __END__
=head1 NAME =head1 NAME
Expand Down
8 changes: 2 additions & 6 deletions angelos-core/lib/Angelos/MIMETypes.pm
@@ -1,5 +1,5 @@
package Angelos::MIMETypes; package Angelos::MIMETypes;
use Mouse; use Angelos::Class;


has 'types' => ( has 'types' => (
is => 'rw', is => 'rw',
Expand All @@ -21,8 +21,6 @@ has 'types' => (
} }
); );


no Mouse;

sub mime_type_of { sub mime_type_of {
my ( $self, $ext ) = @_; my ( $self, $ext ) = @_;
$self->types->{$ext} || 'text/plain'; $self->types->{$ext} || 'text/plain';
Expand All @@ -33,6 +31,4 @@ sub add_type {
$self->types->{$type} = $extension; $self->types->{$type} = $extension;
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__

1;
6 changes: 2 additions & 4 deletions angelos-core/lib/Angelos/Middleware.pm
@@ -1,19 +1,17 @@
package Angelos::Middleware; package Angelos::Middleware;
use Mouse; use Angelos::Class;
use Angelos::Exceptions; use Angelos::Exceptions;
with 'Angelos::Class::Loggable'; with 'Angelos::Class::Loggable';


no Mouse;


sub wrap { sub wrap {
my ( $self, $next ) = @_; my ( $self, $next ) = @_;
Angelos::Exception::AbstractMethod->throw( Angelos::Exception::AbstractMethod->throw(
message => 'Sub class must implement wrap method'); message => 'Sub class must implement wrap method');
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__


1;
__END__ __END__
=head1 NAME =head1 NAME
Expand Down
6 changes: 2 additions & 4 deletions angelos-core/lib/Angelos/Middleware/DebugRequest.pm
@@ -1,5 +1,5 @@
package Angelos::Middleware::DebugRequest; package Angelos::Middleware::DebugRequest;
use Mouse; use Angelos::Class;
use Text::SimpleTable; use Text::SimpleTable;
extends 'Angelos::Middleware'; extends 'Angelos::Middleware';


Expand Down Expand Up @@ -67,6 +67,4 @@ sub report_matching_info {
$self->log( level => 'info', message => $message ); $self->log( level => 'info', message => $message );
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__

1;
7 changes: 2 additions & 5 deletions angelos-core/lib/Angelos/Middleware/Profile.pm
@@ -1,10 +1,8 @@
package Angelos::Middleware::Profile; package Angelos::Middleware::Profile;
use Mouse; use Angelos::Class;
use Time::HiRes qw(time); use Time::HiRes qw(time);
extends 'Angelos::Middleware'; extends 'Angelos::Middleware';


no Mouse;

sub wrap { sub wrap {
my ( $self, $next ) = @_; my ( $self, $next ) = @_;


Expand All @@ -26,9 +24,8 @@ sub profile {
$result; $result;
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__


1;
__END__ __END__
=head1 NAME =head1 NAME
Expand Down
5 changes: 2 additions & 3 deletions angelos-core/lib/Angelos/Middleware/Unicode.pm
@@ -1,5 +1,5 @@
package Angelos::Middleware::Unicode; package Angelos::Middleware::Unicode;
use Mouse; use Angelos::Class;
use utf8; use utf8;


no Mouse; no Mouse;
Expand Down Expand Up @@ -33,9 +33,8 @@ sub decode_params {
} }
} }


__PACKAGE__->meta->make_immutable; __END_OF_CLASS__


1;
__END__ __END__
=head1 NAME =head1 NAME
Expand Down
8 changes: 2 additions & 6 deletions angelos-core/lib/Angelos/Model/JobQueue/Gearman.pm
@@ -1,9 +1,5 @@
package Angelos::Model::JobQueue::Gearman; package Angelos::Model::JobQueue::Gearman;
use Mouse; use Angelos::Class;
extends 'Angelos::JobQueue::Gearman::Client'; extends 'Angelos::JobQueue::Gearman::Client';


no Mouse; __END_OF_CLASS__

__PACKAGE__->meta->make_immutable;

1;
4 changes: 2 additions & 2 deletions angelos-core/lib/Angelos/Script/Command.pm
@@ -1,5 +1,5 @@
package Angelos::Script::Command; package Angelos::Script::Command;
use Mouse; use Angelos::Class;
use IPC::System::Simple; use IPC::System::Simple;
use base 'App::Cmd::Command'; use base 'App::Cmd::Command';


Expand All @@ -16,4 +16,4 @@ sub capture {
IPC::System::Simple::capturex(@args); IPC::System::Simple::capturex(@args);
} }


1; __END_OF_CLASS__
8 changes: 4 additions & 4 deletions angelos-core/lib/Angelos/Script/Command/Console.pm
@@ -1,5 +1,5 @@
package Angelos::Script::Command::Console; package Angelos::Script::Command::Console;
use Mouse; use Angelos::Class;
use Angelos::Console; use Angelos::Console;
use base qw(Angelos::Script::Command); use base qw(Angelos::Script::Command);


Expand Down Expand Up @@ -42,9 +42,9 @@ sub run {
$self->console->run; $self->console->run;
} }


no Mouse; __END_OF_CLASS__
__PACKAGE__->meta->make_immutable;
1; __END__
=head1 AUTHOR =head1 AUTHOR
Expand Down

0 comments on commit 657880f

Please sign in to comment.