From: Vincent Pit Date: Mon, 22 Feb 2010 23:54:54 +0000 (+0100) Subject: Don't depend on Object::Tiny anymore X-Git-Tag: v0.07~28 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Frgit.git;a=commitdiff_plain;h=76ba389e3711e8f254aea83f9b3b7b221c0517a8 Don't depend on Object::Tiny anymore --- diff --git a/Makefile.PL b/Makefile.PL index bbe18c2..86acf98 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -14,7 +14,6 @@ my %PREREQ_PM = ( 'Exporter' => 0, 'File::Find' => 0, 'File::Spec::Functions' => 0, - 'Object::Tiny' => 0, 'POSIX' => 0, 'base' => 0, ); diff --git a/bin/rgit b/bin/rgit index 3b908b4..6e5c3d2 100755 --- a/bin/rgit +++ b/bin/rgit @@ -191,8 +191,6 @@ Add a remote to all repositories in "/foo/bar" to their bare counterpart in C, L, L, L, L, L and L. -L. - =head1 AUTHOR Vincent Pit, C<< >>, L. diff --git a/lib/App/Rgit.pm b/lib/App/Rgit.pm index 1291726..a91f37e 100644 --- a/lib/App/Rgit.pm +++ b/lib/App/Rgit.pm @@ -3,8 +3,6 @@ package App::Rgit; use strict; use warnings; -use Object::Tiny qw/config command/; - use App::Rgit::Command; use App::Rgit::Config; use App::Rgit::Utils qw/validate/; @@ -49,10 +47,10 @@ sub new { policy => $args{policy}, ); return unless defined $command; - $class->SUPER::new( + bless { config => $config, command => $command, - ); + }, $class; } =head2 C @@ -70,7 +68,13 @@ sub run { =head2 C -Accessors. +Read-only accessors. + +=cut + +BEGIN { + eval "sub $_ { \$_[0]->{$_} }" for qw/config command/; +} =head1 SEE ALSO diff --git a/lib/App/Rgit/Command.pm b/lib/App/Rgit/Command.pm index 645d5c3..c43cc6c 100644 --- a/lib/App/Rgit/Command.pm +++ b/lib/App/Rgit/Command.pm @@ -5,8 +5,6 @@ use warnings; use Carp qw/croak/; -use Object::Tiny qw/cmd args policy/; - use App::Rgit::Utils qw/validate :codes/; =head1 NAME @@ -50,11 +48,11 @@ sub new { unless $class->isa($action); } eval "require $action; 1" or croak "Couldn't load $action: $@"; - $class->SUPER::new( + bless { cmd => $cmd, args => $args{args} || [ ], policy => $args{policy}, - ); + }, $class; } =head2 C<< action $cmd [ => $pkg ] >> @@ -99,7 +97,13 @@ sub report { =head2 C -Accessors. +Read-only accessors. + +=cut + +BEGIN { + eval "sub $_ { \$_[0]->{$_} }" for qw/cmd args policy/; +} =head2 C diff --git a/lib/App/Rgit/Config.pm b/lib/App/Rgit/Config.pm index 3991ade..1e822b4 100644 --- a/lib/App/Rgit/Config.pm +++ b/lib/App/Rgit/Config.pm @@ -7,8 +7,6 @@ use Carp qw/croak/; use Cwd qw/abs_path/; use File::Spec::Functions qw/file_name_is_absolute/; -use Object::Tiny qw/root git cwd_repo debug/; - use App::Rgit::Repository; use App::Rgit::Utils qw/validate :levels/; @@ -64,12 +62,12 @@ sub new { my $r = App::Rgit::Repository->new(fake => 1); return unless defined $r; - $conf->SUPER::new( + bless { root => $root, git => $git, cwd_repo => $r, debug => defined $args{debug} ? int $args{debug} : WARN, - ); + }, $conf; } =head2 C @@ -112,7 +110,13 @@ sub crit { shift->_notify(CRIT, @_) } =head2 C -Accessors. +Read-only accessors. + +=cut + +BEGIN { + eval "sub $_ { \$_[0]->{$_} }" for qw/root git cwd_repo debug/; +} =head1 SEE ALSO diff --git a/lib/App/Rgit/Repository.pm b/lib/App/Rgit/Repository.pm index 94e9dde..5476ad4 100644 --- a/lib/App/Rgit/Repository.pm +++ b/lib/App/Rgit/Repository.pm @@ -14,8 +14,6 @@ BEGIN { *WIFSIGNALED = sub { shift() & 127 } unless eval { WIFSIGNALED(0); 1 }; } -use Object::Tiny qw/fake repo bare name work/; - use App::Rgit::Utils qw/validate/; =head1 NAME @@ -79,13 +77,13 @@ sub new { $work = $repo; } } - $class->SUPER::new( + bless { fake => !!$args{fake}, repo => $repo, bare => $bare, name => $name, work => $work, - ); + }, $class; } =head2 C @@ -180,7 +178,13 @@ sub run { =head2 C -Accessors. +Read-only accessors. + +=cut + +BEGIN { + eval "sub $_ { \$_[0]->{$_} }" for qw/fake repo bare name work/; +} =head1 SEE ALSO