CAD-Firemen
view release on metacpan or search on metacpan
bin/fm_create_help view on Meta::CPAN
}
}
}
if($i % 10 == 0){
if(!$dbh->commit()){
$errorString = "Could not commit changes";
last;
}
}
$i++;
$progress->update($i);
}
# finish commit (if at last item $i % 10 is not 0)
$dbh->commit();
if($i < $max){
$progress->update($max);
}
if($errorString ne ""){
testFailed("Creating database");
if($verbose > 0){
print $errorString ."\n";
}
exit 1;
}
}
# print some statistics
if($verbose > 0){
my $countOptions = scalar(keys(%cdbOptions));
# do not count all those options, which have -Fs as value
my $ignoredFs = 0;
# we use the first entry here, because in CDB file, all options should be
# only there one time
foreach my $opt (keys(%cdbOptions)){
my @keys = keys(%{$cdbOptions{$opt}});
if(scalar(@keys) > 0){
foreach my $value (keys(%{$cdbOptions{$opt}->{$keys[0]}})){
if($value eq "( -Fs )"){
$ignoredFs++;
last;
}
}
}
}
my $countOptionsDefaultValues = $countOptions - $ignoredFs;
print "\n\n";
print "Statistics:\n";
my %statistics = ();
$statistics{"Options in cdb"} = buildStatistic("Options in cdb", $countOptions, $countOptions);
$statistics{"Options in Help"} = buildStatistic("Options in Help", $foundOptionsInHelp, $countOptions);
$statistics{"Default values"} = buildStatistic("Default values", scalar(keys(%optionsDefault)), $countOptionsDefaultValues);
$statistics{"Descriptions"} = buildStatistic("Descriptions", scalar(keys(%optionsInfo)), $countOptions);
my $maxLen = maxLength(keys(%statistics)) + 2;
foreach my $stat (keys(%statistics)){
print sprintf("%-". $maxLen ."s", $stat) . $statistics{$stat} ."\n";
}
print "Ignored ". $ignoredFs ." Options with value -Fs to calculate percentage of Default values\n";
}
END {
if(defined($dbh) && ($dbh != 0) && !$dbh->disconnect){
print "Could not disconnect from database!\n";
print "Error: ". $DBI::errstr;
exit 1;
}
}
exit 0;
__END__
=pod
=head1 NAME
fm_create_help - Walks through an installation and tries to extract all options with informations into a database
=head1 VERSION
version 0.7.2
=head1 SYNOPSIS
fm_create_help [options] [PATH_TO_INSTALLATION]
Options:
--help -? Prints this help.
--version Prints current version.
--verbose -v The verbose level. 0 - least output, 2 most output (Default: 0).
--output -o Optional filepath to store the created data.
--locale -l The locale which should be used (Default en_US).
--crossfire -c Store the output in the format of Crossfire. Set file with --output.
--notepad -n Create some Notepad++ help files. Set directory with --output.
If no PATH_TO_INSTALLATION is given, it tries to figure out the correct path with help of $ENV{PATH}.
Example:
fm_create_help
=head1 DESCRIPTION
This script parses a option database (cdb file) and afterwards, it tries
to collect more information with help of the delivered html help. The collected
data is stored in an SQLite Database afterwards. The structure is as shown below.
|==========================|
| options_has_values |
|==========================|
|==========================| | id INTEGER, PRIMARY KEY |
| options | |--------------------------|
|==========================| |---------->| optionsId INTEGER |
| id INTEGER, PRIMARY KEY | ---------| |--------------------------|
|--------------------------| |---->| valuesId INTEGER |
| name VARCHAR(250) | | |==========================|
|--------------------------| |
( run in 0.934 second using v1.01-cache-2.11-cpan-39bf76dae61 )