I have hit this error several time lately (since the advent of 5.6.0 ?).
A Google search produced 7 problem reports, btw Jun 2000 and now, with a variety of Perl modules,
including PPM and ExtUtils::Installed.
It can crop up easily on Win32 if you use the native pathnames containing '\' path separator.
Here are examples:
#! perl -w
use strict;
# 1: no problem (even on Win32)
#
my $root = 'C:/perl';
my $podfile = 'C:/Perl/lib/Config.pm';
print "$podfile $root $1 $2\n" if $podfile =~ m!$root/(.*)/(\w+)
+\.p.+$!i;
# 2: causes error
#
my $rootb = 'C:\perl';
my $podfileb = 'C:\Perl\lib\Config.pm';
print "$podfileb $rootb $1 $2\n" if $podfileb =~ m!$rootb/(.*)/(
+\w+)\.p.+$!i;
# 3: simplified, causes error
#
print "yo\n" if 'perl' =~ m|\perl|;
__END__
It turns out that the problem is related to the recently added regex feature,
mentioned briefly in perlre like so
In addition, Perl defines the following:
...
\pP Match P, named property. Use \p{Prop} for longer names.
\PP Match non-P
Apparently,
m|\perl| means: match a property
named 'e' which might be defined in a script or in the main module - but it is not defined, in my case.
On Win2k you can easily get a pathname containing '\p' or '\P' from a module such as File::Find or Config
print "==$Config{installprefix}==\n"; # prints ==C:\Perl==
The workaround is to replace backslashes by slashes before using such paths in a matching operation
$podfileb =~ s!\\!/!g;
$rootb =~ s!\\!/!g;
However, if a path containing backslashes is being passed between code inside a module,
you might have to dig deeply if you want to fix it.
Questions to wise Monks:
-
Could anyone explain the purpose and use of the Unicode named properties?
-
Could or would anyone recommend a modification to published Perl modules (Config.pm to begin with),
to use '/' as the path separator also on Win32?
AFAIK '/' always works inside Perl code. The only time you have to
use '\' as path separator on Win32 is when you hand the path to a native command shell,
perhaps as an argument to an utility invoked with system() or qx().
-
Are my observations mostly correct, or am I missing anything?
Rudif
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.