Permalink
Browse files

use Angelos::Class

  • Loading branch information...
1 parent 26ad799 commit 657880fc85f86173996eca6ae39a399d82fa1e55 @dann committed Jan 16, 2009
View
17 angelos-core/lib/Angelos.pm
@@ -40,8 +40,8 @@ has 'host' => (
);
has 'port' => (
- is => 'rw',
- isa => 'Int',
+ is => 'rw',
+ isa => 'Int',
default => 3000,
);
@@ -105,9 +105,7 @@ sub setup_debug_plugins {
sub setup_home {
my $self = shift;
- my $home = Angelos::Home->home(ref $self);
-# my $home = Angelos::Home->guess_home( ref $self );
-# Angelos::Home->set_home($home) if -d $home;
+ my $home = Angelos::Home->home( ref $self );
return $home;
}
@@ -120,8 +118,7 @@ sub setup_engine {
server => $self->server,
conf => $self->conf,
);
- $engine->load_plugin( $_->{module} )
- for $self->config->plugins('engine');
+ $engine->load_plugin( $_->{module} ) for $self->config->plugins('engine');
$self->engine($engine);
$engine;
}
@@ -169,7 +166,7 @@ sub is_debug {
return $is_debug;
}
-__END_CLASS__
+__END_OF_CLASS__
__END__
@@ -181,9 +178,9 @@ Angelos -
package MyApp;
- use Mouse;
+ use Angelos::Class;
extends 'Angelos';
- 1;
+ __END_OF_CLASS__
use MyApp;
my $app = MyApp->new;
View
6 angelos-core/lib/Angelos/Class.pm
@@ -19,9 +19,9 @@ sub import {
return if $caller eq 'main';
no strict 'refs';
- *{"$caller\::__END_CLASS__"} = sub {
+ *{"$caller\::__END_OF_CLASS__"} = sub {
my $caller = caller(0);
- __END_CLASS__($caller);
+ __END_OF_CLASS__($caller);
};
strict->import;
@@ -32,7 +32,7 @@ sub import {
Mouse->export_to_level(1);
}
-sub __END_CLASS__ {
+sub __END_OF_CLASS__ {
my ( $caller, ) = @_;
Mouse::unimport;
View
8 angelos-core/lib/Angelos/Component/Loader.pm
@@ -1,5 +1,5 @@
package Angelos::Component::Loader;
-use Mouse;
+use Angelos::Class;
use Module::Pluggable::Object;
use Angelos::Utils;
use Devel::InnerPackage;
@@ -14,8 +14,6 @@ has 'components' => (
with 'Angelos::Class::Configurable';
-no Mouse;
-
sub load_components {
my ( $self, $class ) = @_;
@@ -136,6 +134,4 @@ sub _application_class {
Angelos::Config->application_class;
}
-__PACKAGE__->meta->make_immutable;
-
-1;
+__END_OF_CLASS__
View
8 angelos-core/lib/Angelos/Console.pm
@@ -1,5 +1,5 @@
package Angelos::Console;
-use Mouse;
+use Angelos::Class;
use Term::ReadLine;
use Devel::EvalContext;
with 'Angelos::Class::Pluggable';
@@ -23,8 +23,6 @@ has 'out_fh' => (
default => sub { shift->term->OUT || \*STDOUT; }
);
-no Mouse;
-
sub run {
my ($self) = @_;
@@ -108,6 +106,4 @@ sub print {
print $fh "\n" if $self->term->ReadLine =~ /Gnu/;
}
-__PACKAGE__->meta->make_immutable;
-
-1;
+__END_OF_CLASS__
View
5 angelos-core/lib/Angelos/Context.pm
@@ -1,5 +1,5 @@
package Angelos::Context;
-use Mouse;
+use Angelos::Class;
use Carp ();
with 'Angelos::Class::Pluggable';
@@ -79,9 +79,8 @@ sub redirect {
}
}
-__PACKAGE__->meta->make_immutable( inline_destructor => 1 );
+__END_OF_CLASS__
-1;
__END__
=head1 NAME
View
7 angelos-core/lib/Angelos/Controller.pm
@@ -1,5 +1,5 @@
package Angelos::Controller;
-use Mouse;
+use Angelos::Class;
use Carp ();
use Angelos::Exceptions;
@@ -25,8 +25,6 @@ has 'after_filters' => (
}
);
-no Mouse;
-
sub SETUP {}
sub _call_filters {
@@ -72,9 +70,8 @@ sub ACTION {
$self->$action( $context, $params );
}
-__PACKAGE__->meta->make_immutable;
+__END_OF_CLASS__
-1;
__END__
=head1 NAME
View
7 angelos-core/lib/Angelos/Dispatcher.pm
@@ -1,5 +1,5 @@
package Angelos::Dispatcher;
-use Mouse;
+use Angelos::Class;
use Angelos::Dispatcher::Dispatch;
use HTTP::Router;
@@ -11,8 +11,6 @@ has 'router' => (
handles => [qw(uri_for)],
);
-no Mouse;
-
sub dispatch_class {
'Angelos::Dispatcher::Dispatch';
}
@@ -29,9 +27,8 @@ sub set_routeset {
$self->router->routeset($routeset);
}
-__PACKAGE__->meta->make_immutable;
+__END_OF_CLASS__
-1;
__END__
=head1 NAME
View
8 angelos-core/lib/Angelos/Dispatcher/Routes/Builder.pm
@@ -1,13 +1,11 @@
package Angelos::Dispatcher::Routes::Builder;
-use Mouse;
+use Angelos::Class;
use Angelos::Config;
use HTTP::Router;
use Angelos::Exceptions;
with 'Angelos::Class::Configurable';
-no Mouse;
-
sub build_from_config {
my $self = shift;
my $conf_path = $self->config->routes_config_path;
@@ -29,6 +27,4 @@ sub build {
\@routeset;
}
-__PACKAGE__->meta->make_immutable;
-
-1;
+__END_OF_CLASS__
View
5 angelos-core/lib/Angelos/Engine.pm
@@ -1,5 +1,5 @@
package Angelos::Engine;
-use Mouse;
+use Angelos::Class;
use Carp ();
use Scalar::Util ();
use HTTP::Engine::Response;
@@ -89,9 +89,8 @@ sub HANDLE_EXCEPTION {
$c->res->body( 'Internal Error:' . $error );
}
-__PACKAGE__->meta->make_immutable;
+__END_OF_CLASS__
-1;
__END__
=head1 NAME
View
8 angelos-core/lib/Angelos/MIMETypes.pm
@@ -1,5 +1,5 @@
package Angelos::MIMETypes;
-use Mouse;
+use Angelos::Class;
has 'types' => (
is => 'rw',
@@ -21,8 +21,6 @@ has 'types' => (
}
);
-no Mouse;
-
sub mime_type_of {
my ( $self, $ext ) = @_;
$self->types->{$ext} || 'text/plain';
@@ -33,6 +31,4 @@ sub add_type {
$self->types->{$type} = $extension;
}
-__PACKAGE__->meta->make_immutable;
-
-1;
+__END_OF_CLASS__
View
6 angelos-core/lib/Angelos/Middleware.pm
@@ -1,19 +1,17 @@
package Angelos::Middleware;
-use Mouse;
+use Angelos::Class;
use Angelos::Exceptions;
with 'Angelos::Class::Loggable';
-no Mouse;
sub wrap {
my ( $self, $next ) = @_;
Angelos::Exception::AbstractMethod->throw(
message => 'Sub class must implement wrap method');
}
-__PACKAGE__->meta->make_immutable;
+__END_OF_CLASS__
-1;
__END__
=head1 NAME
View
6 angelos-core/lib/Angelos/Middleware/DebugRequest.pm
@@ -1,5 +1,5 @@
package Angelos::Middleware::DebugRequest;
-use Mouse;
+use Angelos::Class;
use Text::SimpleTable;
extends 'Angelos::Middleware';
@@ -67,6 +67,4 @@ sub report_matching_info {
$self->log( level => 'info', message => $message );
}
-__PACKAGE__->meta->make_immutable;
-
-1;
+__END_OF_CLASS__
View
7 angelos-core/lib/Angelos/Middleware/Profile.pm
@@ -1,10 +1,8 @@
package Angelos::Middleware::Profile;
-use Mouse;
+use Angelos::Class;
use Time::HiRes qw(time);
extends 'Angelos::Middleware';
-no Mouse;
-
sub wrap {
my ( $self, $next ) = @_;
@@ -26,9 +24,8 @@ sub profile {
$result;
}
-__PACKAGE__->meta->make_immutable;
+__END_OF_CLASS__
-1;
__END__
=head1 NAME
View
5 angelos-core/lib/Angelos/Middleware/Unicode.pm
@@ -1,5 +1,5 @@
package Angelos::Middleware::Unicode;
-use Mouse;
+use Angelos::Class;
use utf8;
no Mouse;
@@ -33,9 +33,8 @@ sub decode_params {
}
}
-__PACKAGE__->meta->make_immutable;
+__END_OF_CLASS__
-1;
__END__
=head1 NAME
View
8 angelos-core/lib/Angelos/Model/JobQueue/Gearman.pm
@@ -1,9 +1,5 @@
package Angelos::Model::JobQueue::Gearman;
-use Mouse;
+use Angelos::Class;
extends 'Angelos::JobQueue::Gearman::Client';
-no Mouse;
-
-__PACKAGE__->meta->make_immutable;
-
-1;
+__END_OF_CLASS__
View
4 angelos-core/lib/Angelos/Script/Command.pm
@@ -1,5 +1,5 @@
package Angelos::Script::Command;
-use Mouse;
+use Angelos::Class;
use IPC::System::Simple;
use base 'App::Cmd::Command';
@@ -16,4 +16,4 @@ sub capture {
IPC::System::Simple::capturex(@args);
}
-1;
+__END_OF_CLASS__
View
8 angelos-core/lib/Angelos/Script/Command/Console.pm
@@ -1,5 +1,5 @@
package Angelos::Script::Command::Console;
-use Mouse;
+use Angelos::Class;
use Angelos::Console;
use base qw(Angelos::Script::Command);
@@ -42,9 +42,9 @@ sub run {
$self->console->run;
}
-no Mouse;
-__PACKAGE__->meta->make_immutable;
-1;
+__END_OF_CLASS__
+
+__END__
=head1 AUTHOR
View
8 angelos-core/lib/Angelos/Script/Server.pm
@@ -1,5 +1,5 @@
package Angelos::Script::Server;
-use Mouse;
+use Angelos::Class;
use Pod::Usage;
use UNIVERSAL::require;
use Angelos::Home;
@@ -49,8 +49,6 @@ has 'help' => (
default => 0
);
-no Mouse;
-
sub run {
my $self = shift;
if ( $self->help ) {
@@ -69,9 +67,7 @@ sub run {
$app->run;
}
-__PACKAGE__->meta->make_immutable;
-
-1;
+__END_OF_CLASS__
__END__
View
8 angelos-core/lib/Angelos/View.pm
@@ -1,5 +1,5 @@
package Angelos::View;
-use Mouse;
+use Angelos::Class;
use Angelos::Home;
use Angelos::MIMETypes;
use Path::Class qw(file dir);
@@ -43,8 +43,6 @@ sub BUILD {
$self->engine($template_engine) if $template_engine;
}
-no Mouse;
-
sub SETUP { }
sub render {
@@ -155,9 +153,7 @@ sub _content_type {
$self->types->mime_type_of($format);
}
-__PACKAGE__->meta->make_immutable;
-
-1;
+__END_OF_CLASS__
__END__
View
7 angelos-core/lib/Angelos/View/TT.pm
@@ -1,5 +1,5 @@
package Angelos::View::TT;
-use Mouse;
+use Angelos::Class;
use Template;
use Angelos::Home;
use Path::Class;
@@ -34,8 +34,6 @@ has 'TIMER' => (
isa => 'Str',
);
-no Mouse;
-
sub _build_engine {
my $self = shift;
my $include_path ||= $self->INCLUDE_PATH;
@@ -62,6 +60,5 @@ sub _render {
$out;
}
-__PACKAGE__->meta->make_immutable;
+__END_OF_CLASS__
-1;

0 comments on commit 657880f

Please sign in to comment.