This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #70075] no 6; broken
[perl5.git] / t / lib / mypragma.pm
1 =head1 NAME
2
3 mypragma - an example of a user pragma
4
5 =head1 SYNOPSIS
6
7 In 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
19 An example of how to write a pragma.
20
21 =head1 AUTHOR
22
23 Rafael Garcia-Suarez
24
25 =cut
26
27 package mypragma;
28
29 use strict;
30 use warnings;
31
32 sub import {
33     $^H{mypragma} = 42;
34 }
35
36 sub unimport {
37     $^H{mypragma} = 0;
38 }
39
40 sub in_effect {
41     my $hinthash = (caller(0))[10];
42     return $hinthash->{mypragma};
43 }
44
45 1;