[Bps-public-commit] r19845 - in Net-Google-Code/trunk: . lib/Net/Google lib/Net/Google/Code lib/Net/Google/Code/Issue lib/Net/Google/Code/Wiki

jesse at bestpractical.com jesse at bestpractical.com
Tue Jun 2 21:24:28 EDT 2009


Author: jesse
Date: Tue Jun  2 21:24:27 2009
New Revision: 19845

Added:
   Net-Google-Code/trunk/lib/Net/Google/Code/DateTime.pm
Removed:
   Net-Google-Code/trunk/lib/Net/Google/Code/Role/DateTime.pm
Modified:
   Net-Google-Code/trunk/META.yml
   Net-Google-Code/trunk/Makefile.PL
   Net-Google-Code/trunk/lib/Net/Google/Code.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Download.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Attachment.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Comment.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue/PropChange.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Role/Authentication.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Role/Fetchable.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Role/HTMLTree.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Role/Pageable.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Role/Predefined.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Role/URL.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/TypicalRoles.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Wiki/Comment.pm

Log:
Switch from Moose to Any::Moose; Convert DateTime from a role into a class

Modified: Net-Google-Code/trunk/META.yml
==============================================================================
--- Net-Google-Code/trunk/META.yml	(original)
+++ Net-Google-Code/trunk/META.yml	Tue Jun  2 21:24:27 2009
@@ -22,7 +22,7 @@
   File::MMagic: 0
   HTML::TreeBuilder: 0
   MIME::Types: 0
-  Moose: 0
+  Any::Moose: 0
   Params::Validate: 0
   WWW::Mechanize: 0
 resources:

Modified: Net-Google-Code/trunk/Makefile.PL
==============================================================================
--- Net-Google-Code/trunk/Makefile.PL	(original)
+++ Net-Google-Code/trunk/Makefile.PL	Tue Jun  2 21:24:27 2009
@@ -8,7 +8,7 @@
 test_requires 'Test::More';
 test_requires 'Test::MockModule';
 test_requires 'File::Slurp';
-requires 'Moose';
+requires 'Any::Moose';
 requires 'WWW::Mechanize';
 requires 'HTML::TreeBuilder';
 requires 'Params::Validate';

Modified: Net-Google-Code/trunk/lib/Net/Google/Code.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code.pm	Tue Jun  2 21:24:27 2009
@@ -1,6 +1,6 @@
 package Net::Google::Code;
 
-use Moose;
+use Any::Moose;
 with 'Net::Google::Code::TypicalRoles';
 use Scalar::Util qw/blessed/;
 
@@ -172,7 +172,7 @@
     $self->wikis( \@wikis );
 }
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 
 1;
@@ -279,7 +279,7 @@
 
 =head1 DEPENDENCIES
 
-L<Moose>, L<HTML::TreeBuilder>, L<WWW::Mechanize>, L<Params::Validate>
+L<Any::Moose>, L<HTML::TreeBuilder>, L<WWW::Mechanize>, L<Params::Validate>
 
 =head1 INCOMPATIBILITIES
 

Added: Net-Google-Code/trunk/lib/Net/Google/Code/DateTime.pm
==============================================================================
--- (empty file)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/DateTime.pm	Tue Jun  2 21:24:27 2009
@@ -0,0 +1,70 @@
+package Net::Google::Code::DateTime;
+use Any::Moose;
+extends 'DateTime';
+
+our %MONMAP = (
+    Jan => 1,
+    Feb => 2,
+    Mar => 3,
+    Apr => 4,
+    May => 5,
+    Jun => 6,
+    Jul => 7,
+    Aug => 8,
+    Sep => 9,
+    Oct => 10,
+    Nov => 11,
+    Dec => 12,
+);
+
+sub new_from_string {
+    my $class     = shift;
+    my $base_date = shift;
+    if (
+        $base_date =~ /\w{3}\s+(\w+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d)\s+(\d{4})/ )
+    {
+        my $mon = $1;
+        my $dom = $2;
+        my $h   = $3;
+        my $m   = $4;
+        my $s   = $5;
+        my $y   = $6;
+        return   $class->new(
+            year   => $y,
+            month  => $MONMAP{$mon},
+            day    => $dom,
+            hour   => $h,
+            minute => $m,
+            second => $s
+        );
+    }
+}
+
+no Any::Moose;
+
+1;
+
+__END__
+
+=head1 NAME
+
+Net::Google::Code::DateTime - DateTime with a parsing method for gcode
+
+=head1 DESCRIPTION
+
+=head1 INTERFACE
+
+=head2 new_from_string
+
+=head1 AUTHOR
+
+sunnavy  C<< <sunnavy at bestpractical.com> >>
+
+=head1 LICENCE AND COPYRIGHT
+
+Copyright 2008-2009 Best Practical Solutions.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Download.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Download.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Download.pm	Tue Jun  2 21:24:27 2009
@@ -1,6 +1,6 @@
 package Net::Google::Code::Download;
 
