简体   繁体   中英

Cpan Install - No Bareword Allowed (windows)

I've inherited a project in Perl - an environment I know very little about. Nobody else knows anything about it either and nobody knows how to even get it running natively. So the project is developed by using a cloned VM of the AWS instance, and I'm getting fed up at keeping things in sync between the VM and my local machine. So I'm trying to get the project to run on Windows.

I have installed Strawberry Perl.

There is a cpanfile that contains:

Docker/cpanfile;
requires 'Time::Piece';
requires 'File::Slurp';

And Docker/cpanfile contains:

requires 'Time::Format';
requires 'Carton';
requires 'curry';
requires 'IO::Socket::SSL', '2.009';
requires 'Mojolicious', '8.40';
requires 'JSON::MaybeXS';
requires 'Mojo::mysql';
requires 'DateTime';
requires 'Mojo::JSON';
requires 'Data::Dumper';
requires 'Data::Dumper::Compact';
requires 'Data::Dump';
requires 'Mojo::UserAgent';
requires 'Storable';
requires 'DateTime::Format::ISO8601';
requires 'DateTime::Format::ISO8601::Format';
requires 'DateTime::Format::MySQL';
requires 'Mojolicious::Plugin::OAuth2';
requires 'Mojolicious::Plugin::OpenAPI';
requires 'Mojo::JWT';
requires 'File::Slurper';
requires 'Text::Table';
requires 'DateTime::Span';
requires 'Data::Format::Pretty::Console';
requires 'WebService::GoogleAPI::Client';
requires 'Email::Sender::Simple';
requires 'Email::Stuffer';
requires 'MIME::Base64::URLSafe';
requires 'Crypt::PBKDF2';
requires 'Try::Tiny';
requires 'Date::Calc::Iterator';
requires 'Mojolicious::Plugin::PODViewer';
requires 'Term::ProgressBar';
requires 'List::Util';
requires 'Data::Printer';
requires 'Mojolicious::Plugin::OAuth2';
requires 'Excel::Writer::XLSX';
requires 'Text::Table::Any';
requires 'PDF::API2';
requires 'GD';
requires 'Text::Table::HTML';
requires 'String::Interpolate';
requires 'MIME::Base64';
requires 'Algorithm::Permute';
requires 'Time::HiRes';
requires 'Benchmark::Object';
requires 'Devel::Size';
requires 'Set::Scalar';
requires 'Mojolicious::Plugin::WriteExcel';
requires 'Array::Utils';
requires 'Mojolicious::Plugin::RenderFile';
requires 'Test::mysqld';
requires 'Getopt::Long';
requires 'Mojolicious::Plugin::Minion';
requires 'Minion::Backend::mysql';
requires 'Mojolicious::Plugin::Minion::Admin';
requires 'HTTP::UA::Parser';
requires 'TAP::Formatter::HTML';
requires 'App::Yath';

Looks fairly basic to me. Yet running cpanm --installdeps in git bash yields:

Configuring /c/sites/ProjectName... FAIL
! Parsing cpanfile failed: Bareword "Docker" not allowed while "strict subs" in use at cpanfile line 1.
Bareword "cpanfile" not allowed while "strict subs" in use at cpanfile line 1.
! Configuring . failed. See /c/Users/joshd/.cpanm/work/1657148855.2012/build.log for details.

So do I have to disable strictness of some sort? Or is there something I should be changing. Also despite the "Docker" reference, there is not a Docker Image and the docker file is I think years out of date so I don't think that's a way to go.

Docker/cpanfile; divides Docker by cpanfile and discards the result. That's not very useful. That's not very correct. Silencing the error message is not the correct approach.

I think you want

use FindBin qw( $RealBin );
do( "$RealBin/Docker/cpanfile" )
   or die( $@ // $! );

cpanfile is roughly Perl code (which I think is a bad idea, but people were really into what they thought were DSLs). There is some sanity checking, but at some point someone is going to figure out something clever to use it as an attack vector to run arbitrary code.

Not that I have an alternative, but it is something that I've been thinking a lot about lately.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM