summaryrefslogtreecommitdiffstats
path: root/perl-install/interactive/http.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/interactive/http.pm')
-rw-r--r--perl-install/interactive/http.pm47
1 files changed, 26 insertions, 21 deletions
diff --git a/perl-install/interactive/http.pm b/perl-install/interactive/http.pm
index a4f9e3bfd..70017c41d 100644
--- a/perl-install/interactive/http.pm
+++ b/perl-install/interactive/http.pm
@@ -1,4 +1,4 @@
-package interactive::http; # $Id$
+package interactive::http;
use diagnostics;
use strict;
@@ -13,11 +13,10 @@ use log;
my $script_name = $ENV{INTERACTIVE_HTTP};
my $no_header;
-my $uid;
my $pipe_r = "/tmp/interactive_http_r";
my $pipe_w = "/tmp/interactive_http_w";
-sub open_stdout {
+sub open_stdout() {
open STDOUT, ">$pipe_w" or die;
$| = 1;
print CGI::header();
@@ -26,30 +25,30 @@ sub open_stdout {
# cont_stdout must be called after open_stdout and before the first print
sub cont_stdout {
- my ($title) = @_;
- print CGI::start_html('-title' => $title) if $no_header;
+ my ($o_title) = @_;
+ print CGI::start_html('-title' => $o_title) if $no_header;
$no_header = 0;
}
-sub new_uid {
+sub new_uid() {
my ($s, $ms) = gettimeofday();
$s * 256 + $ms % 256;
}
-sub new() {
+sub new {
open_stdout();
bless {}, $_[0];
}
-sub end() {
- -e $pipe_r or return; # don't run this twice
+sub end {
+ -e $pipe_r or return; # do not run this twice
my $q = CGI->new;
cont_stdout("Exit");
print "It's done, thanks for playing", $q->end_html;
close STDOUT;
unlink $pipe_r, $pipe_w;
}
-sub exit() { end(); exit($_[1]) }
+sub exit { end(); exit($_[1]) }
END { end() }
sub ask_fromW {
@@ -75,7 +74,7 @@ sub ask_fromW {
$e->{type} = 'list' if $e->{type} =~ /(icon|tree)list/;
- #- combo doesn't exist, fallback to a sensible default
+ #- combo does not exist, fallback to a sensible default
$e->{type} = $e->{not_edit} ? 'list' : 'entry' if $e->{type} eq 'combo';
if ($e->{type} eq 'bool') {
@@ -93,14 +92,14 @@ sub ask_fromW {
} else {
print $e->{hidden} ?
$q->password_field('-name' => "w$::i", '-default' => ${$e->{val}}) :
- $q->textfield( '-name' => "w$::i", '-default' => ${$e->{val}});
+ $q->textfield('-name' => "w$::i", '-default' => ${$e->{val}});
}
print "</td></tr>\n";
} @$l;
print "</table>\n";
- print $q->p();
+ print $q->p;
print $q->submit('-name' => 'ok_submit', '-value' => $common->{ok} || N("Ok"));
print $q->submit('-name' => 'cancel_submit', '-value' => $common->{cancel} || N("Cancel")) if $common->{cancel} || !exists $common->{ok};
print $q->hidden('state'), $q->hidden('uid');
@@ -109,15 +108,14 @@ sub ask_fromW {
close STDOUT; # page terminated
while (1) {
- local *F;
- open F, "<$pipe_r" or die;
- $q = CGI->new(*F);
+ open(my $F, "<$pipe_r") or die;
+ $q = CGI->new($F);
$q->param('force_exit_dead_prog') and $o->exit;
last if $q->param('uid') == $uid;
open_stdout(); # re-open for writing
cont_stdout(N("Error"));
- print $q->h1(N("Error")), $q->p("Sorry, you can't go back");
+ print $q->h1(N("Error")), $q->p("Sorry, you cannot go back");
goto redisplay;
}
each_index {
@@ -138,15 +136,15 @@ sub p {
}
sub wait_messageW {
- my ($_o, $_title, $messages) = @_;
+ my ($_o, $_title, $message, $message_modifiable) = @_;
cont_stdout();
print "\n" . CGI::p();
- p(@$messages);
+ p($message, $message_modifiable);
}
sub wait_message_nextW {
- my ($_o, $messages, $_w) = @_;
- p(@$messages);
+ my ($_o, $message, $_w) = @_;
+ p($message);
}
sub wait_message_endW {
my ($_o, $_w) = @_;
@@ -154,6 +152,13 @@ sub wait_message_endW {
print "\n" . CGI::p();
}
+sub ok {
+ N("Ok");
+}
+
+sub cancel {
+ N("Cancel");
+}
1;