-use Moose;
+use Any::Moose;
 use Params::Validate qw(:all);
 use Scalar::Util qw/blessed/;
 
@@ -141,7 +141,7 @@
     return $class->SUPER::BUILDARGS(%args);
 }
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 
 1;

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm	Tue Jun  2 21:24:27 2009
@@ -1,7 +1,8 @@
 package Net::Google::Code::Issue;
-use Moose;
+use Any::Moose;
 use Params::Validate qw(:all);
 with 'Net::Google::Code::TypicalRoles';
+use Net::Google::Code::DateTime;
 use Net::Google::Code::Issue::Comment;
 use Net::Google::Code::Issue::Attachment;
 use Scalar::Util qw/blessed/;
@@ -103,7 +104,7 @@
     my $description = $tree->look_down( class => 'vt issuedescription' );
     my $author_tag = $description->look_down( class => "author" );
     $self->reporter( $author_tag->content_array_ref->[1]->as_text );
-    $self->reported( $self->parse_datetime($author_tag->look_down( class => 'date' )->attr('title') ));
+    $self->reported( Net::Google::Code::DateTime->new_from_string($author_tag->look_down( class => 'date' )->attr('title') ));
 
 
     my $text = $description->find_by_tag_name('pre')->as_text;
@@ -345,7 +346,7 @@
     }
 }
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 
 1;

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Attachment.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Attachment.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Attachment.pm	Tue Jun  2 21:24:27 2009
@@ -1,5 +1,5 @@
 package Net::Google::Code::Issue::Attachment;
-use Moose;
+use Any::Moose;
 with 'Net::Google::Code::Role::Fetchable', 'Net::Google::Code::Role::HTMLTree';
 use Scalar::Util qw/blessed/;
 use MIME::Types;
@@ -92,7 +92,7 @@
     $self->content_type( $content_type || 'application/octet-stream' );
 }
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 
 1;

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Comment.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Comment.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Comment.pm	Tue Jun  2 21:24:27 2009
@@ -1,7 +1,8 @@
 package Net::Google::Code::Issue::Comment;
-use Moose;
+use Any::Moose;
 use Net::Google::Code::Issue::Attachment;
-with 'Net::Google::Code::Role::HTMLTree', 'Net::Google::Code::Role::DateTime';
+use Net::Google::Code::DateTime;
+with 'Net::Google::Code::Role::HTMLTree';
 
 has 'updates' => ( isa => 'HashRef', is => 'rw', default => sub { {} } );
 has 'author'  => ( isa => 'Str',     is => 'rw' );
@@ -23,7 +24,7 @@
     my @a       = $author->find_by_tag_name('a');
     $self->sequence( $a[0]->content_array_ref->[0] );
     $self->author( $a[1]->content_array_ref->[0] );
-    $self->date($self->parse_datetime( $element->look_down( class => 'date' )->attr('title') ));
+    $self->date(Net::Google::Code::DateTime->new_from_string( $element->look_down( class => 'date' )->attr('title') ));
     my $content = $element->find_by_tag_name('pre')->as_text;
     $content =~ s/^\s+//;
     $content =~ s/\s+$/\n/;
@@ -77,7 +78,7 @@
     return 1;
 }
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 1;
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue/PropChange.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue/PropChange.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue/PropChange.pm	Tue Jun  2 21:24:27 2009
@@ -1,11 +1,11 @@
 package Net::Google::Code::Issue::PropChange;
-use Moose;
+use Any::Moose;
 
 has 'property'  => ( isa => 'Str', is => 'rw' );
 has 'old_value' => ( isa => 'Str', is => 'rw' );
 has 'new_value' => ( isa => 'Str', is => 'rw' );
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 1;
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm	Tue Jun  2 21:24:27 2009
@@ -1,10 +1,11 @@
 package Net::Google::Code::Issue::Search;
-use Moose;
+use Any::Moose;
 use Params::Validate qw(:all);
-use Moose::Util::TypeConstraints;
-with 'Net::Google::Code::Role::URL',
-  'Net::Google::Code::Role::Fetchable', 'Net::Google::Code::Role::Pageable',
-  'Net::Google::Code::Role::HTMLTree';
+use Any::Moose 'Util::TypeConstraints';
+with 'Net::Google::Code::Role::URL';
+with 'Net::Google::Code::Role::Fetchable';
+with 'Net::Google::Code::Role::Pageable';
+with  'Net::Google::Code::Role::HTMLTree';
 use Net::Google::Code::Issue;
 use Encode;
 
