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   65769 use strict;
  14         40  
  14         431  
2 14     14   91 use warnings;
  14         26  
  14         789  
3             package Pod::Elemental::Types;
4             # ABSTRACT: data types for Pod::Elemental
5             $Pod::Elemental::Types::VERSION = '0.103005';
6 14     14   1766 use MooseX::Types -declare => [ qw(FormatName ChompedString) ];
  14         595412  
  14         132  
7 14     14   74296 use MooseX::Types::Moose qw(Str);
  14         52541  
  14         107  
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.103005
50              
51             =head1 OVERVIEW
52              
53             This is a library of MooseX::Types types used by Pod::Elemental.
54              
55             =head1 TYPES
56              
57             =head2 FormatName
58              
59             This is a valid name for a format (a Pod5::Region). It does not expect the
60             leading colon for pod-like regions.
61              
62             =head2 ChompedString
63              
64             This is a string that does not end with newlines. It can be coerced from a
65             Str ending in a single newline -- the newline is dropped.
66              
67             =head1 AUTHOR
68              
69             Ricardo SIGNES <rjbs@cpan.org>
70              
71             =head1 COPYRIGHT AND LICENSE
72              
73             This software is copyright (c) 2020 by Ricardo SIGNES.
74              
75             This is free software; you can redistribute it and/or modify it under
76             the same terms as the Perl 5 programming language system itself.
77              
78             =cut