forked from exodist/Lexical-Importer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
110 lines (67 loc) · 2.74 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
NAME
Lexical::Importer - Importer + Lexical subs/vars.
DESCRIPTION
This is a subclass of Importer which will import all symbols as
lexicals instead of package symbols.
IMPORTANT NOTE
This imports symbols into the currently compiling scope which is not
necessarily the same as the package doing the importing.
SYNOPSIS
Say you have a module, Foo.pm:
package Foo
use base 'Exporter';
our @EXPORT = qw/foo/;
sub foo { 'not lexical' }
You want to import foo() to use, but you also have your own foo()
method you do not want to squash in Your::Module.pm
# Define package versions first
sub foo { 'not lexical' }
say foo(); # prints 'not lexical';
{
use Lexical::Importer Foo => 'foo';
say foo(); # prints 'foo'
}
say foo(); # prints 'not lexical' again;
use Lexical::Importer Foo => 'foo';
say foo(); # prints 'foo'
say __PACKAGE__->foo(); # prints 'not lexical', method dispatch find package sub.
# Remove lexical subs
no Lexical::Importer;
say foo(); # prints 'not lexical' again;
IMPORTER
This package inherits from Importer and works exactly the same apart
from being lexical instead of modifying the symbol table.
SEE ALSO
Importer - The importer module this package subclasses
Lexical::Var and Lexical::Sub - The awesome modules Zefram wrote that
make this possible. Note: Lexical::Importer ships with a forked copy of
these
Lexical::Import - A similar module, but it does not support everything
Lexical::Importer does.
LEXICAL-VAR FORK
The Lexical::Importer module is bundled with a fork of the Lexical::Var
XS code. This fork is necessary due to Lexical::Var being broken on
newer perls. The author of the original package is not accepting third
party patches, and has not yet fixed the issues himself. Once a version
of Lexical::Var ships with a fix for newer perls this fork will likely
be removed.
AUTHOR
Andrew Main (Zefram) <[email protected]>
COPYRIGHT
Copyright (C) 2009, 2010, 2011, 2012, 2013 Andrew Main (Zefram)
LICENSE
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SOURCE
The source code repository for Lexical-Importer can be found at
http://github.com/FIXME/.
MAINTAINERS
Chad Granum <[email protected]>
AUTHORS
Chad Granum <[email protected]>
COPYRIGHT
Copyright 2016 Chad Granum <[email protected]>.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See http://dev.perl.org/licenses/