namespace PerlIO::Via::.
p4raw-id: //depot/perl@17393
open($fh,"<:Via(Some::Package)",...);
+ use PerlIO::Via::SomeLayer;
+
+ # Assume PerlIO::Via:: default namespace when SomeLayer.pm is not found
+ open($fh,"<:Via(SomeLayer)",...);
+
=head1 DESCRIPTION
The package to be used as a layer should implement at least some of the
char *pkg = SvPV(arg,pkglen);
s->obj = SvREFCNT_inc(arg);
s->stash = gv_stashpvn(pkg, pkglen, FALSE);
+ if (!s->stash)
+ {
+ s->obj = newSVpvn(Perl_form(aTHX_ "PerlIO::Via::%s",pkg), pkglen + 13);
+ SvREFCNT_dec(arg);
+ s->stash = gv_stashpvn(SvPVX(s->obj), pkglen + 13, FALSE);
+ }
if (s->stash)
{
SV *modesv = (mode) ? sv_2mortal(newSVpvn(mode,strlen(mode))) : Nullsv;
my $tmp = "via$$";
-use Test::More tests => 13;
+use Test::More tests => 15;
my $fh;
my $a = join("", map { chr } 0..255) x 10;
is( $warnings, "", "don't warn about unknown package" );
}
+my $obj = '';
+sub Foo::PUSHED { $obj = shift; -1; }
+sub PerlIO::Via::Bar::PUSHED { $obj = shift; -1; }
+open $fh, '<:Via(Foo)', "foo";
+is( $obj, 'Foo', 'search for package Foo' );
+open $fh, '<:Via(Bar)', "bar";
+is( $obj, 'PerlIO::Via::Bar', 'search for package PerlIO::Via::Bar' );
+
END {
1 while unlink $tmp;
}