develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [perl #20536] use if 1, open => ':utf8' fails

Thread Previous | Thread Next
From:
hv
Date:
February 9, 2003 18:55
Subject:
Re: [perl #20536] use if 1, open => ':utf8' fails
Message ID:
200302100257.h1A2vaW15614@crypt.compulink.co.uk
Autrijus Tang (via RT) <perlbug-followup@perl.org> wrote:
:$ perl -Mif=1,open,:utf8
:Not enough arguments for open at (eval 1) line 2, at EOF
:        ...propagated at /usr/local/lib/perl5/5.8.0/if.pm line 10.
:BEGIN failed--compilation aborted.
:
:The following patch "corrects" this behaviour by manually translating it.

Thanks, I've applied the patch below as change #18684 based on your
patch and Benjamin's suggestions.

:btw, if.pm on CPAN isn't "corified" yet -- it still installs to sitelib.

Hugo
--- lib/if.pm.old	Mon Feb 10 03:45:42 2003
+++ lib/if.pm	Mon Feb 10 03:47:02 2003
@@ -1,13 +1,14 @@
 package if;
 
-our $VERSION = '0.02';
+our $VERSION = '0.03';
 
 sub work {
   my $method = shift() ? 'import' : 'unimport';
   return unless shift;		# CONDITION
 
   my $p = $_[0];		# PACKAGE
-  eval "require $p" or die;	# Adds .pm etc if needed
+  (my $file = "$p.pm") =~ s!::!/!g;
+  require $file or die;
 
   my $m = $p->can($method);
   goto &$m if $m;
--- lib/if.t.old	Mon Feb 10 03:48:46 2003
+++ lib/if.t	Mon Feb 10 03:45:28 2003
@@ -5,7 +5,7 @@
     @INC = '../lib';
 }
 
-use Test::More tests => 5;
+use Test::More tests => 6;
 
 my $v_plus = $] + 1;
 my $v_minus = $] - 1;
@@ -27,3 +27,5 @@
 ok( eval "use if 1, Cwd; cwd() || 1;",
     '"use if" with a true condition, module, no arguments, exports');
 
+ok( eval "use if qw/ 1 if 1 strict subs /; \${'f'} = 12" eq 12,
+    '"use if" with a module named after keyword');

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About