summaryrefslogtreecommitdiffhomepage
path: root/perl.html.markdown
diff options
context:
space:
mode:
authorDan Book <grinnz@gmail.com>2015-12-13 19:39:37 -0500
committerDan Book <grinnz@gmail.com>2015-12-13 19:39:37 -0500
commit88af462c699b9f48310a9624bb6bbe94b7101af1 (patch)
tree3c4c1e367d8d72267c142f42ea9ab4e332d9534a /perl.html.markdown
parent35b3c490ce06fb94b8b51bd7f5ceb1638401fb1a (diff)
use strict and warnings in example modules
Diffstat (limited to 'perl.html.markdown')
-rw-r--r--perl.html.markdown6
1 files changed, 5 insertions, 1 deletions
diff --git a/perl.html.markdown b/perl.html.markdown
index ab71a6ab..d919e00e 100644
--- a/perl.html.markdown
+++ b/perl.html.markdown
@@ -202,6 +202,8 @@ logger("We have a logger subroutine!");
# that Perl can find it.
package MyModule;
+use strict;
+use warnings;
sub trim {
my $string = shift;
@@ -237,6 +239,8 @@ trim($string);
# or Moo (see below).
package MyCounter;
+use strict;
+use warnings;
sub new {
my $class = shift;
@@ -268,7 +272,7 @@ print $counter->count, "\n"; # 1
# class can be used equivalently to the one above.
package MyCounter;
-use Moo;
+use Moo; # imports strict and warnings
has 'count' => (is => 'rwp', default => 0, init_arg => undef);