Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Docs for ModulesPerl6::Model::BuildStats
  • Loading branch information
zoffixznet committed Nov 14, 2015
1 parent 18a278b commit 4acbf93
Showing 1 changed file with 97 additions and 1 deletion.
98 changes: 97 additions & 1 deletion mojo-app/lib/ModulesPerl6/Model/BuildStats.pm
Expand Up @@ -53,4 +53,100 @@ sub stats {
return \%res;
}

1;
1;

__END__

=encoding utf8
=head1 NAME
ModulesPerl6::Model::BuildStats - model representing database build statistics
=head1 SYNOPSIS
my $m = ModulesPerl6::Model::BuildStats->new( db_file => 'mydb.db' );
$m->deploy;
$m->update(
dists_num => scalar(keys %{ $self->projects }),
last_updated => time(),
);
$m->update( last_updated => undef ); # remove `last_updated` stat
say $m->stats(qw/foo bar baz/)->{foo};
=head1 DESCRIPTION
This module is used to access and manipulate the build statistics gathered
during the dabase build process by the build script.
=head2 C<db_file>
say "Using database file: " . $m->db_file
Contains database filename (see L</new>).
=head1 METHODS
=head2 C<new>
my $m = ModulesPerl6::Model::BuildStats->new;
my $m = ModulesPerl6::Model::BuildStats->new( db_file => 'mydb.db' );
Creates and returns a new C<ModulesPerl6::Model::BuildStats> object. Takes
these arguments:
=head3 C<db_file>
my $m = ModulesPerl6::Model::BuildStats->new( db_file => 'mydb.db' );
B<Optional>. Specifies the filename of the SQLite database with dist info.
B<Defaults to:> the value of C<MODULESPERL6_DB_FILE> environmental variable,
if set, or C<modulesperl6.db>.
=head2 C<deploy>
$m->deploy
B<Takes> no arguments. B<Returns> its invocant. Deploys (creates) the SQL
tables needed for this module to operate. B<Will die> if they already exists.
=head2 C<update>
$m->update(
dists_num => scalar(keys %{ $self->projects }),
last_updated => time(),
);
$m->update( last_updated => undef ); # remove `last_updated` stat
Updates or deletes stats.
B<Takes> key/value pairs of stat names and their values. If a value is
C<undef>, that stat is deleted from the database. B<Returns> its invocant.
=head2 C<stats>
say $m->stats(qw/foo bar baz/)->{foo};
B<Takes> a list of stats to retrieve. B<Returns> a hashref where keys are
the names of stats and values are the values of the stats.
=head1 PRIVATE ATTRIBUTES
B<These attributes are documented for developers working on this module.
Do NOT use these attributes outside of this package.>
=head2 C<_db>
Contains C<ModulesPerl6::Model::BuildStats::Schema> L<DBIx::Class::Schema>
object.
=head1 CONTACT INFORMATION
Original version of this module was written by Zoffix Znet
(L<https://github.com/zoffixznet/>, C<Zoffix> on irc.freenode.net).
=head1 LICENSE
You can use and distribute this module under the same terms as Perl itself.

0 comments on commit 4acbf93

Please sign in to comment.