[Moose-commits] r7949 - in MooseX-IOC/trunk: . lib/MooseX
lib/MooseX/IOC/Meta t
stevan at code2.0beta.co.uk
stevan at code2.0beta.co.uk
Mon Jun 29 19:56:27 GMT 2009
Author: stevan
Date: 2009-06-29 12:56:27 -0700 (Mon, 29 Jun 2009)
New Revision: 7949
Removed:
MooseX-IOC/trunk/t/pod_coverage.t
Modified:
MooseX-IOC/trunk/Changes
MooseX-IOC/trunk/MANIFEST
MooseX-IOC/trunk/README
MooseX-IOC/trunk/lib/MooseX/IOC.pm
MooseX-IOC/trunk/lib/MooseX/IOC/Meta/Attribute.pm
Log:
fixing some warnings in moden moose
Modified: MooseX-IOC/trunk/Changes
===================================================================
--- MooseX-IOC/trunk/Changes 2009-06-15 14:56:54 UTC (rev 7948)
+++ MooseX-IOC/trunk/Changes 2009-06-29 19:56:27 UTC (rev 7949)
@@ -1,10 +1,14 @@
Revision history for Perl extension MooseX-IOC
+0.03 Monday, Jun 29, 2009
+ - fixing a warning from newer Mooses
+ - removed pod-coverage.t
+
0.02 Monday, July 9, 2007
- - now allows the use of a 'default' as well
+ - now allows the use of a 'default' as well
as a 'service' option (thanks nuffin)
- added tests for this
0.01 Wed, May 9th 2007
- - scratching an itch, making IOC easier to
+ - scratching an itch, making IOC easier to
use for Moose classes
\ No newline at end of file
Modified: MooseX-IOC/trunk/MANIFEST
===================================================================
--- MooseX-IOC/trunk/MANIFEST 2009-06-15 14:56:54 UTC (rev 7948)
+++ MooseX-IOC/trunk/MANIFEST 2009-06-29 19:56:27 UTC (rev 7949)
@@ -10,4 +10,3 @@
t/000_load.t
t/001_basic.t
t/pod.t
-t/pod_coverage.t
Modified: MooseX-IOC/trunk/README
===================================================================
--- MooseX-IOC/trunk/README 2009-06-15 14:56:54 UTC (rev 7948)
+++ MooseX-IOC/trunk/README 2009-06-29 19:56:27 UTC (rev 7949)
@@ -1,4 +1,4 @@
-MooseX::IOC version 0.02
+MooseX::IOC version 0.03
===========================
See the individual module documentation for more information
@@ -21,10 +21,10 @@
COPYRIGHT AND LICENCE
-Copyright (C) 2007 Infinity Interactive, Inc.
+Copyright (C) 2007-2009 Infinity Interactive, Inc.
http://www.iinteractive.com
This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+it under the same terms as Perl itself.
Modified: MooseX-IOC/trunk/lib/MooseX/IOC/Meta/Attribute.pm
===================================================================
--- MooseX-IOC/trunk/lib/MooseX/IOC/Meta/Attribute.pm 2009-06-15 14:56:54 UTC (rev 7948)
+++ MooseX-IOC/trunk/lib/MooseX/IOC/Meta/Attribute.pm 2009-06-29 19:56:27 UTC (rev 7949)
@@ -4,11 +4,11 @@
use IOC::Registry;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
extends 'Moose::Meta::Attribute';
-# this never changes, so we can
+# this never changes, so we can
# just store it once - SL
my $REGISTRY = IOC::Registry->new;
@@ -16,9 +16,9 @@
my $next = shift;
my ($self, $name, $options) = @_;
if (exists $options->{service}) {
-
+
my $service = $self->_process_service($options->{service});
-
+
if (exists $options->{default}) {
my $default = $options->{default};
$options->{default} = sub {
@@ -28,21 +28,23 @@
} else {
$options->{default} = sub { $self->_locate_ioc_service($service, @_) };
}
+
+ delete $options->{service};
}
$next->($self, $name, $options);
};
sub _locate_ioc_service {
my ( $self, $service, @args ) = @_;
- $REGISTRY->locateService(@{$service->(@args)})
+ $REGISTRY->locateService(@{$service->(@args)})
}
sub _process_service {
my ($self, $service) = @_;
- return $service
+ return $service
if ref $service eq 'CODE';
# otherwise ...
- $service = [ $service ] if ref $service ne 'ARRAY';
+ $service = [ $service ] if ref $service ne 'ARRAY';
return sub { $service };
}
@@ -62,7 +64,7 @@
=head1 DESCRIPTION
-No real user serviceable parts in here ... see L<MooseX::IOC> docs.
+No real user serviceable parts in here ... see L<MooseX::IOC> docs.
=head1 METHODS
@@ -76,7 +78,7 @@
=head1 BUGS
-All complex software has bugs lurking in it, and this module is no
+All complex software has bugs lurking in it, and this module is no
exception. If you find a bug please either email me, or add the bug
to cpan-RT.
@@ -86,7 +88,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright 2007 by Infinity Interactive, Inc.
+Copyright 2007-2009 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>
Modified: MooseX-IOC/trunk/lib/MooseX/IOC.pm
===================================================================
--- MooseX-IOC/trunk/lib/MooseX/IOC.pm 2009-06-15 14:56:54 UTC (rev 7948)
+++ MooseX-IOC/trunk/lib/MooseX/IOC.pm 2009-06-29 19:56:27 UTC (rev 7949)
@@ -4,7 +4,7 @@
use MooseX::IOC::Meta::Attribute;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
1;
@@ -14,51 +14,51 @@
=head1 NAME
-MooseX::IOC - Moose attributes with IOC integration
+MooseX::IOC - Moose attributes with IOC integration
=head1 SYNOPSIS
# in a startup script somewhere ...
-
+
use IOC;
use IOC::Service::Parameterized;
use IOC::Registry;
use MooseX::IOC;
-
+
{
my $container = IOC::Container->new('MyProject');
$container->register(IOC::Service::Literal->new('log_file' => "logfile.log"));
- $container->register(IOC::Service->new('FileLogger' => sub {
- my $c = shift;
+ $container->register(IOC::Service->new('FileLogger' => sub {
+ my $c = shift;
return FileLogger->new($c->get('log_file'));
- }));
-
+ }));
+
my $reg = IOC::Registry->new;
$reg->registerContainer($container);
}
-
+
# in a .pm file somewhere ...
-
+
package MyApplication;
use Moose;
-
+
has 'logger' => (
metaclass => 'IOC',
is => 'ro',
isa => 'FileLogger',
service => '/MyProject/FileLogger',
);
-
+
# in a script file somewhere ...
-
+
my $app = MyApplication->new;
$app->logger; # automatically gotten from IOC
=head1 DESCRIPTION
-This module provides a bridge between IOC registries and Moose objects through a
+This module provides a bridge between IOC registries and Moose objects through a
custom attribute metaclass. It compliments the C<default> option with a C<service>
-option which contains a L<IOC::Registry> path (and optional parameters).
+option which contains a L<IOC::Registry> path (and optional parameters).
The C<service> option can be in one of the following formats:
@@ -66,13 +66,13 @@
=item I<IOC::Registry path string>
-This is the simplest version available, it is simply a path string which
+This is the simplest version available, it is simply a path string which
can be passed to L<IOC::Registry>'s C<locateService> method.
=item I<IOC::Registry path string and parameters>
-This version is for use with L<IOC::Service::Parameterized> services, and
-allows you to pass additional parameters to the C<locateService> method.
+This version is for use with L<IOC::Service::Parameterized> services, and
+allows you to pass additional parameters to the C<locateService> method.
It looks like this:
has 'logger' => (
@@ -81,11 +81,11 @@
isa => 'FileLogger',
service => [ '/MyProject/FileLogger' => (log_file => 'foo.log') ],
);
-
+
=item I<CODE reference>
-The last version is the most flexible, it is CODE reference which is
-expected to return an ARRAY ref similar to the above version.
+The last version is the most flexible, it is CODE reference which is
+expected to return an ARRAY ref similar to the above version.
has 'logger' => (
metaclass => 'IOC',
@@ -102,8 +102,8 @@
=back
-If the C<service> is not found and a C<default> option has been set, then
-it will return the value in C<default>. This can be useful for writing
+If the C<service> is not found and a C<default> option has been set, then
+it will return the value in C<default>. This can be useful for writing
code which can potentially be run both under IOC and not under IOC.
=head1 METHODS
@@ -128,7 +128,7 @@
=head1 BUGS
-All complex software has bugs lurking in it, and this module is no
+All complex software has bugs lurking in it, and this module is no
exception. If you find a bug please either email me, or add the bug
to cpan-RT.
@@ -138,7 +138,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright 2007 by Infinity Interactive, Inc.
+Copyright 2007-2009 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>
Deleted: MooseX-IOC/trunk/t/pod_coverage.t
===================================================================
--- MooseX-IOC/trunk/t/pod_coverage.t 2009-06-15 14:56:54 UTC (rev 7948)
+++ MooseX-IOC/trunk/t/pod_coverage.t 2009-06-29 19:56:27 UTC (rev 7949)
@@ -1,11 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More;
-
-eval "use Test::Pod::Coverage 1.04";
-plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
-
-all_pod_coverage_ok();
More information about the Moose-commits
mailing list