xref: /openbsd/gnu/usr.bin/perl/t/lib/mypragma.pm (revision 3cab2bb3)
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 {
33    $^H{mypragma} = 42;
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;
46