NAME
Chemistry::Mok - molecular awk interpreter
SYNOPSIS
use Chemistry::Mok;
$code = '/CS/g{ $n++; $l += $match->bond_map(0)->length }
END { printf "Average C-S bond length: %.3f\n", $l/$n; }';
my $mok = Chemistry::Mok->new($code);
$mok->run({ format => mdlmol }, glob("*.mol"));
DESCRIPTION
This module is the engine behind the mok program. See mok(1) for a detailed description of the language.
METHODS
- Chemistry::Mok->new($code, [$package])
-
Compile the code and return a Chemistry::Mok object. If $package is given, the code runs in the Chemistry::Mok::UserCode::$package package instead of the Chemistry::Mok::UserCode::Default package. Specifying a package name is recommended if you have more than one mok object, in order to avoid namespace clashes.
- $mok->run($options, @args)
-
Run the code on the filenames contained in @args. $options is a hash reference with runtime options. Available options:
- mol_class
-
The molecule class used for reading the files. Defaults to Chemistry::Mol.
- format
-
The format used when calling $mol_class->read. If not given, $mol_class->read tries to identify the format automatically.
SEE ALSO
mok(1)
AUTHOR
Ivan Tubert <itub@cpan.org>
COPYRIGHT
Copyright (c) 2004 Ivan Tubert. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.