Need to move the Deobfuscator to a separate directory, as this collides
[bioperl-live.git] / deobfuscator / Deobfuscator / cgi-bin / deob_detail.cgi
blob301c60d0d35a8fc8af762d874d71b42e0b5c5ef1
1 #!/usr/bin/perl -w
3 # Deob_detail.cgi
4 # part of the Deobfuscator package
5 # by Laura Kavanaugh and Dave Messina
7 # cared for by Dave Messina <dave-pause@davemessina.net>
9 # POD documentation - main docs before the code
11 =head1 NAME
13 deob_detail.cgi - displays a web page of detailed information about a BioPerl method
15 =head1 VERSION
17 This document describes deob_detail.cgi version 0.0.3
20 =head1 SYNOPSIS
22 This program is designed to be called by deob_interface.cgi. See
23 L</"DESCRIPTION"> for details.
25 To install deob_detail.cgi and the rest of the Deobfuscator package, see the
26 README.
29 =head1 DESCRIPTION
31 Deob_detail.cgi is called by deob_interface.cgi when a user clicks on a
32 method name. This program extracts the documentation about that method from
33 the Deobfuscator Berkeley DBs and returns it in some simple HTML formatting.
36 =head1 DIAGNOSTICS
38 None.
41 =head1 CONFIGURATION AND ENVIRONMENT
43 This program expects to have the 'methods.db' and 'packages.db' files in the
44 same directory as itself. These two files are automatically generated when
45 L<deob_index.pl> is run. If your installation requires that they be in a
46 different location, change the $BerkeleyDB_packages and $BerkeleyDB_methods
47 variables below to be fully qualified paths to the db files.
50 =head1 DEPENDENCIES
52 L<version>, L<CGI>, L<Deobfuscator>
55 =head1 INCOMPATIBILITIES
57 None reported.
60 =head1 BUGS AND LIMITATIONS
62 No bugs have been reported.
65 =head1 FEEDBACK
67 =head2 Mailing Lists
69 User feedback is an integral part of the evolution of this and other
70 Bioperl modules. Send your comments and suggestions preferably to one
71 of the Bioperl mailing lists. Your participation is much appreciated.
73 bioperl-l@bioperl.org - General discussion
74 http://www.bioperl.org/wiki/Mailing_lists - About the mailing lists
76 =head2 Reporting Bugs
78 Report bugs to the Bioperl bug tracking system to help us keep track
79 the bugs and their resolution. Bug reports can be submitted via the
80 web:
82 http://bugzilla.bioperl.org/
85 =head1 SEE ALSO
87 L<Deobfuscator>, L<deob_interface.cgi>, L<deob_index.pl>
90 =head1 AUTHOR
92 Laura Kavanaugh
95 =head1 CONTRIBUTORS
97 =over
99 =item Dave Messina C<< <dave-pause@davemessina.net> >>
101 =item David Curiel
103 =back
106 =head1 ACKNOWLEDGMENTS
108 This software was developed originally at the Cold Spring Harbor Laboratory's
109 Advanced Bioinformatics Course between Oct 12-25, 2005. Many thanks to David
110 Curiel, who provided much-needed guidance and assistance on this project.
113 =head1 LICENSE AND COPYRIGHT
115 Copyright (C) 2005-6 Laura Kavanaugh and Dave Messina. All Rights Reserved.
117 This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself. See L<perlartistic>.
120 =head1 DISCLAIMER
122 This software is provided "as is" without warranty of any kind.
124 =cut
127 # Let the code begin...
129 ## HARDCODED VALUES ##
130 # Change these to fit your installation.
131 use lib './lib';
132 my $BerkeleyDB_packages = './packages.db';
133 my $BerkeleyDB_methods = './methods.db';
135 ## You shouldn't need to change anything below here ##
137 use version; $VERSION = qv('0.0.2');
138 use warnings;
139 use strict;
140 use CGI ':standard';
141 use Deobfuscator;
143 # Open BerkeleyDBs
144 my $packages_ref = Deobfuscator::open_db($BerkeleyDB_packages);
145 my $methods_ref = Deobfuscator::open_db($BerkeleyDB_methods);
147 # 'method' is the name of the method passed in from deob_interface.cgi
148 my $class_method = param('method');
150 # Get all of the documentation fields out of the db
151 my $title
152 = Deobfuscator::get_method_docs( $methods_ref, $class_method, "title" );
153 if ( $title eq "0" ) { $title = "not documented"; }
155 my $usage
156 = Deobfuscator::get_method_docs( $methods_ref, $class_method, "usage" );
157 if ( $usage eq "0" ) { $usage = "not documented"; }
159 my $function = Deobfuscator::get_method_docs( $methods_ref, $class_method,
160 "function" );
161 if ( $function eq "0" ) { $function = "not documented"; }
163 my $returns
164 = Deobfuscator::get_method_docs( $methods_ref, $class_method, "returns" );
165 if ( $returns eq "0" ) { $returns = "not documented"; }
167 my $args
168 = Deobfuscator::get_method_docs( $methods_ref, $class_method, "args" );
169 if ( $args eq "0" ) { $args = "not documented"; }
171 ### Make the output page
173 # Start the page
174 print header;
175 print start_html($class_method);
177 # Define some styles
178 my $style1
179 = qq{style="border-collapse:collapse;border:solid black 1px;font-family:verdana;font-size:10px;background-color:lightgrey"};
180 my $style2
181 = qq{style="border-collapse:collapse;border:solid black 1px;font-family:verdana;font-size:10px"};
182 my $style3
183 = qq{style="border-collapse:collapse;border:solid black 1px;font-family:verdana;font-size:14px"};
185 # open the table
186 print '<div style="border:solid black 1px; width:100%; height:200; overflow:auto">';
187 print '<table width="100%" $style3>';
188 print "<tr><td colspan=4><center>$class_method</center></td></tr>";
190 my @sections = ('Usage', 'Function', 'Returns', 'Args');
191 my $sec_ndx = 0;
193 foreach my $section ($usage, $function, $returns, $args) {
195 my $section_html = Deobfuscator::htmlify($section);
196 print "<tr><td $style1>$sections[$sec_ndx++]</td><td $style2>$section_html</td></tr>\n";
199 # close the table
200 print "</table></div>";
202 # finish the page
203 print end_html;
205 # close BerkeleyDB
206 Deobfuscator::close_db($BerkeleyDB_packages);
207 Deobfuscator::close_db($BerkeleyDB_methods);
209 __END__