From: Robert Lupton the Good <rhl@astro.Princeton.EDU>
To: help-gnats@gnu.org
Subject: Patch for gnatsweb.pl
Date: Thu, 26 Sep 2002 15:46:00 -0000 [thread overview]
Message-ID: <15763.3490.841076.988437@wire7.Princeton.EDU> (raw)
In-Reply-To: <20020925181413.GA1154909@cluster2.netman.dk>
Here's a patch to help debug things (my patch.7).
It allows the user to define a callback to print debugging
information, specifically to add a "Debug" button to the gnats
menubar. It's up to gnatsweb-site.pl what to do with this,
but I use it to print the state of the server with a callback like:
elsif ($reason eq 'cmd')
{
# Handle site-specific values for 'cmd' param.
my $cmd = shift(@args);
if ($cmd eq 'debug') {
if(!@args) {
print_header();
initialize();
print "global_prefs:\n<DL>";
foreach (sort keys %global_prefs) {
print "<DT>$_\n<DD>\"$global_prefs{$_}\"\n";
}
print "</DL>\n";
print "db_prefs:\n<DL>";
foreach (sort keys %db_prefs) {
print "<DT>$_\n<DD>\"$db_prefs{$_}\"\n";
}
print "</DL>\n";
print "<PRE>";
debug_print_all_cookies(\*STDOUT);
print "</PRE>";
}
return 1;
...
I also changed debug_print_all_cookies() to optinally take a file
handle (the default's still STDERR so it goes to the httpd log).
R
*** /u/gnats/src/Patches/gnatsweb.pl Mon Sep 16 09:28:38 2002
--- /u/dss/cgi-bin/gnatsweb-v4.pl Wed Sep 18 15:44:57 2002
***************
*** 3285,3290 ****
--- 3285,3292 ----
$row2 .= qq(<td><a href="$url&cmd=logout" style="$buttonstyle">LOG OUT</a></td>)
unless ($site_gnatsweb_server_auth);
$row2 .= qq(<td><a href="$url&cmd=help" style="$buttonstyle">HELP</a></td>);
+ $row2 .= qq(<td><a href="$url&cmd=debug" style="$buttonstyle">DEBUG</a></td>)
+ if(cb('cmd', 'debug', 'inquire'));
$row2 .= qq(</tr>\n);
$row2 .= qq(</table>\n</td>\n</tr>);
***************
*** 4122,4140 ****
sub debug_print_all_cookies
{
# Debug: print all our cookies into server log.
! warn "================= all cookies ===================================\n";
my @c;
my $i = 0;
foreach my $y ($q->cookie())
{
@c = $q->cookie($y);
! warn "got cookie: length=", scalar(@c), ": $y =>@c<=\n";
$i += length($y);
}
# @c = $q->raw_cookie();
! # warn "debug 0.5: @c:\n";
! # warn "debug 0.5: total size of raw cookies: ", length("@c"), "\n";
}
# set_pref -
--- 4124,4149 ----
sub debug_print_all_cookies
{
+ my($fd) = @_;
+
+ if (!defined($fd))
+ {
+ $fd = \*STDERR;
+ }
+
# Debug: print all our cookies into server log.
! print $fd "================= all cookies ===================================\n";
my @c;
my $i = 0;
foreach my $y ($q->cookie())
{
@c = $q->cookie($y);
! print $fd "got cookie: length=", scalar(@c), ": $y =>@c<=\n";
$i += length($y);
}
# @c = $q->raw_cookie();
! # print $fd "debug 0.5: @c:\n";
! # print $fd "debug 0.5: total size of raw cookies: ", length("@c"), "\n";
}
# set_pref -
_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats
next prev parent reply other threads:[~2002-09-26 13:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-16 6:48 Robert Lupton the Good
2002-09-17 9:47 ` Yngve Svendsen
2002-09-23 12:22 ` Lars Henriksen
2002-09-25 11:18 ` Lars Henriksen
2002-09-25 11:43 ` Yngve Svendsen
2002-09-25 13:13 ` Lars Henriksen
2002-09-26 15:46 ` Robert Lupton the Good [this message]
2002-09-27 0:32 ` Robert Lupton the Good
2002-09-30 2:07 ` Lars Henriksen
[not found] <20020915103254.22538.88942.Mailman@monty-python.gnu.org>
2002-09-16 6:56 ` Robert Lupton the Good
2002-09-16 7:24 ` patch " Robert Lupton the Good
2002-09-16 7:45 ` Robert Lupton the Good
-- strict thread matches above, loose matches on Subject: below --
2002-09-16 6:46 Patch " Robert Lupton the Good
2001-09-06 14:09 patch " David, Lysander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15763.3490.841076.988437@wire7.Princeton.EDU \
--to=rhl@astro.princeton.edu \
--cc=help-gnats@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).