Subject: | open->import::into parsed as a call to the function open |
I'm trying to do the equivalent of "use open qw(:encoding(UTF-8) :std)"
in the calling package, but when the open->import::into call appears to
be parsed as a call to the function open:
$ perl -E 'use diagnostics; package test; use Import::Into; use open
qw{:encoding(UTF-8) :std}; sub import { open->import::into(scalar
caller, qw{:encoding(UTF-8) :std}); $^H{test}=1; } package main; use
test;'
Not enough arguments for open at -e line 1, near "open->import::into"
BEGIN not safe after errors--compilation aborted at -e line 1 (#1)
(F) The function requires more arguments than you specified.
Uncaught exception from user code:
Not enough arguments for open at -e line 1, near "open-
Show quoted text
>import::into"
BEGIN not safe after errors--compilation aborted at -e line 1.
My package doesn't require the open pragma itself, so I also tried using
base/parent instead of using open directly:
$ perl -E 'use diagnostics; package test; use Import::Into; use base
"open"; sub import { open->import::into(scalar caller, qw{:encoding(UTF-
8) :std}); $^H{test}=1; } package main; use test;'
Not enough arguments for open at (eval 3) line 2, at EOF
...propagated at /home/mike/perl5/perlbrew/perls/perl-
5.16.0/lib/5.16.0/base.pm line 84.
BEGIN failed--compilation aborted at -e line 1 (#1)
(F) The function requires more arguments than you specified.
Uncaught exception from user code:
Not enough arguments for open at (eval 3) line 2, at EOF
...propagated at /home/mike/perl5/perlbrew/perls/perl-
5.16.0/lib/5.16.0/base.pm line 84.
BEGIN failed--compilation aborted at -e line 1.