File Coverage

blib/lib/Arithmetic/PaperAndPencil/Action.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 27 27 100.0


line stmt bran cond sub pod time code
1             # -*- encoding: utf-8; indent-tabs-mode: nil -*-
2              
3 3     3   45 use v5.38;
  3         24  
4 3     3   17 use utf8;
  3         7  
  3         23  
5 3     3   90 use strict;
  3         6  
  3         98  
6 3     3   14 use warnings;
  3         6  
  3         258  
7 3     3   19 use open ':encoding(UTF-8)';
  3         6  
  3         21  
8 3     3   370 use feature qw/class/;
  3         7  
  3         480  
9 3     3   21 use experimental qw/class/;
  3         6  
  3         17  
10              
11             class Arithmetic::PaperAndPencil::Action 0.01;
12              
13             field $level :param ;
14             field $label :param ;
15             field $val1 :param = '';
16             field $val2 :param = '';
17             field $val3 :param = '';
18             field $r1l :param = 0;
19             field $r1c :param = 0;
20             field $r1val :param = '';
21             field $r1str :param = 0;
22             field $r2l :param = 0;
23             field $r2c :param = 0;
24             field $r2val :param = '';
25             field $r2str :param = 0;
26             field $w1l :param = 0;
27             field $w1c :param = 0;
28             field $w1val :param = '';
29             field $w2l :param = 0;
30             field $w2c :param = 0;
31             field $w2val :param = '';
32              
33             method from_csv($csv) {
34             ($level, $label, $val1, $val2, $val3, $r1l, $r1c, $r1val, $r1str
35             , $r2l, $r2c, $r2val, $r2str
36             , $w1l, $w1c, $w1val
37             , $w2l, $w2c, $w2val)
38             = split( /\s*;\s*/, $csv );
39              
40             }
41             method csv {
42             join(';', $level, $label, $val1, $val2, $val3, $r1l, $r1c, $r1val, $r1str
43             , $r2l, $r2c, $r2val, $r2str
44             , $w1l, $w1c, $w1val
45             , $w2l, $w2c, $w2val)
46             }
47             method set_level($n) { $level = $n } # waiting for :writer
48             method level { $level } # waiting for :reader
49             method label { $label } # why did :reader not appear in the 5.38 MVP?
50             method val1 { $val1 } # :reader would have allowed me to write a much shorter code
51             method val2 { $val2 } # I hope that :reader will appear soon
52             method val3 { $val3 } # :reader is such a useful feature!
53             method r1l { $r1l } # after reading the tutorial, I was hoping to use :reader for all 19 fields in this class
54             method r1c { $r1c } # what is the benefit of Corinna if :reader does not exist?
55             method r1val { $r1val } # when will :reader be available?
56             method r1str { $r1str } # :writer is a good thing to add, but :reader is a big win, a very big win
57             method r2l { $r2l } # I am interested in typed fields, but what I really really want is :reader
58             method r2c { $r2c } # :param for fields was implemented, why not :reader?
59             method r2val { $r2val } # I do not care much about field attributes for now, except for :reader
60             method r2str { $r2str } # :reader! :reader! :reader! :reader! :reader!
61             method w1l { $w1l } # if a new version of Perl includes :reader, it will be a sufficient reason to release a new version of the module
62             method w1c { $w1c } # "all work and no :reader make Jack a dull boy" by S Kubrick, with J Nicholson
63             method w1val { $w1val } # :reader of the Lost Ark by S Spielberg with H Ford
64             method w2l { $w2l } # The Hunt for :reader October by J McTiernan with S Connery
65             method w2c { $w2c } # Pale :reader, by and with C Eastwood
66             method w2val { $w2val } # "I said, :reader, can you put your hands in your head? oh no!" by Supertramp
67              
68             'CQFD'; # End of Arithmetic::PaperAndPencil::Action
69              
70             =head1 NAME
71              
72             Arithmetic::PaperAndPencil::Action -- basic action when computing an arithmetic operation
73              
74             =head1 VERSION
75              
76             Version 0.01
77              
78             =head1 SYNOPSIS
79              
80             This class should not be used directly. It is meant to be a utility
81             module for C.
82              
83             C is a class storing various
84             actions when computing an operation: writing digits on the paper,
85             drawing lines, reading previously written digits, etc.
86              
87             =head1 SUBROUTINES/METHODS
88              
89             =head2 from_csv
90              
91             Loads the attributes of an action with data from a CSV string.
92              
93             =head2 csv
94              
95             Produces a CSV string with the attributes of an action.
96              
97             =head1 AUTHOR
98              
99             Jean Forget, C<< >>
100              
101             =head1 BUGS
102              
103             Please report any bugs or feature requests to
104             C, or through the web
105             interface at
106             L.
107             I will be notified, and then you'll automatically be notified of
108             progress on your bug as I make changes.
109              
110             =head1 SUPPORT
111              
112             You can find documentation for this module with the perldoc command.
113              
114             perldoc Arithmetic::PaperAndPencil
115              
116             You can also look for information at:
117              
118             =over 4
119              
120             =item * RT: CPAN's request tracker (report bugs here)
121              
122             L
123              
124             =item * CPAN Ratings
125              
126             L
127              
128             =item * Search CPAN
129              
130             L
131              
132             =back
133              
134             =head1 ACKNOWLEDGEMENTS
135              
136             =head1 LICENSE AND COPYRIGHT
137              
138             This software is Copyright (c) 2024 by jforget.
139              
140             This is free software, licensed under:
141              
142             The Artistic License 2.0 (GPL Compatible)
143              
144             =cut
145