Mason Perl syntax checking

Is there a way to check perl mason syntax on command line? I know that for regular perl modules you can just use perl -c, but this gives rise to errors for mason-specific syntax like docstrings etc ...

For instance:

<%doc>
DOCUMENTATION SHOULD NOT GET PARSED
</%doc>

<%args>
$args
</%args>

<%perl>
my $var = $args->{var};
</%perl>

is a valid perl mason file, but works perl -cagainst it:

Semicolon seems to be missing at path/to/file.mc line 1.
syntax error at path/to/file.mc line 2, near "DOCUMENTATION S"
path/to/file.mc had compilation errors.
+4
source share
1 answer

I looked at Mason, the first thing I see is Mason :: App / mason.pl

$ mason junk.mason
Invalid attribute line '$args' at ./junk.mason line 6

? , , , Mason::Interp, load (),

, undef, . , - .

, Mason:: App ,

#!/usr/bin/perl --
use strict; use warnings; use Mason;
my $interp = Mason->new(
    comp_root => '/path/to/comps',
    data_dir  => '/path/to/data',
    ...
);
$interp->load( shift );
+8

All Articles