PERL2LCOV(1)

NAME
perl2lcov - perl2lcov documentation

Manual section
    1

Manual group
    LCOV Tools

NAME

perl2lcov
    Translate Perl coverage data from Devel::Cover to lcov format

SYNOPSIS

    perl2lcov [--output filename] [--testname name] [options] cover_db+

DESCRIPTION

perl2lcov traverses Perl coverage information in one or more coverage data directories (generated by the Perl Devel::Cover module) and translates it into LCOV .info format.

OPTIONS

In addition to common options supported by other tools in the LCOV suite (e.g., --comment, --version-script, --ignore-error, --substitute, --exclude, etc.), the tool options are:

--output filename, -o filename
    The LCOV data will be written to the specified file. If this option is not used, data is written to perlcov.info in the current directory.

--testname name
    Coverage info will be associated with the testcase name provided. It is not necessary to provide a name.

    See lcov(1) <file://../man/lcov.1.html> and lcovrc(5) <file://../man/lcovrc.5.html> for details of other supported options and configuration settings.

EXAMPLES

Generate Perl coverage data and translate to LCOV format:

    # Write Perl line, branch, condition, and subroutine coverage data
    # to 'myPerlDB' in the current directory
    $ perl -MDevel::Cover=-db,./myPerlDB,-coverage,statement,branch,condition,subroutine,-silent,1 myScript.pl
    # OR: write all coverage types that Perl knows about to 'myPerlDB2'
    # Note that perl2lcov will ignore types it does not understand
    # (pod, time, and path)
    $ perl -MDevel::Cover=-db,./myPerlDB2,-silent,1 myScript.pl
    # Run 'cover' from the Devel::Cover installation to extract runtime
    # data into a usable form. This will also generate an HTML report
    # in 'myCoverDB'
    $ cover myCoverDB -silent 1
    # Run perl2lcov translator to produce LCOV format data:
    $ perl2lcov -o perldata.info [--testname myTestName] myCoverDB
    # Generate an HTML coverage report:
    $ genhtml -o html_report perldata.info

NOTES

The data generated by Devel::Cover is not always internally consistent. For example:

•   Some functions which are never called do not appear in the coverage data.

•   Sometimes a line will appear to be executed (non-zero hit count) but none of its contained branch expressions have been evaluated. (If the line was executed, then at least one branch condition must have been evaluated.)

    This can cause the various tools in the LCOV package to generate errors of type inconsistent.

    In that case, you can:

•   Skip consistency checks entirely: see the skip_consistency_checks section in lcovrc(5) <file://../man/lcovrc.5.html>.

•   Ignore the error: see the --ignore-error section in genhtml(1) <file://../man/genhtml.1.html>.

•   Exclude the offending code: see the --exclude, --filter, and --omit-lines sections in genhtml(1) <file://../man/genhtml.1.html>.

AUTHOR

Henry Cox <<henry.cox@mediatek.com>>

SEE ALSO

lcov(1) <file://../man/lcov.1.html>, genhtml(1) <file://../man/genhtml.1.html>, lcovrc(5) <file://../man/lcovrc.5.html>

•   Devel::Cover module documentation

    <https://metacpan.org/pod/Devel::Cover>

Copyright
2024-2026, LCOV Project