File Coverage

blib/lib/BackPAN/Index/Dist.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 1 2 50.0
total 32 33 96.9


line stmt bran cond sub pod time code
1 13     13   3082247 use utf8;
  13         255  
  13         91  
2             package BackPAN::Index::Dist;
3              
4             # Created by DBIx::Class::Schema::Loader
5             # DO NOT MODIFY THE FIRST PART OF THIS FILE
6              
7 13     13   588 use strict;
  13         238  
  13         411  
8 13     13   124 use warnings;
  13         21  
  13         559  
9              
10 13     13   73 use base 'DBIx::Class::Core';
  13         27  
  13         12105  
11             __PACKAGE__->table("dists");
12             __PACKAGE__->add_columns(
13             "name",
14             { data_type => "text", is_nullable => 0 },
15             "first_release",
16             { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
17             "latest_release",
18             { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
19             "first_date",
20             { data_type => "integer", is_nullable => 0 },
21             "latest_date",
22             { data_type => "integer", is_nullable => 0 },
23             "first_author",
24             { data_type => "text", is_nullable => 0 },
25             "latest_author",
26             { data_type => "text", is_nullable => 0 },
27             "num_releases",
28             { data_type => "integer", is_nullable => 0 },
29             );
30             __PACKAGE__->set_primary_key("name");
31             __PACKAGE__->belongs_to(
32             "first_release",
33             "BackPAN::Index::Release",
34             { path => "first_release" },
35             { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
36             );
37             __PACKAGE__->belongs_to(
38             "latest_release",
39             "BackPAN::Index::Release",
40             { path => "latest_release" },
41             { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
42             );
43             __PACKAGE__->has_many(
44             "releases",
45             "BackPAN::Index::Release",
46             { "foreign.dist" => "self.name" },
47             { cascade_copy => 0, cascade_delete => 0 },
48             );
49              
50              
51             # Created by DBIx::Class::Schema::Loader v0.07033 @ 2012-12-27 01:39:08
52             # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BuglboqFzRDZo6vlK4n0yw
53              
54 13     13   1657959 use Mouse;
  13         502038  
  13         88  
55             with 'BackPAN::Index::Role::AsHash';
56              
57             use overload
58 7     7   952978 q[""] => sub { $_[0]->name },
59 13     13   4920 fallback => 1;
  13         32  
  13         167  
60              
61             sub data_methods {
62 1     1 0 7 return qw(
63             name num_releases
64             first_release first_date first_author
65             latest_release latest_date latest_author
66             );
67             }
68              
69             sub authors {
70 1     1 1 3706 my $self = shift;
71              
72 1         9 return $self->releases->search(undef, { distinct => 1 })->get_column("cpanid")->all;
73             }
74              
75             1;
76              
77             __END__