Skip to content

Commit 5c47cce

Browse files
committed
Add use strict, use warnings to modules.
1 parent 0dfc328 commit 5c47cce

28 files changed

+183
-162
lines changed

lib/Fun.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ my $FUNCTION_REFERENCE = "Fun";
201201

202202
my %fields = (
203203
tstart => -1, # (tstart,$tstop) constitutes the domain
204-
tstop => 1,
205-
steps => 50,
204+
tstop => 1,
205+
steps => 50,
206206
color => 'blue',
207207
x_rule => \&identity,
208208
y_rule => \&identity,

lib/Hermite.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ sub internal_critical_points {
233233
}
234234

235235
sub internal_inflection_points {
236-
my ($x0, $l, $lp,, $x1, $r, $rp, $rh_roots, $rf_function) = @_;
236+
my ($x0, $l, $lp, $x1, $r, $rp, $rh_roots, $rf_function) = @_;
237237
#data for one segment of the hermite spline
238238

239239
# coefficients for the approximating polynomial

lib/Label.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ This module defines labels for the graph objects (WWPlot).
4242
package Label;
4343

4444
use strict;
45+
use warnings;
46+
47+
use GD;
4548

4649
#use Exporter;
4750
#use DynaLoader;

lib/Plots/Axes.pm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ be visible after the fill, otherwise the fill will cover the axis. Default: 0
190190

191191
package Plots::Axes;
192192

193+
use strict;
194+
use warnings;
195+
193196
sub new {
194197
my $class = shift;
195198
my $self = {
@@ -214,9 +217,9 @@ sub new {
214217
sub axis_defaults {
215218
my ($self, $axis) = @_;
216219
return (
217-
visible => 1,
220+
visible => 1,
218221
min => -5,
219-
max => 5,
222+
max => 5,
220223
label => $axis eq 'y' ? '\(y\)' : '\(x\)',
221224
location => $axis eq 'y' ? 'center' : 'middle',
222225
position => 0,
@@ -329,4 +332,4 @@ sub bounds {
329332
return $self->{xaxis}{min}, $self->{yaxis}{min}, $self->{xaxis}{max}, $self->{yaxis}{max};
330333
}
331334

332-
1;
335+
1;

lib/Plots/Data.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ to add / change the styles.
107107

108108
package Plots::Data;
109109

110+
use strict;
111+
use warnings;
112+
110113
sub new {
111114
my $class = shift;
112115
my $self = {
@@ -168,7 +171,7 @@ sub set_function {
168171
sub_x => sub { return $_[0]; },
169172
sub_y => sub { return $_[0]; },
170173
min => -5,
171-
max => 5,
174+
max => 5,
172175
@_
173176
};
174177
$self->style(steps => $self->{function}{steps}) if $self->{funciton}{steps};

lib/Plots/GD.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ See L<plots.pl> for more details.
2323

2424
package Plots::GD;
2525

26+
use GD;
27+
28+
use strict;
29+
use warnings;
30+
2631
sub new {
2732
my ($class, $pgplot) = @_;
2833
my $self = {
@@ -382,4 +387,4 @@ sub draw {
382387
return $pgplot->ext eq 'gif' ? $self->im->gif : $self->im->png;
383388
}
384389

385-
1;
390+
1;

lib/Plots/Plot.pm

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,20 @@ See L<plots.pl> for more details.
2323

2424
package Plots::Plot;
2525

26+
use strict;
27+
use warnings;
28+
2629
use Plots::Axes;
2730
use Plots::Data;
28-
use Plots::GD;
2931
use Plots::Tikz;
32+
use Plots::GD;
3033

3134
sub new {
3235
my ($class, $pg, @opts) = @_;
33-
my $size = $main::envir{onTheFlyImageSize} || 500;
36+
my $size = $pg->{envir}{onTheFlyImageSize} || 500;
3437

3538
my $self = {
36-
pg => $pg,
39+
pg => $pg,
3740
imageName => {},
3841
type => 'Tikz',
3942
ext => 'svg',
@@ -158,15 +161,15 @@ sub image_type {
158161
# Tikz needs to use pdf for hardcopy generation.
159162
sub ext {
160163
my $self = shift;
161-
return 'pdf' if ($self->{type} eq 'Tikz' && $main::displayMode eq 'TeX');
164+
return 'pdf' if ($self->{type} eq 'Tikz' && $self->{pg}{displayMode} eq 'TeX');
162165
return $self->{ext};
163166
}
164167

165168
# Return a copy of the tikz code (available after the image has been drawn).
166169
# Set $plot->{tikzDebug} to 1 to just generate the tikzCode, and not create a graph.
167170
sub tikz_code {
168171
my $self = shift;
169-
return ($self->{tikzCode} && $main::displayMode =~ /HTML/) ? '<pre>' . $self->{tikzCode} . '</pre>' : '';
172+
return ($self->{tikzCode} && $self->{pg}{displayMode} =~ /HTML/) ? '<pre>' . $self->{tikzCode} . '</pre>' : '';
170173
}
171174

172175
# Add functions to the graph.

lib/Plots/Tikz.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ See L<plots.pl> for more details.
2121
2222
=cut
2323

24-
2524
package Plots::Tikz;
2625

26+
use strict;
27+
use warnings;
28+
2729
sub new {
2830
my ($class, $pgplot) = @_;
2931
my $image = new LaTeXImage;

lib/Regression.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ if (DEBUGGING) {
431431

432432
my $reg = Statistics::Regression->new(3, "sample regression", [ "const", "someX", "someY" ]);
433433
$reg->include(2.0, [ 1.0, 3.0, -1.0 ]);
434-
$reg->include(1.0, [ 1.0, 5.0, 2.0 ]);
435-
$reg->include(20.0, [ 1.0, 31.0, 0.0 ]);
436-
$reg->include(15.0, [ 1.0, 11.0, 2.0 ]);
434+
$reg->include(1.0, [ 1.0, 5.0, 2.0 ]);
435+
$reg->include(20.0, [ 1.0, 31.0, 0.0 ]);
436+
$reg->include(15.0, [ 1.0, 11.0, 2.0 ]);
437437

438438
# $reg->print(); or: my $coefs= $reg->theta(); print @coefs; print $reg->rsq;
439439
# my $coefs= $reg->theta(); print $coeff[0];

0 commit comments

Comments
 (0)