NAME
Devel::CoverX::Covered::Db - Covered database collection and reporting
DESCRIPTION
Error handling model
Failures will result in a die.
PROPERTIES
dir
The directory for the cover_db.
db
DBIx::Simple $db object. Created lazily under "dir".
report_file
Subref called for each $file processed, $report_file->($file).
rex_skip_calling_file
Regex matching test files to skip.
Default: matches prove and prove.bat
rex_skip_source_file
Array ref with Regexes matching source files to skip.
Default: []
METHODS
connect_to_db() : DBIx::Simple $db
Connect to the covered db and return the new DBIx::Simple object.
If there is no db at all, create it first.
create_db($db_file) : DBIx::Simple $db
Create $db_file with the correct schema.
Return newly created DBIx::Simple $db object.
schema_version() : $version_string
Return a version number of the schema.
Update this manually whenever the schema changes.
in_transaction($subref) : $ret
Run $subref->() in a transaction and return the return value of $subref in scalar context.
If anything dies inside $subref, roll back and rethrow exception.
collect_runs() : 1
Collect coverage statistics for test runs in "dir".
get_run_dirs() : @dirs
Return list of directories for test runs under the "dir".
collect_run($cover_db) : 1 | 0
Collect coverage statistics for the test run Devel::Cover::DB $cover_db.
Don't collect coverage for eval (-e), nor for any test file matching rex_skip_calling_file.
Return 1 if the test run was collected, else 0.
calling_file_name($cover_db) : $calling_file_name | ""
Extract the $calling_file_name from $cover_db and return it.
Return "" if it's not a suitable calling file, or the callinging file is on the skip list. Warn with specifics.
is_calling_file_name_valid($file_name) : 1 | 0
Return 1 if $file_name is a valid calling file name, else 0.
It may be invalid because of unsuitability, or because it was skipped.
is_source_file_name_valid($file_name) : 1 | 0
Return 1 if $file_name is a valid source file name, else 0.
It may be invalid because of unsuitability, or because it was skipped.
reset_calling_file($calling_file_name) : 1
Clear out the stored data related to $calling_file_name.
report_metric_coverage(metric_type, calling_file, covered_file, covered_row, covered_sub_name, metric) : 1
Report the coverage metric defined by the parameters.
Make all file paths relative to "dir" if possible.
get_file_id($file_name) : $file_id
Return the db id of the table "file" row for $file_name. Create a new row if missing.
Memoized.
Return the new or existing $file_id.
get_metric_type_id($metric_type) : $metric_type_id
Return the db id of the table "metric_type" row for $metric_type. Create a new row if missing.
Memoized.
Return the new or existing $metric_type_id.
get_lookup_table_id($table_name, $id_column_name, $value_column_name, $lookup_table_value) : $lookup_table_id
Return the db id in $id_column_name of the $table_name row for $lookup_table_value.
Create a new row if missing.
Return the new or existing $lookup_table_id.
test_files_covering($source_file_name, [$sub]) : @test_file_names
Return list of test files that cover any line in $source_file_name. Or if $sub is passed, limit to test files covering that sub.
test_files() : @test_file_names
Return list of test files in the db.
source_files_covered_by($test_file_name) : @source_file_names
Return list of source files that are covered by $test_file_name.
covered_files() : @source_file_names
Return list of source files in the db.
covered_subs($source_file_name) : @array_refs_sub_count
Return list of array refs [ $sub_name, $coverate_count ] with the subs in $source_file_name, and the accumulated coverage count for any test files covering it.
relative_file($file) : Path::Class::File $relative_file
Return $file relative to cover_db/.. if possible, otherwise just return $file.