-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
# Copyright (C) 2007-2009 Martin A. Hansen.
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+use warnings;
use strict;
use Maasha::Biopieces;
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-my ( $run_time_beg, $run_time_end, $options, $in, $out, @keys, $key, @sort_cmd, $sort_str, $sort_sub, @records, $record, $i );
+my ( $options, $in, $out, @keys, $key, @sort_cmd, $sort_str, $sort_sub, @records, $record, $i, $ok );
$options = Maasha::Biopieces::parse_options(
[
$sort_str = join " or ", @sort_cmd;
$sort_sub = eval "sub { $sort_str }"; # NB security issue!
-while ( $record = Maasha::Biopieces::get_record( $in ) ) {
- push @records, $record;
+while ( $record = Maasha::Biopieces::get_record( $in ) )
+{
+ $ok = 1;
+ foreach $key ( @{ $options->{ "keys" } } )
+ {
+ if ( not exists $record->{ $key } )
+ {
+ $ok = 0;
+ last;
+ }
+ }
+
+ push @records, $record if $ok;
}
@records = sort $sort_sub @records;
}
}
+Maasha::Biopieces::close_stream( $in );
+Maasha::Biopieces::close_stream( $out );
+
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
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__
-