blib/lib/Panotools/Makefile/Comment.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 36 CC 2 SCAR 12.0
CC
2
Cov
0%
Assemble
6.0
new
2.0
Name
2.0
CRAP 3.3
1 package Panotools::Makefile::Comment;
2  
3 =head1 NAME
4  
5 Panotools::Makefile::Comment - Assemble Makefile Comment lines
6  
7 =head1 SYNOPSIS
8  
9 Simple interface for generating Makefile syntax
10  
11 =head1 DESCRIPTION
12  
13 Writing Makefiles directly from perl scripts with print and "\t" etc... is
14 prone to error, this library provides a simple perl interface for assembling
15 Makefiles.
16  
17 =cut
18  
19 use strict;
20 use warnings;
21  
22 =head1 USAGE
23  
24 my $note = new Panotools::Makefile::Comment;
25  
26 ..or add text at the same time:
27  
28 my $note = new Panotools::Makefile::Comment ('Warning, may not eat your cat!');
29  
30 =cut
31  
32 sub new
33 {
34 my $class = shift;
35 $class = ref $class || $class;
36 my $self = bless [@_], $class;
37 return $self;
38 }
39  
40 =pod
41  
42 Add lines to the comment:
43  
44 $note->Lines ('..but it might...', '...sometimes');
45  
46 =cut
47  
48 sub Name
49 {
50 my $self = shift;
51 push @{$self}, @_;
52 }
53  
54 =pod
55  
56 Construct a text fragment suitable for use in a Makefile like so:
57  
58 $text = $note->Assemble;
59  
60 =cut
61  
62 sub Assemble
63 {
64 my $self = shift;
65 return '' unless scalar @{$self};
66  
67 my $text = "\n# ";
68 $text .= join "\n# ", @{$self};
69 return $text . "\n";
70 }
71  
72 1;