| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::Math::Tutor::Cmd::VulFrac::Cmd::Compare; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23875
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA $VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
66
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
App::Math::Tutor::Cmd::VulFrac::Cmd::Compare - Plugin for comparing vulgar fractions |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
17
|
1
|
|
|
1
|
|
331
|
use MooX::Cmd; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
18
|
1
|
|
|
1
|
|
1745
|
use MooX::Options; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
9
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
1377
|
use Carp qw(croak); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
58
|
|
|
21
|
1
|
|
|
1
|
|
6
|
use File::ShareDir (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
13
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use Template (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
15
|
|
|
23
|
1
|
|
|
1
|
|
5
|
use Scalar::Util qw(looks_like_number); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
447
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has template_filename => ( |
|
26
|
|
|
|
|
|
|
is => "ro", |
|
27
|
|
|
|
|
|
|
default => "twocols" |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
with "App::Math::Tutor::Role::VulFracExercise"; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _build_exercises |
|
33
|
|
|
|
|
|
|
{ |
|
34
|
1
|
|
|
1
|
|
30
|
my ($self) = @_; |
|
35
|
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
2
|
my (@tasks); |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
6
|
foreach my $i ( 1 .. $self->quantity ) |
|
39
|
|
|
|
|
|
|
{ |
|
40
|
15
|
|
|
|
|
17
|
my @line; |
|
41
|
15
|
|
|
|
|
28
|
foreach my $j ( 0 .. 1 ) |
|
42
|
|
|
|
|
|
|
{ |
|
43
|
30
|
|
|
|
|
79
|
my ( $a, $b ) = $self->get_vulgar_fractions(2); |
|
44
|
30
|
|
|
|
|
87
|
push @line, [ $a, $b ]; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
15
|
|
|
|
|
35
|
push @tasks, \@line; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
10
|
my $exercises = { |
|
50
|
|
|
|
|
|
|
section => "Vulgar fraction comparison", |
|
51
|
|
|
|
|
|
|
caption => 'Vulgar fractions', |
|
52
|
|
|
|
|
|
|
label => 'vulgar_fractions_comparison', |
|
53
|
|
|
|
|
|
|
header => [ [ 'Vulgar fraction Comparison', 'Vulgar fraction Comparison' ] ], |
|
54
|
|
|
|
|
|
|
solutions => [], |
|
55
|
|
|
|
|
|
|
challenges => [], |
|
56
|
|
|
|
|
|
|
}; |
|
57
|
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
3
|
foreach my $line (@tasks) |
|
59
|
|
|
|
|
|
|
{ |
|
60
|
15
|
|
|
|
|
17
|
my ( @solution, @challenge ); |
|
61
|
|
|
|
|
|
|
|
|
62
|
15
|
|
|
|
|
48
|
foreach my $i ( 0 .. 1 ) |
|
63
|
|
|
|
|
|
|
{ |
|
64
|
30
|
|
|
|
|
28
|
my ( $a, $b ) = @{ $line->[$i] }; |
|
|
30
|
|
|
|
|
49
|
|
|
65
|
30
|
|
|
|
|
171
|
push( @challenge, "\$ $a \\underbracket[0.5pt]{\\texttt{ }}\\text{ } $b \$" ); |
|
66
|
|
|
|
|
|
|
|
|
67
|
30
|
|
|
|
|
43
|
my @way; # remember Frank Sinatra :) |
|
68
|
30
|
|
|
|
|
68
|
my $op = $a <=> $b; |
|
69
|
30
|
100
|
|
|
|
74
|
$op < 0 and push( @way, "$a < $b" ); |
|
70
|
30
|
100
|
|
|
|
91
|
$op > 0 and push( @way, "$a > $b" ); |
|
71
|
30
|
50
|
|
|
|
63
|
$op == 0 and push( @way, "$a = $b" ); |
|
72
|
|
|
|
|
|
|
|
|
73
|
30
|
|
|
|
|
95
|
push( @solution, '$ ' . join( " = ", @way ) . ' $' ); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
15
|
|
|
|
|
22
|
push( @{ $exercises->{solutions} }, \@solution ); |
|
|
15
|
|
|
|
|
28
|
|
|
77
|
15
|
|
|
|
|
27
|
push( @{ $exercises->{challenges} }, \@challenge ); |
|
|
15
|
|
|
|
|
41
|
|
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
50
|
return $exercises; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Copyright 2010-2014 Jens Rehsack. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
88
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
89
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |