Chemistry-Mok-0.25/mok

filter: Statementstmt 88.8% 32 / 36 Branchbran 60.0% 6 / 10 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 75.0% 45 / 60 CC 1 SCAR 1.5
CC
1
Cov
78%
usage
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Chemistry/File/FormulaPattern.pm ↑ Summary Chemistry-Mol-0.35/t/File.t »
1 #!/home/ivan/bin/perl
2  
3 # Mok command line interpreter. This is part of the Chemistry::Mok
4 # distribution.
5  
6 8 our $VERSION = '0.25';
7 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 ▶no warnings qw(once);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 8 ▶use Chemistry::Mok;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 8 ▶use Getopt::Std;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 8 $| = 1; # don't buffer stdio
14  
15 8 my %opt;
16 8 getopts('c:f:t:hvbp:dazD3', \%opt);
17 8 ▶usage() if $opt{h};
Branch: 1 branch
BranchTrueFalseTotal
if $opt{"h"} 0 8 8
18  
19 8 my $code;
20 8 ▶if ($opt{f}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt{'f'}) { } 4 4 8
21 4 ▶ open F, "< $opt{f}" or die "Couldn't read $opt{f}\n";
Branch: 1 branch
BranchTrueFalseTotal
open F, qq[< $opt{"f"}] or die qq[Couldn't read $opt{"f"}\n] 4 0 4
22 4 {local $/; $code = <F>;}
23 4 close F;
24 } else {
25 4 ▶ $code = shift || usage();
Condition33%1/3
shift @ARGV || usage()
l!l&&r!l&&!r
400
MC/DC0%0/2
shift @ARGV || usage()
shift @ARGV usage()
Truth table33%1/3
A || B
A= shift @ARGVB= usage()
ABresult
1X1
011
000
26 }
27  
28 8 my @files = @ARGV;
29 8 ▶if ($^O eq 'MSWin32') { # do our own globbing under Windows
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32") 0 8 8
30 0 @files = map glob, @files;
31 }
32  
33 8 ▶$Chemistry::Mok::DEBUG = 1 if $opt{D};
Branch: 1 branch
BranchTrueFalseTotal
if $opt{"D"} 0 8 8
34 my $mok = Chemistry::Mok->new($code,
35 8 ▶ pattern_format => $opt{p} || 'smarts',
Condition50%1/2
$opt{'p'} || 'smarts'
l!l
08
MC/DC0%0/1
$opt{'p'} || 'smarts'
$opt{'p'}
Truth table50%1/2
A
A= $opt{'p'}
Aresult
11
00
36 );
37  
38  
39 $mok->run(
40 {
41 mol_class => $opt{c},
42 format => $opt{t},
43 find_bonds => $opt{b},
44 delete_dummies => $opt{d},
45 aromatize => $opt{a},
46 0 build_3d => $opt{3},
47 },
48 @files
49 );
50  
51 0 ▶sub usage {
Subroutine usage: not called CC=1 SCAR=6.9
52 0 print <<EOF;
53 mok version $VERSION
54 Usage: $0 [OPTION]... 'CODE' FILE...
55 Read each molecular file and run CODE on each. Options:
56 -3 generate 3D coordinates using Chemistry::3DBuilder
57 -a "aromatize" each molecule as it is read
58 -b find bonds from 3D coordinates
59 -c CLASS use CLASS instead of Chemistry::Mol to read molecules
60 -D print debugging information (very verbose)
61 -d delete dummy atoms after reading each molecule
62 -f FILE run the code from FILE instead of the command line
63 -h this help
64 -p TYPE parse patterns using the specified TYPE. Default: 'smarts'
65 -t TYPE assume that every file has the specified TYPE
66 EOF
67 0 exit;
68 }
69  
70 __END__
« blib/lib/Chemistry/File/FormulaPattern.pm ↑ Summary Chemistry-Mol-0.35/t/File.t »