Permalink
Browse files

use MX::AH

  • Loading branch information...
1 parent 2508641 commit 5e89398aa397e7c13213a74ec4e93dd4585c50a0 @dann committed Mar 11, 2009
Showing with 12 additions and 15 deletions.
  1. +2 −1 angelos-core/Makefile.PL
  2. +9 −13 angelos-core/lib/Angelos/MIMETypes.pm
  3. +1 −1 angelos-core/lib/Angelos/Test/Base.pm
@@ -32,7 +32,8 @@ requires(
# Basics
'Class::Method::Modifiers' => 0,
'Class::Method::Modifiers::Fast' => 0,
- 'Mouse' => '0.18',
+ 'Mouse' => '0.19',
+ 'MouseX::AttributeHelpers' => '0.01',
'MouseX::Types' => '0.01',
'HTTP::Engine' => '0.1.4',
'HTTP::Engine::Middleware' => '0.09',
@@ -1,10 +1,12 @@
package Angelos::MIMETypes;
use Angelos::Class;
+use MouseX::AttributeHelpers;
has 'types' => (
- is => 'rw',
- isa => 'HashRef',
- default => sub {
+ metaclass => 'Collection::Hash',
+ is => 'rw',
+ isa => 'HashRef',
+ default => sub {
{ css => 'text/css',
gif => 'image/gif',
jpeg => 'image/jpeg',
@@ -18,18 +20,12 @@ has 'types' => (
rss => 'application/xml',
atom => 'application/xml',
};
+ },
+ provides => {
+ 'set' => 'add_type',
+ 'get' => 'mime_type_of',
}
);
-sub mime_type_of {
- my ( $self, $ext ) = @_;
- $self->types->{$ext};
-}
-
-sub add_type {
- my ( $self, $ext, $mime_type ) = @_;
- $self->types->{$ext} = $mime_type;
-}
-
__END_OF_CLASS__
@@ -18,7 +18,7 @@ sub run_tests {
sub make_application {
my $application_class = main::test_application_class();
- $application_class->require;
+ $application_class->require or die "Can't load $application_class";
my $app = $application_class->new( server => 'Test', );
$app;
}

0 comments on commit 5e89398

Please sign in to comment.