@@ -118,7 +119,7 @@
     }
 }
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 1;
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Role/Authentication.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Role/Authentication.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Role/Authentication.pm	Tue Jun  2 21:24:27 2009
@@ -1,5 +1,5 @@
 package Net::Google::Code::Role::Authentication;
-use Moose::Role;
+use Any::Moose 'Role';
 
 with 'Net::Google::Code::Role::Fetchable';
 
@@ -67,7 +67,7 @@
     return $signed_in;
 }
 
-no Moose::Role;
+no Any::Moose;
 
 1;
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Role/Fetchable.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Role/Fetchable.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Role/Fetchable.pm	Tue Jun  2 21:24:27 2009
@@ -1,5 +1,5 @@
 package Net::Google::Code::Role::Fetchable;
-use Moose::Role;
+use Any::Moose 'Role';
 use Params::Validate ':all';
 use WWW::Mechanize;
 use Encode;
@@ -37,7 +37,7 @@
     }
 }
 
-no Moose::Role;
+no Any::Moose;
 
 1;
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Role/HTMLTree.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Role/HTMLTree.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Role/HTMLTree.pm	Tue Jun  2 21:24:27 2009
@@ -1,5 +1,5 @@
 package Net::Google::Code::Role::HTMLTree;
-use Moose::Role;
+use Any::Moose 'Role';
 
 use HTML::TreeBuilder;
 use Params::Validate qw(:all);
@@ -57,7 +57,7 @@
     return;
 }
 
-no Moose::Role;
+no Any::Moose;
 
 1;
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Role/Pageable.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Role/Pageable.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Role/Pageable.pm	Tue Jun  2 21:24:27 2009
@@ -1,10 +1,10 @@
 package Net::Google::Code::Role::Pageable;
-use Moose::Role;
+use Any::Moose 'Role';
 use Params::Validate ':all';
 use WWW::Mechanize;
-with 'Net::Google::Code::Role::Fetchable', 'Net::Google::Code::Role::HTMLTree';
+with 'Net::Google::Code::Role::Fetchable';
+with 'Net::Google::Code::Role::HTMLTree';
 use Scalar::Util qw/blessed/;
-no Moose::Role;
 
 sub rows {
     my $self = shift;
@@ -146,6 +146,7 @@
     return @rows;
 }
 
+no Any::Moose;
 1;
 
 __END__

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Role/Predefined.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Role/Predefined.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Role/Predefined.pm	Tue Jun  2 21:24:27 2009
@@ -1,5 +1,5 @@
 package Net::Google::Code::Role::Predefined;
-use Moose::Role;
+use Any::Moose 'Role';
 use Params::Validate ':all';
 use JSON;
 with 'Net::Google::Code::Role::Fetchable';
@@ -14,7 +14,7 @@
     is  => 'rw',
 );
 
-no Moose::Role;
+no Any::Moose;
 
 sub load_predefined {
     my $self = shift;

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Role/URL.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Role/URL.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Role/URL.pm	Tue Jun  2 21:24:27 2009
@@ -1,5 +1,5 @@
 package Net::Google::Code::Role::URL;
-use Moose::Role;
+use Any::Moose 'Role';
 
 # requires don't support attribute yet :/
 # requires 'project'; 
@@ -27,7 +27,7 @@
     },
 );
 
-no Moose::Role;
+no Any::Moose;
 
 1;
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/TypicalRoles.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/TypicalRoles.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/TypicalRoles.pm	Tue Jun  2 21:24:27 2009
@@ -1,5 +1,5 @@
 package Net::Google::Code::TypicalRoles;
-use Moose::Role;
+use Any::Moose 'Role';
 
 with 'Net::Google::Code::Role::Fetchable';
 with 'Net::Google::Code::Role::URL';
@@ -9,7 +9,7 @@
 with 'Net::Google::Code::Role::Pageable';
 with 'Net::Google::Code::Role::Predefined';
 
-no Moose::Role;
+no Any::Moose;
 
 1;
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm	Tue Jun  2 21:24:27 2009
@@ -1,6 +1,6 @@
 package Net::Google::Code::Wiki;
 
-use Moose;
+use Any::Moose;
 use Params::Validate qw(:all);
 with 'Net::Google::Code::TypicalRoles';
 
@@ -114,7 +114,7 @@
     $self->comments( \@comments );
 }
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 
 1;

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Wiki/Comment.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Wiki/Comment.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Wiki/Comment.pm	Tue Jun  2 21:24:27 2009
@@ -1,6 +1,6 @@
 package Net::Google::Code::Wiki::Comment;
 
-use Moose;
+use Any::Moose;
 use Params::Validate qw(:all);
 with 'Net::Google::Code::Role::HTMLTree';
 
@@ -38,7 +38,7 @@
 }
 
 
-no Moose;
+no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 
 1;



More information about the Bps-public-commit mailing list