blink has asked for the wisdom of the Perl Monks concerning the following question:
Here's the error I get, followed by the code itself:
The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error +and then click the Refresh button, or try again later. Only one top level element is allowed in an XML document. Error proces +sing resource 'http://bkup1/cgi-bin/get-sched.cgi'. Line 1, Position +45 <h1>NBU Backup Schedule Retrieval Tool</h1><p>Choose a backup client f +rom the pulldown menu and push 'get my schedule' to retrieve all acti +ve backup schedules for your chosen server</p><hr /><?xml version="1. +0" encoding="utf-8"?> --------------------------------------------^
#!/opt/openv/perl/bin/perl -w use strict; use NBUX; use CGI; use CGI::Carp qw/fatalsToBrowser/; my %data; my $sid; my $day; my @clients; my %bpclients = bpclclients(); foreach (sort keys %bpclients) { push @clients, $_; } my $query = new CGI; print $query->header, $query->h1("NBU Backup Schedule Retrieval Tool"), $query->p( 'Choose a backup client from the pulldown menu and pus +h \'get my schedule\' to retrieve all active backup schedules for you +r chosen server' ), $query->hr, $query->start_html( {-bgcolor=>'#CCFFCC'},'NBU Sch +edule Getter'), $query->startform, $query->popup_menu( -name => 'backup client', -values => [@clients], -default => '' ), $query->submit('Action', 'get my schedule'), $query->endform; get_schedule($query->param('backup client')); print $query->end_html; sub get_schedule { my ($client) = @_; my $cmd = "/opt/openv/netbackup/bin/admincmd/bppllist -byclient $c +lient -U"; open CMD, " $cmd |" or die "Cannot run $cmd: $@\n"; while (<CMD>) { next if (/Default/); if (/Policy Name:(\s+)(.*?)$/) { $sid = "$2"; next; } next unless (/(\s+)Daily Windows\:/ .. /(\s+)Schedule\:/); if (/(^\s+)(.*?day)/) { next if (/24|Week/); $day = $_; chomp $day; push @{$data{$sid}}, $day; } } foreach my $key (sort keys %data) { print $query->br, $query->b("$key starts between"); foreach (@{$data{$key}}) { print $query->pre("$_"),; } print "======================================================= +====="; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI.pm, XML and Internet Explorer
by sauoq (Abbot) on Jul 30, 2003 at 18:33 UTC | |
|
Re: CGI.pm, XML and Internet Explorer
by CountZero (Bishop) on Jul 30, 2003 at 18:33 UTC | |
|
Re: CGI.pm, XML and Internet Explorer
by PodMaster (Abbot) on Jul 31, 2003 at 06:15 UTC |