File Coverage

blib/lib/Pod/Elemental/Types.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1 14     14   54512 use strict;
  14         88  
  14         412  
2 14     14   70 use warnings;
  14         27  
  14         670  
3             package Pod::Elemental::Types 0.103006;
4             # ABSTRACT: data types for Pod::Elemental
5              
6 14     14   1559 use MooseX::Types -declare => [ qw(FormatName ChompedString) ];
  14         500112  
  14         115  
7 14     14   64314 use MooseX::Types::Moose qw(Str);
  14         46638  
  14         92  
8              
9             #pod =head1 OVERVIEW
10             #pod
11             #pod This is a library of MooseX::Types types used by Pod::Elemental.
12             #pod
13             #pod =head1 TYPES
14             #pod
15             #pod =head2 FormatName
16             #pod
17             #pod This is a valid name for a format (a Pod5::Region). It does not expect the
18             #pod leading colon for pod-like regions.
19             #pod
20             #pod =cut
21              
22             # Probably needs refining -- rjbs, 2009-05-26
23             subtype FormatName, as Str, where { length $_ and /\A\S+\z/ };
24              
25             #pod =head2 ChompedString
26             #pod
27             #pod This is a string that does not end with newlines. It can be coerced from a
28             #pod Str ending in a single newline -- the newline is dropped.
29             #pod
30             #pod =cut
31              
32             subtype ChompedString, as Str, where { ! /\n\z/ };
33             coerce ChompedString, from Str, via { chomp; $_ };
34              
35             1;
36              
37             __END__
38              
39             =pod
40              
41             =encoding UTF-8
42              
43             =head1 NAME
44              
45             Pod::Elemental::Types - data types for Pod::Elemental
46              
47             =head1 VERSION
48              
49             version 0.103006
50              
51             =head1 OVERVIEW
52              
53             This is a library of MooseX::Types types used by Pod::Elemental.
54              
55             =head1 PERL VERSION
56              
57             This library should run on perls released even a long time ago. It should work
58             on any version of perl released in the last five years.
59              
60             Although it may work on older versions of perl, no guarantee is made that the
61             minimum required version will not be increased. The version may be increased
62             for any reason, and there is no promise that patches will be accepted to lower
63             the minimum required perl.
64              
65             =head1 TYPES
66              
67             =head2 FormatName
68              
69             This is a valid name for a format (a Pod5::Region). It does not expect the
70             leading colon for pod-like regions.
71              
72             =head2 ChompedString
73              
74             This is a string that does not end with newlines. It can be coerced from a
75             Str ending in a single newline -- the newline is dropped.
76              
77             =head1 AUTHOR
78              
79             Ricardo SIGNES <cpan@semiotic.systems>
80              
81             =head1 COPYRIGHT AND LICENSE
82              
83             This software is copyright (c) 2022 by Ricardo SIGNES.
84              
85             This is free software; you can redistribute it and/or modify it under
86             the same terms as the Perl 5 programming language system itself.
87              
88             =cut