File Coverage

blib/lib/Git/Database/Role/ObjectWriter.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Git::Database::Role::ObjectWriter;
2             $Git::Database::Role::ObjectWriter::VERSION = '0.012';
3 7     7   4188 use Moo::Role;
  7         26  
  7         58  
4              
5             requires
6             'put_object',
7             ;
8              
9             1;
10              
11             __END__
12              
13             =pod
14              
15             =head1 NAME
16              
17             Git::Database::Role::ObjectWriter - Abstract role for Git backends that write objects
18              
19             =head1 VERSION
20              
21             version 0.012
22              
23             =head1 SYNOPSIS
24              
25             package MyGitBackend;
26              
27             use Moo;
28             use namespace::clean;
29              
30             with
31             'Git::Database::Role::Backend',
32             'Git::Database::Role::ObjectWriter';
33              
34             # implement the required methods
35             sub put_object { ... }
36              
37             =head1 DESCRIPTION
38              
39             A L<backend|Git::Database::Role::Backend> doing the additional
40             Git::Database::Role::ObjectWriter role is capable of writing the
41             data from L<objects|Git::Database::Role::Object> to the attached Git
42             repository.
43              
44             =head1 REQUIRED METHODS
45              
46             =head2 put_object
47              
48             # a Git::Database::Object::Tree representing the empty tree
49             my $tree = Git::Database::Object::Tree->new( content => '' );
50              
51             my $digest = $backend->put_object( $tree );
52              
53             Given an L<object|Git::Database::Role::Object>, C<put_object> will write
54             the data for the object in the underlying repository database, and
55             return the digest for the object.
56              
57             =head1 AUTHOR
58              
59             Philippe Bruhat (BooK) <book@cpan.org>.
60              
61             =head1 COPYRIGHT
62              
63             Copyright 2016 Philippe Bruhat (BooK), all rights reserved.
64              
65             =head1 LICENSE
66              
67             This program is free software; you can redistribute it and/or modify it
68             under the same terms as Perl itself.
69              
70             =cut