summaryrefslogtreecommitdiff
path: root/pod/perlpragma.pod
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-01-24 14:41:02 -0700
committerKarl Williamson <public@khwilliamson.com>2013-01-24 19:04:48 -0700
commitf703fc96a75eab3db924e41a52531905784836de (patch)
tree3e1d1202c4d1a4efaa959f0af21a57e7babfcacd /pod/perlpragma.pod
parente58c5aaf5fae1951e56c0433da91fbbfb31b620c (diff)
downloadperl-f703fc96a75eab3db924e41a52531905784836de.tar.gz
Fix various minor pod issues
These were all uncovered by the new Pod::Checker, not yet in core. Fixing these will speed up debugging the new Checker.
Diffstat (limited to 'pod/perlpragma.pod')
-rw-r--r--pod/perlpragma.pod26
1 files changed, 13 insertions, 13 deletions
diff --git a/pod/perlpragma.pod b/pod/perlpragma.pod
index 604387d9f9..78dacbf174 100644
--- a/pod/perlpragma.pod
+++ b/pod/perlpragma.pod
@@ -16,22 +16,22 @@ mathematical operators, and would like to provide your own pragma that
functions much like C<use integer;> You'd like this code
use MyMaths;
-
+
my $l = MyMaths->new(1.2);
my $r = MyMaths->new(3.4);
-
+
print "A: ", $l + $r, "\n";
-
+
use myint;
print "B: ", $l + $r, "\n";
-
+
{
no myint;
print "C: ", $l + $r, "\n";
}
-
+
print "D: ", $l + $r, "\n";
-
+
no myint;
print "E: ", $l + $r, "\n";
@@ -63,12 +63,12 @@ this:
$$l + $$r;
}
};
-
+
sub new {
my ($class, $value) = @_;
bless \$value, $class;
}
-
+
1;
Note how we load the user pragma C<myint> with an empty list C<()> to
@@ -77,24 +77,24 @@ prevent its C<import> being called.
The interaction with the Perl compilation happens inside package C<myint>:
package myint;
-
+
use strict;
use warnings;
-
+
sub import {
$^H{"myint/in_effect"} = 1;
}
-
+
sub unimport {
$^H{"myint/in_effect"} = 0;
}
-
+
sub in_effect {
my $level = shift // 0;
my $hinthash = (caller($level))[10];
return $hinthash->{"myint/in_effect"};
}
-
+
1;
As pragmata are implemented as modules, like any other module, C<use myint;>