This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test preamble: unify chdir 't' if -d 't';
[perl5.git] / t / lib / mypragma.pm
CommitLineData
32645610
NC
1=head1 NAME
2
3mypragma - an example of a user pragma
4
5=head1 SYNOPSIS
6
7In your code
8
9 use mypragma; # Enable the pragma
10
11 mypragma::in_effect() # returns true; pragma is enabled
12
13 no mypragma;
14
15 mypragma::in_effect() # returns false; pragma is not enabled
16
17=head1 DESCRIPTION
18
19An example of how to write a pragma.
20
21=head1 AUTHOR
22
23Rafael Garcia-Suarez
24
25=cut
26
27package mypragma;
28
29use strict;
30use warnings;
31
32sub import {
fd9f6265 33 $^H{mypragma} = 42;
32645610
NC
34}
35
36sub unimport {
37 $^H{mypragma} = 0;
38}
39
40sub in_effect {
41 my $hinthash = (caller(0))[10];
42 return $hinthash->{mypragma};
43}
44
451;