App-efm_perl

 view release on metacpan or  search on metacpan

script/efm-perl  view on Meta::CPAN


    chdir_to_root($filename);
    my $script = write_tempfile($filename);
    my $runner = create_runner($script, $lib);
    run($runner, $script, $verbose);
    exit 0;
}

main if $0 eq __FILE__;

__END__

=head1 NAME

efm-perl - perl -c executable with errorformat friendly outputs.

=head1 SYNOPSIS

    # load the script from -f option
    efm-perl -f /path/to/script.pl

    # load the script from STDIN but filter out messages by filename from -f option
    cat /tmp/script.pl | efm-perl -f /path/to/script.pl

=head1 OPTIONS

=over 4

=item B<--lib>, B<-I>

Additional paths for C<$PERL5LIB>

=item B<--filename>, B<-f>

Filename to lint. This is mandatory.

=item B<--verbose>, B<-v>

Print out all outputs. Without this, it shows errors only.

=item B<--help>, B<-h>

Print a help message.

=item B<--version>

Show the version string.

=back

=head1 DESCRIPTION

This is a tiny script to use with
L<mattn/efm-langserver|https://github.com/mattn/efm-langserver>. It parses
C<perl -c> outputs and arrange them to errorformat-friendly ones.

For efm-langserver, set config.yaml as below.

    tools:
      efm-perl: &efm-perl
        lint-command: efm-perl -f ${INPUT}
        lint-ignore-exit-code: true
        lint-stdin: true
        lint-formats:
          - '%l:%m'

    languages:
      perl:
        - <<: *efm-perl

efm-perl borrows many ideas from the original
L<efm_perl.pl|https://github.com/vim-perl/vim-perl/blob/dev/tools/efm_perl.pl>.
This has improvements below after that.

=over 4

=item efm-perl can read STDIN.

F<efm_perl.pl> can only read the supplied filename. efm-perl can parse from
STDIN to lint codes on your text editor without saving to disk.

=item efm-perl can deal with plenv & direnv.

It detects the filename and chdir to Git root automatically. Then it setups
L<plenv|https://github.com/tokuhirom/plenv> and
L<direnv|https://github.com/direnv/direnv>, and lint with the desired Perl
version and enviromental variables.

=back

=head1 USAGE

You can install F<efm-perl> with F<cpanm>.

    cpanm install App::efm_perl

Or you can use simply by copying the script.

    cp script/efm-perl /path/to/your/$PATH

=head1 LICENSE

Copyright (C) delphinus.

This library is free software; you can redistribute it and/or modify it under
MIT License.

=head1 AUTHOR

delphinus E<lt>me@delphinus.devE<gt>



( run in 1.307 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )