diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-01-21 23:44:47 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-01-21 23:44:47 +0000 |
commit | dfebf9581083f76d0f88d6a3edc9e5b72e852d91 (patch) | |
tree | f4c9a75667bb9b8d4dbf2f58d4c13b9f7e3739eb /lib/open.pm | |
parent | e03ac09223e234f57407d65d0cb9cc67f3394e0a (diff) | |
download | perl-dfebf9581083f76d0f88d6a3edc9e5b72e852d91.tar.gz |
Make "real" layers of ":utf8" and ":raw".
So now PERLIO=utf8 perl ...
does what Andreas wanted.
Fix arg passing in open.pm (still have a Carp issue).
p4raw-id: //depot/perlio@8511
Diffstat (limited to 'lib/open.pm')
-rw-r--r-- | lib/open.pm | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/open.pm b/lib/open.pm index 1e073c2e62..53ae308310 100644 --- a/lib/open.pm +++ b/lib/open.pm @@ -7,22 +7,25 @@ use vars qw(%layers @layers); # Populate hash in non-PerlIO case %layers = (crlf => 1, raw => 0) unless (@layers); +# warn join(',',keys %layers); + our $VERSION = '1.00'; sub import { - shift; - die "`use open' needs explicit list of disciplines" unless @_; + my ($class,@args) = @_; + croak("`use open' needs explicit list of disciplines") unless @args; $^H |= $open::hint_bits; my ($in,$out) = split(/\0/,(${^OPEN} || '\0')); my @in = split(/\s+/,$in); my @out = split(/\s+/,$out); - while (@_) { - my $type = shift; - my $discp = shift; + while (@args) { + my $type = shift(@args); + my $discp = shift(@args); my @val; - foreach my $layer (split(/\s+:?/,$discp)) { + foreach my $layer (split(/\s+/,$discp)) { + $layer =~ s/^://; unless(exists $layers{$layer}) { - croak "Unknown discipline layer '$layer'"; + carp("Unknown discipline layer '$layer'"); } push(@val,":$layer"); if ($layer =~ /^(crlf|raw)$/) { |