[Melbourne-pm] Bareword found where operator expected

Sam Watkins sam at nipl.net
Sun Feb 16 22:57:52 PST 2014


I don't know what your /u 
u modifier is meant to be, but it doesn't work for me and causes that
error in perl v5.10.

So I guess that 'u' modifier is your problem.

Sam

On Mon, Feb 17, 2014 at 11:40:34AM +1100, Gary Smith wrote:
> Hi All,
> 
> I'm seeing an error in a file here but I think it may be related to
> the development environment rather than the file. The reason I say
> that is because the error only occurs in the environment that I have
> created (with perlbrew) for myself. The production environment
> doesn't exhibit the same error and I also use this same code on a
> Debian VM without issue.
> 
> Perl version is 5.16.3
> 
> The environment is Catalyst/Pg/Starman.
> 
> Here is the error output:
> 
> Bareword found where operator expected at
> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^
> \s* ( [\s\d\w]{3,} ) \s* $/ux"
>         (Missing operator before ux?)
> Error while loading /home/gary/myapp/myapp.psgi: syntax error at
> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 59, near "/^
> \s* ( [\s\d\w]{3,} ) \s* $/ux"
> Can't use global $1 in "my" at
> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 60, near "= $1"
> BEGIN not safe after errors--compilation aborted at
> /home/gary/myapp/lib/myapp/Controller/Lookup.pm line 73.
> Compilation failed in require at
> /home/gary/perl5/lib/perl5/Catalyst/Utils.pm line 308.
> Compilation failed in require at /home/gary/myapp/myapp.psgi line 4.
> BEGIN failed--compilation aborted at /home/gary/myapp/myapp.psgi line 4.
> 
> 
> Here is the relevant code lines 59 & 60 in Lookup.pm:
> 
>         if ($c->request->params->{$field} =~ /^ \s* ( [\s\d\w]{3,} )
> \s* $/ux) {
>             my $value = $1;
> 
> 
> I know that the code is fine as it has been working fine for many
> months and still works fine on the production and Debian servers. I
> don't know what in my environment would cause the error. It appears
> to be saying that it doesn't like the regex, but there doesn't
> appear to be any syntax issues there.
> 
> Regards,
> 
> Gary

> _______________________________________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://mail.pm.org/mailman/listinfo/melbourne-pm



More information about the Melbourne-pm mailing list