blob: 65b7ec35309492af0faa615e7dc4595474fd46d4 (
plain)
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
|
package PerlIO;
# Map layer name to package that defines it
my %alias = (encoding => 'Encode');
sub import
{
my $class = shift;
while (@_)
{
my $layer = shift;
if (exists $alias{$layer})
{
$layer = $alias{$layer}
}
else
{
$layer = "${class}::$layer";
}
eval "require $layer";
warn $@ if $@;
}
}
1;
__END__
=head1 NAME
PerlIO - On demand loader for PerlIO::* name space
=head1 SYNOPSIS
open($fh,">:foo",...)
=head1 DESCRIPTION
When an undefined layer 'foo' is encountered in an C<open> or C<binmode> layer
specification then C code performs the equivalent of:
use PerlIO 'foo';
The perl code in PerlIO.pm then attempts to locate a layer by doing
require PerlIO::foo;
Otherwise the C<PerlIO> package is a place holder for additional PerLIO related
functions.
=cut
|