line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Changes file management - ~/lib/Changes/NewLine.pm |
3
|
|
|
|
|
|
|
## Version v0.1.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2022 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2022/12/08 |
7
|
|
|
|
|
|
|
## Modified 2022/12/08 |
8
|
|
|
|
|
|
|
## All rights reserved |
9
|
|
|
|
|
|
|
## |
10
|
|
|
|
|
|
|
## |
11
|
|
|
|
|
|
|
## This program is free software; you can redistribute it and/or modify it |
12
|
|
|
|
|
|
|
## under the same terms as Perl itself. |
13
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
package Changes::NewLine; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
11
|
|
|
11
|
|
10218
|
use strict; |
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
443
|
|
18
|
11
|
|
|
11
|
|
67
|
use warnings; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
488
|
|
19
|
11
|
|
|
11
|
|
95
|
use parent qw( Module::Generic ); |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
92
|
|
20
|
11
|
|
|
11
|
|
889
|
use vars qw( $VERSION ); |
|
11
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
701
|
|
21
|
11
|
|
|
11
|
|
218
|
our $VERSION = 'v0.1.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
11
|
|
|
11
|
|
56
|
use strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
198
|
|
25
|
11
|
|
|
11
|
|
47
|
use warnings; |
|
11
|
|
|
|
|
82
|
|
|
11
|
|
|
|
|
3043
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init |
28
|
|
|
|
|
|
|
{ |
29
|
26
|
|
|
26
|
1
|
2199
|
my $self = shift( @_ ); |
30
|
26
|
|
|
|
|
752
|
$self->{nl} = "\n"; |
31
|
26
|
|
|
|
|
71
|
$self->{raw} = undef; |
32
|
26
|
|
|
|
|
72
|
$self->{_init_strict_use_sub} = 1; |
33
|
26
|
50
|
|
|
|
144
|
$self->SUPER::init( @_ ) || return( $self->pass_error ); |
34
|
26
|
|
|
|
|
23253
|
return( $self ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub as_string |
38
|
|
|
|
|
|
|
{ |
39
|
27
|
|
|
27
|
1
|
638
|
my $self = shift( @_ ); |
40
|
27
|
|
|
|
|
104
|
my $raw = $self->raw; |
41
|
27
|
100
|
66
|
|
|
24878
|
if( defined( $raw ) && $raw->defined ) |
42
|
|
|
|
|
|
|
{ |
43
|
21
|
|
|
|
|
183
|
return( $raw ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else |
46
|
|
|
|
|
|
|
{ |
47
|
6
|
|
50
|
|
|
23
|
my $nl = $self->nl // "\n"; |
48
|
6
|
|
|
|
|
5525
|
return( $self->new_scalar( "$nl" ) ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
23
|
|
|
23
|
1
|
4100
|
sub line { return( shift->_set_get_number( 'line', @_ ) ); } |
53
|
|
|
|
|
|
|
|
54
|
30
|
|
|
30
|
1
|
944265
|
sub nl { return( shift->_set_get_scalar_as_object( 'nl', @_ ) ); } |
55
|
|
|
|
|
|
|
|
56
|
50
|
|
|
50
|
1
|
22773
|
sub raw { return( shift->_set_get_scalar_as_object( 'raw', @_ ) ); } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
# NOTE: POD |
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding utf-8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Changes::NewLine - New Line Class |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SYNOPSIS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use Changes::NewLine; |
71
|
|
|
|
|
|
|
my $nl = Changes::NewLine->new( |
72
|
|
|
|
|
|
|
nl => "\n", |
73
|
|
|
|
|
|
|
line => 12, |
74
|
|
|
|
|
|
|
raw => "\t\n", |
75
|
|
|
|
|
|
|
) || die( Changes::NewLine->error, "\n" ); |
76
|
|
|
|
|
|
|
say $nl->as_string; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
v0.1.0 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DESCRIPTION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This class represents a new line in the C<Changes> file. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 new |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This takes an hash or an hash reference of following options, and instantiate a new L<Changes::NewLine> object and returns it. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
If an error occurred, it returns an L<error|Module::Generic/error> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=over 4 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * C<line> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The line number where this new line was found in the C<Changes> file. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * C<nl> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The format of the new line to use with L</as_string> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * C<raw> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
The raw initial value such as it is found when parsing the C<Changes> file with L<Changes/parse> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=back |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 METHODS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 as_string |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Returns a string representation of the new line. If C<raw> is defined with L</raw>, then that initial value will be used and returned, otherwise, it will use whatever value is set with L</nl>. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns a L<scalar object|Module::Generic::Scalar> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 line |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Sets or gets the line number at which this new line appeared in the C<Changed> file. This is set by L<Changes/parse> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns a L<number object|Module::Generic::Number> |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 nl |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Sets or gets the new line sequence. For example C<\n>, or C<\r\n>, or C<\015\012> (same as previous, but more portable), etc. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Returns a L<scalar object|Module::Generic::Scalar> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 raw |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Sets or gets the initial new line value. This is set upon parsing by L<Changes/parse> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Returns a L<scalar object|Module::Generic::Scalar> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 AUTHOR |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 SEE ALSO |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
L<Changes>, L<Changes::Release>, L<Changes::Group>, L<Changes::Changes>, L<Changes::Version> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Copyright(c) 2022 DEGUEST Pte. Ltd. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
All rights reserved |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |