blib/lib/IngyPrelude.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 87.8% 29 / 33 CC 3 SCAR 4.1
CC
3
Cov
92%
file_write
2.0
file_read
2.0
BEGIN
1.0
CRAP 1.5
↑ Summary
1 package IngyPrelude;
2  
3 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = '0.0.1';
10  
11 1 our @EXPORT = qw( file_read file_write );
12  
13 1 ▶sub file_read {
Subroutine file_read: called CC=2 SCAR=7.0
Pod undocumented
14 1 my ($path) = @_;
15 1 ▶ open my $fh, '<', $path or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $path or die $! 1 0 1
16 1 local $/;
17 1 return <$fh>;
18 }
19  
20 1 ▶sub file_write {
Subroutine file_write: called CC=2 SCAR=7.1
Pod undocumented
21 1 my ($path, $text) = @_;
22 1 ▶ open my $fh, '>', $path or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $path or die $! 1 0 1
23 1 print $fh $text;
24 }
25  
26 1 1;
27  
28 =encoding utf8
29  
30 =head1 NAME
31  
32 Ingy döt Net's Standard Prelude
33  
34 =head1 SYNOPSIS
35  
36 use IngyPrelude;
37  
38 my $text = file_read 'foo.txt';
39 file_write 'FOO.TXT', uc($text);
40  
41 =head1 DESCRIPTION
42  
43 This module exports a number of common functions.
44  
45 =head1 AUTHOR
46  
47 Ingy döt Net <ingy@ingy.net>
48  
49 =head1 COPYRIGHT AND LICENSE
50  
51 Copyright 2022. Ingy döt Net.
52  
53 This program is free software; you can redistribute it and/or modify it under
54 the same terms as Perl itself.
55  
56 See L<http://www.perl.com/perl/misc/Artistic.html>
57  
58 =cut
↑ Summary