-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
# Copyright (C) 2007-2009 Martin A. Hansen.
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+use warnings;
use strict;
+use Data::Dumper;
use Maasha::Biopieces;
use Maasha::Common;
use Maasha::Patscan;
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-my ( $run_time_beg, $run_time_end, $options, $in, $out, $record, $keys, $vals_only, $keys_only, $invert,
+my ( $options, $in, $out, $record, $keys, $vals_only, $keys_only, $invert,
$patterns, $regex, %lookup_hash, $key, $op, $val, $found );
$options = Maasha::Biopieces::parse_options(
}
}
+Maasha::Biopieces::close_stream( $in );
+Maasha::Biopieces::close_stream( $out );
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SUBROUTINES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# Returns boolean.
- my ( $pattern );
+ my ( $pattern, $key );
foreach $pattern ( @{ $patterns } )
{
if ( $keys )
{
- map { return 1 if index( $record->{ $_ }, $pattern ) >= 0 } @{ $keys };
+ foreach $key ( @{ $keys } )
+ {
+ return 0 if not exists $record->{ $key };
+ return 1 if index( $record->{ $key }, $pattern ) >= 0;
+ }
}
else
{
if ( $keys )
{
- map { return 1 if $record->{ $_ } =~ /$regex/ } @{ $keys };
+ map { return 1 if exists $record->{ $_ } and $record->{ $_ } =~ /$regex/ } @{ $keys };
}
else
{
BEGIN
{
- $run_time_beg = Maasha::Biopieces::run_time();
-
- Maasha::Biopieces::log_biopiece();
+ Maasha::Biopieces::status_set();
}
END
{
- Maasha::Biopieces::close_stream( $in );
- Maasha::Biopieces::close_stream( $out );
-
- $run_time_end = Maasha::Biopieces::run_time();
-
- Maasha::Biopieces::run_time_print( $run_time_beg, $run_time_end, $options );
+ Maasha::Biopieces::status_log();
}
__END__
-