BioPerl
view release on metacpan or search on metacpan
deobfuscator/Deobfuscator/cgi-bin/deob_interface.cgi view on Meta::CPAN
Advanced Bioinformatics Course between Oct 12-25, 2005. Many thanks to David
Curiel, who provided much-needed guidance and assistance on this project. Also, special thanks to Todd Wylie for his help with CGI.
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2005-6 Laura Kavanaugh and Dave Messina. All Rights Reserved.
You may use modify or redistribute this software under the same terms as
Perl itself.
=head1 DISCLAIMER
This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself. See L<perlartistic>.
=cut
# Let the code begin...
## SET HARDCODED VALUES HERE ##
use lib './lib';
my $PERLMODULES = 'package_list.txt';
my $BerkeleyDB_packages = 'packages.db';
my $BerkeleyDB_methods = 'methods.db';
my $help_path = 'deob_help.html';
my $deob_detail_path = 'deob_detail.cgi';
## You shouldn't need to change anything below here ##
use version; $VERSION = qv('0.0.2');
use warnings;
use strict;
use CGI ':standard';
use Deobfuscator;
my @available_modules;
my $sort_method;
my $ref_Class_hash;
my $filter;
my $search;
my $sort_order;
my $pattern_found = 0;
my @all_modules;
my $ref_BerkeleyDB_packages;
my $ref_BerkeleyDB_methods;
my $ref_sorted_keys;
# if user previously set the sort order, we can send it with the first form
$sort_order = param('sort_order') ? param('sort_order') : 'by method';
# define some styles
my $style1
= qq{style="border-collapse:collapse;border:solid black 1px;font-family:verdana;font-size:10px;background-color:lightgrey;padding:3"};
my $style2
= qq{style="border-collapse:collapse;border:solid black 1px;font-family:verdana;font-size:10px;padding:3"};
my $style3
= qq{style="border-collapse:collapse;border:solid black 1px;font-family:verdana;font-size:14px;padding:3"};
my $style4
= qq{style="border-collapse:collapse;border:0px;font-family:verdana;font-size:18px;font-weight:bold;padding:3"};
my $style5 = qq{style="font-family:verdana;font-size:14px;padding:3"};
# Open file containing all Bioperl package names
open my $MODS, '<', $PERLMODULES
or die "Could not read list of Perl module names '$PERLMODULES': $!\n";
# Open BerkeleyDB by getting hash references
$ref_BerkeleyDB_packages = Deobfuscator::open_db($BerkeleyDB_packages);
$ref_BerkeleyDB_methods = Deobfuscator::open_db($BerkeleyDB_methods);
# Grab input and remove whitespace
my $pattern = param('search_string') ? param('search_string') : ' ';
$pattern =~ s/\s//g;
# Filter file names with user search string if one has been entered
while (<$MODS>) {
if (/\S+/) { # capture list of all module names in case there are no
# matches found to user input string
push @all_modules, $_;
}
if ($pattern) {
if (/$pattern/i) {
push @available_modules, $_;
$pattern_found = 1;
}
}
else {
if (/\S+/) {
push @available_modules, $_;
}
}
}
if ( scalar @available_modules < 1 ) {
@available_modules = @all_modules;
}
close $MODS or die "Could not close list of Perl module names $PERLMODULES: $!\n";
# grab BioPerl version string
my $version_string = '__BioPerl_Version'; # specified in deob_index.pl
my $BioPerl_version = $ref_BerkeleyDB_packages->{$version_string};
print header;
print <<CSHL;
<html>
<head>
<title>BioPerl Deobfuscator</title>
<script language="JavaScript">
function submitMe(packageName) {
searchForm.module.value=packageName;
searchForm.Search.value='Search';
searchForm.submit();
return true;
}
</script>
</head>
<body $style5>
<div style="border:solid black 1px; width:100%; overflow:auto">
( run in 0.831 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )