Mongoose/File.pm

filter: Statementstmt 60.0% 9 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 1 / 4 Podpod 100% 2 / 2 totaltotal 57.1% 12 / 21 CC 1 SCAR 5.6
CC
1
Cov
60%
__ANON__
2.0
slurp
2.0
delete
2.0
CRAP 1.8
« Mongoose/Role/Naming.pm ↑ Summary Mongoose/Meta/AttributeTraits.pm »
1 package Mongoose::File;
2 1 $Mongoose::File::VERSION = '2.02';
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 has file_id => ( is => 'ro', isa => 'BSON::OID', required => 1 );
6 1 has bucket => ( is => 'ro', isa => 'MongoDB::GridFSBucket', required => 1 );
7  
8 has stream_download =>
9 is => 'ro',
10 isa => 'MongoDB::GridFSBucket::DownloadStream',
11 lazy => 1,
12 0 ▶ default => sub { $_[0]->bucket->open_download_stream($_[0]->file_id) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
13 1 handles => [qw/ fh readline read eof fileno getc /];
14  
15 0 ▶sub slurp { local $/; shift->readline; }
Subroutine slurp: not called CC=1 SCAR=6.9
Pod documented
16  
17 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
18 0 my $self = shift;
19 0 $self->bucket->delete($self->file_id);
20 0 $self->file_id;
21 }
22  
23 1 *drop = \&delete;
24  
25 =head1 NAME
26  
27 Mongoose::File - container for MongoDB::GridFSBucket files
28  
29 =head1 DESCRIPTION
30  
31 This module is automatically used when your class
32 has C<FileHandle> type attributes.
33  
34 It wraps L<MongoDB::GridFSBucket::DownloadStream> and adds a
35 few convenience methods to it.
36  
37 =head1 METHODS
38  
39 =head2 delete
40  
41 Deletes the GridFS file entry.
42  
43 =head2 drop
44  
45 Same as delete
46  
47 =cut
48  
49 =head2 slurp
50  
51 Retrieve the full content of the file at once.
52  
53 =cut
54  
55 1 __PACKAGE__->meta->make_immutable();
« Mongoose/Role/Naming.pm ↑ Summary Mongoose/Meta/AttributeTraits.pm »