Skip to content

Commit

Permalink
Add use strict, use warnings to modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
pstaabp committed Mar 24, 2024
1 parent a0bfd14 commit 741c2bd
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/Label.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ This module defines labels for the graph objects (WWPlot).
package Label;

use strict;
use warnings;

use GD;

#use Exporter;
#use DynaLoader;
Expand Down
3 changes: 3 additions & 0 deletions lib/Plots/Axes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ be visible after the fill, otherwise the fill will cover the axis. Default: 0

package Plots::Axes;

use strict;
use warnings;

sub new {
my $class = shift;
my $self = {
Expand Down
3 changes: 3 additions & 0 deletions lib/Plots/Data.pm
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ to add / change the styles.

package Plots::Data;

use strict;
use warnings;

sub new {
my $class = shift;
my $self = {
Expand Down
5 changes: 5 additions & 0 deletions lib/Plots/GD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ See L<plots.pl> for more details.

package Plots::GD;

use GD;

use strict;
use warnings;

sub new {
my ($class, $pgplot) = @_;
my $self = {
Expand Down
11 changes: 7 additions & 4 deletions lib/Plots/Plot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ See L<plots.pl> for more details.

package Plots::Plot;

use strict;
use warnings;

use Plots::Axes;
use Plots::Data;
use Plots::GD;
use Plots::Tikz;
use Plots::GD;

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

my $self = {
pg => $pg,
Expand Down Expand Up @@ -158,15 +161,15 @@ sub image_type {
# Tikz needs to use pdf for hardcopy generation.
sub ext {
my $self = shift;
return 'pdf' if ($self->{type} eq 'Tikz' && $main::displayMode eq 'TeX');
return 'pdf' if ($self->{type} eq 'Tikz' && $self->{pg}{displayMode} eq 'TeX');
return $self->{ext};
}

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

# Add functions to the graph.
Expand Down
3 changes: 3 additions & 0 deletions lib/Plots/Tikz.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ See L<plots.pl> for more details.

package Plots::Tikz;

use strict;
use warnings;

sub new {
my ($class, $pgplot) = @_;
my $image = new LaTeXImage;
Expand Down
3 changes: 3 additions & 0 deletions lib/WWPlot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ These functions translate from real world to pixel coordinates.
package WWPlot;

use strict;
use warnings;

use GD;

#use Exporter;
#use DynaLoader;
Expand Down

0 comments on commit 741c2bd

Please sign in to comment.