File Coverage

blib/lib/Web/PerlDistSite/Common.pm
Criterion Covered Total %
statement 20 25 80.0
branch 0 4 0.0
condition 0 3 0.0
subroutine 7 8 87.5
pod 0 1 0.0
total 27 41 65.8


line stmt bran cond sub pod time code
1             package Web::PerlDistSite::Common;
2:

3: our $VERSION = '0.001011';
4:
5: use v5.26;
6: use Type::Params qw( -sigs );
7: use YAML::PP;
8: use Types::Common ();
9: use Path::Tiny qw( path );
10: use HTML::HTML5::Entities ();
11:
12: use Exporter::Almighty -setup => {
13: tag => {
14: sigs => [ 'signature', 'signature_for' ],
15: path => [ 'path' ],
16: html => [ 'esc_html' ],
17: },
18: const => {
19: booleans => { true => !!1, false => !!0 },
20: },
21: type => [
22: 'Types::Common',
23: ],
24: class => [
25: 'Path::Tiny',
26: ],
27: also => [
28: 'strict',
29: 'warnings',
30: 'feature' => [ 'state' ],
31: 'experimental' => [ 'signatures' ],
32: ],
33: };
34:
35: PathTiny->coercion->add_type_coercions(
36: Types::Common::Str, q{ Path::Tiny::path( $_ ) },
37: );
38:
39: *esc_html = \&HTML::HTML5::Entities::encode_entities;
40:
41: sub Path::Tiny::spew_if_changed {
42: my ( $self, $content ) = @_;
43: my $orig = $self->exists ? $self->slurp_utf8 : \0;
44: if ( ref $orig or $orig ne $content ) {
45: $self->spew_utf8( $content );
46: }
47: return $self;
48: }
49:
50: 1;
51: