NAME
Perl::Metrics::Halstead - Compute Halstead complexity metrics
VERSION
version 0.0100
SYNOPSIS
use Perl::Metrics::Halstead;
my $pmh = Perl::Metrics::Halstead->new(file => '/some/perl/code.pl');
printf "Total operators = %d, Total operands = %d\n", $pmh->n_operators, $pmh->n_operands;
printf "Distinct operators = %d, Distinct operands = %d\n", $pmh->n_distinct_operators, $pmh->n_distinct_operands;
printf "Program vocabulary = %d, Program length = %d\n", $pmh->prog_vocab, $pmh->prog_length;
printf "Estimated program length = %.3f\n", $pmh->est_prog_length;
printf "Program volume = %.3f\n", $pmh->volume;
printf "Program difficulty = %.3f\n", $pmh->difficulty;
printf "Program level = %.3f\n", $pmh->level;
printf "Program effort = %.3f\n", $pmh->effort;
printf "Time to program = %.3f\n", $pmh->time_to_program;
printf "Delivered bugs = %.3f\n", $pmh->delivered_bugs;
DESCRIPTION
Perl::Metrics::Halstead
computes Halstead complexity metrics.
ATTRIBUTES
file
$file = $pmh->file;
The file to analyze. This is a required attribute.
n_operators
$n_operators = $pmh->n_operators;
The total number of operators. This is a computed attribute.
n_operands
$n_operands = $pmh->n_operands;
The total number of operators. This is a computed attribute.
n_distinct_operators
$n_distinct_operators = $pmh->n_distinct_operators;
The number of distinct operators. This is a computed attribute.
n_distinct_operands
$n_distinct_operands = $pmh->n_distinct_operands;
The number of distinct operators. This is a computed attribute.
prog_vocab
$prog_vocab = $pmh->prog_vocab;
The program vocabulary. This is a computed attribute.
prog_length
$prog_length = $pmh->prog_length;
The program length. This is a computed attribute.
est_prog_length
$est_prog_length = $pmh->est_prog_length;
The estimated program length. This is a computed attribute.
volume
$volume = $pmh->volume;
The program volume. This is a computed attribute.
difficulty
$difficulty = $pmh->difficulty;
The program difficulty. This is a computed attribute.
level
$level = $pmh->level;
The program level. This is a computed attribute.
effort
$effort = $pmh->effort;
The program effort. This is a computed attribute.
time_to_program
$time_to_program = $pmh->time_to_program;
The time to program. This is a computed attribute.
delivered_bugs
$delivered_bugs = $pmh->delivered_bugs;
Delivered bugs. This is a computed attribute.
METHODS
new()
$pmh = Perl::Metrics::Halstead->new(file => $file);
Create a new Perl::Metrics::Halstead
object given the file argument.
BUILD()
Process the given file into the computed metrics.
SEE ALSO
https://en.wikipedia.org/wiki/Halstead_complexity_measures
https://www.verifysoft.com/en_halstead_metrics.html
AUTHOR
Gene Boggs <gene@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019 by Gene Boggs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.