@@ -11,6 +11,7 @@ use Plack::MIME;
1111use List::MoreUtils qw( uniq) ;
1212use MetaCPAN::Pod::Lines;
1313use MetaCPAN::Types qw( :all) ;
14+ use MooseX::Types::Moose qw( ArrayRef) ;
1415
1516Plack::MIME-> add_type( " .t" => " text/x-script.perl" );
1617Plack::MIME-> add_type( " .pod" => " text/x-script.perl" );
@@ -19,10 +20,10 @@ Plack::MIME->add_type( ".xs" => "text/x-c" );
1920has id => ( id => [qw( author release path) ] );
2021
2122has [qw( path author name distribution) ] => ();
22- has module => ( required => 0, is => ' rw ' );
23+ has module => ( required => 0, is => ' ro ' , isa => Module, coerce => 1 );
2324has documentation => ( required => 0, is => ' rw' );
2425has release => ( parent => 1 );
25- has url => ( lazy_build => 1, index => ' no ' );
26+ has date => ( isa => ' DateTime ' );
2627has stat => ( isa => Stat, required => 0 );
2728has sloc => ( isa => ' Int' , lazy_build => 1 );
2829has slop => ( isa => ' Int' , is => ' rw' , default => 0 );
@@ -49,6 +50,7 @@ sub is_perl_file {
4950sub _build_indexed {
5051 my $self = shift ;
5152 return 1 unless (my $pkg = $self -> module);
53+ $pkg = $pkg -> [0]-> {name } || return 0;;
5254 my $content = ${$self -> content};
5355 return $content =~ / # match a package declaration
5456 ^[\h\{ ;]* # intro chars on a line
@@ -116,14 +118,6 @@ sub _build_path {
116118 return join ( ' /' , $self -> release-> name, $self -> name );
117119}
118120
119- sub _build_path_uri {
120- URI::Escape::uri_escape( URI::Escape::uri_escape( shift -> path ) );
121- }
122-
123- sub _build_url {
124- ' http://search.metacpan.org/source/' . shift -> path;
125- }
126-
127121sub _build_pod_lines {
128122 my $self = shift ;
129123 return [] unless ( $self -> is_perl_file );
0 commit comments