Subject: | Load via -M |
This is entirely not Acme::ಠ_ಠ's fault, but this seemed like a good place to mention it:
$ perl -MAcme::ಠ_ಠ
Unrecognized character \xE0; marked by <-- HERE after use Acme::<-- HERE near column 11.
this works:
$ perl -Mutf8 -MAcme::ಠ_ಠ -e1
$
but it'd be nice if PERL_UNICODE=A could be used to get the same result. The attached perl patch (against perl-5.22.1) allows this and also -M with arbitrary unicode module names.
$ perl -CA -MAcme::ಠ_ಠ
$ echo 'use utf8; package ಠ; 1' > ಠ.pm
$ perl -CA -Mಠ -e1
$
cheers,
Tom
Subject: | 2015-12-30-perl-utf8-module.patch |
commit bab01271ce6bccfbc0059beb0ab6b9b05ca6cd08
Author: Tom Molesworth <TEAM@cpan.org>
Date: Wed Dec 30 19:22:08 2015 +0000
Attempt to support UTF8 in module names from -Mxxx
diff --git a/perl.c b/perl.c
index 16a6ca4..8ef1193 100644
--- a/perl.c
+++ b/perl.c
@@ -3330,8 +3330,8 @@ Perl_moreswitches(pTHX_ const char *s)
if (*s == '-') { use = " no "; ++s; }
sv = newSVpvn(use,4);
start = s;
- /* We allow -M'Module qw(Foo Bar)' */
- while(isWORDCHAR(*s) || *s==':') {
+ /* We allow -M'Module qw(Foo Bar)' - and it'd be nice to allow -Mà ² as well */
+ while(*s && *s != '=') {
if( *s++ == ':' ) {
if( *s == ':' )
s++;
@@ -3363,6 +3363,12 @@ Perl_moreswitches(pTHX_ const char *s)
sv_catpvs(sv, "\0)");
}
s = end;
+ /* If we're pretending to be Unicode, let's go all the way -
+ * the idea is that we may want to load a module such as à ² .pm
+ * if the filesystem would be so kind as to be in utf8
+ */
+ if (PL_unicode & PERL_UNICODE_ARGV_FLAG)
+ SvUTF8_on(sv);
Perl_av_create_and_push(aTHX_ &PL_preambleav, sv);
}
else