summaryrefslogtreecommitdiff
path: root/lib/PerlIO.pm
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-03-23 16:27:41 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-03-23 16:27:41 +0000
commit1141d9f89ca1cb89e46951e8afc784c7b4862cd2 (patch)
tree29e556aabb356fad800a7434cc402c39bb8333aa /lib/PerlIO.pm
parenta999f61be32148694ba1c2837b1a303e42fd96b1 (diff)
downloadperl-1141d9f89ca1cb89e46951e8afc784c7b4862cd2.tar.gz
Check in a stable (working) version before next round of tweaks.
Changes include: - Move default layers code out of doio.c and into perlio.c - Single routine for parsing layer specification strings. - Skeleton support for demand loading of layers - Core-dump avoidance if PERLIO environment specifies loadable layer (does not _work_ as need IO to load and need load to do IO ...) p4raw-id: //depot/perlio@9313
Diffstat (limited to 'lib/PerlIO.pm')
-rw-r--r--lib/PerlIO.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/PerlIO.pm b/lib/PerlIO.pm
new file mode 100644
index 0000000000..c5ce016db4
--- /dev/null
+++ b/lib/PerlIO.pm
@@ -0,0 +1,26 @@
+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__