Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Perl syntax checking without `perl -c`

by Anonymous Monk
on Dec 03, 2020 at 13:31 UTC ( [id://11124581]=note: print w/replies, xml ) Need Help??


in reply to Perl syntax checking without `perl -c`

For a really crude workaround, you could hook into the require subsystem to return empty files for missing modules:
# workaround.pm BEGIN { push @INC, sub { my ($self, $filename) = @_; return \"1;"; }; } 1;
$ perl -Mworkaround -MFoo::Bar -E' say "still alive"; ' still alive

Replies are listed 'Best First'.
Re^2: Perl syntax checking without `perl -c`
by hippo (Bishop) on Dec 06, 2020 at 11:59 UTC

    No need to hack it up yourself when there's a module for that: Acme::Anything.


    🦛

Re^2: Perl syntax checking without `perl -c`
by perlfan (Vicar) on Dec 03, 2020 at 18:10 UTC
    This is not "crude" and actually a good solution; that often times you definitely want things to fail if prerequisite modules are not found. And if you're requiring libs over a network mounted drive, you're gonna have a bad time.

      I just can't understand why someone capable of giving such a valuable contribution disguises himself as the Anonymous Monk.

      Greetings,
      -jo

      $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
        Thanks for the kind words! Personally, I just don't like logging in. Websites still allowing anonymous posting (like PerlMonks and the SQLite forum) are like a breeze of fresh air to me. Ironically, I had to log in to post this because I kept getting "Tough beans" otherwise.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11124581]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-26 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found