Ragged Robin has asked for the wisdom of the Perl Monks concerning the following question:

Hey guys, I'm a perl newb but I'm pretty baffled at this issue. I'm currently running Perl 5.18.1 on a NAS and have lvalue.pm installed at a custom location at: /var/services/web/debug/lib/Class/Accessor/ However compiling my .cgi I get a syntax error with it:
Software error: syntax error at /var/services/web/debug/lib/Class/Accessor/Lvalue.pm l +ine 21, near "want 'LVALUE'" syntax error at /var/services/web/debug/lib/Class/Accessor/Lvalue.pm l +ine 27, near "tie" Can't use global @_ in "my" at /var/services/web/debug/lib/Class/Acces +sor/Lvalue.pm line 27, near ", @_" syntax error at /var/services/web/debug/lib/Class/Accessor/Lvalue.pm l +ine 30, near "}" Can't use global @_ in "my" at /var/services/web/debug/lib/Class/Acces +sor/Lvalue.pm line 33, near "= @_" syntax error at /var/services/web/debug/lib/Class/Accessor/Lvalue.pm l +ine 36, near "want 'LVALUE'" syntax error at /var/services/web/debug/lib/Class/Accessor/Lvalue.pm l +ine 42, near "tie" Can't use global @_ in "my" at /var/services/web/debug/lib/Class/Acces +sor/Lvalue.pm line 42, near ", @_" syntax error at /var/services/web/debug/lib/Class/Accessor/Lvalue.pm l +ine 44, near "}" Compilation failed in require at /var/services/web/debug/cgi-bin/debug +display.cgi line 18. BEGIN failed--compilation aborted at /var/services/web/debug/cgi-bin/d +ebugdisplay.cgi line 18.
When I pass this with the perl test I get:
TARDIS> perl -c -e "test Class::Accessor::Lvalue" -e syntax OK
Not sure how this makes any sense at all, I downloaded the lvalue module straight from the CPAN website (I had to manually install).

Replies are listed 'Best First'.
Re: Syntax Error in lvalue.pm?
by arkturuz (Curate) on Sep 23, 2014 at 18:08 UTC
    perl -c -e "test Class::Accessor::Lvalue"

    This will test if your program will compile. It will not include Class::Accessor::Lvalue in your code snippet. To test that you should try

    perl -MClass::Accessor::Lvalue -e 1

    If there's no error then everything is OK.

    Not sure how this makes any sense at all, I downloaded the lvalue module straight from the CPAN website (I had to manually install).

    Why did you do manual install? There might be your problem.
    You should use cpan client to do the whole process for you. I recommend App::cpanminus. System default CPAN is also OK, but it's slightly slower. Also, if this doesn't work for you, try your system-specific package installer.

Re: Syntax Error in Lvalue.pm?
by toolic (Bishop) on Sep 23, 2014 at 18:01 UTC
    From the looks of it, Class::Accessor and Lvalue are two separate CPAN modules. My guess is that you don't want Lvalue.pm under the Class/Accessor directory. You probably want Lvalue.pm under /var/services/web/debug/lib

    By the way, I'm not sure if your test is doing anything useful:

    perl -c -e "test Class::Accessor::fooooooooooo" -e syntax OK
Re: Syntax Error in lvalue.pm?
by tobyink (Canon) on Sep 23, 2014 at 21:28 UTC

    Class::Accessor::Lvalue uses Want which is partly written in C, and thus requires compilation. Use a CPAN client to install it, and all the dependencies will be automatically downloaded and installed.

    Manually downloading and installing modules is enough of a bother than most Perl experts rarely attempt it. Just use a CPAN client.