summaryrefslogtreecommitdiffstats
path: root/perl-install/wizards.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/wizards.pm')
-rw-r--r--perl-install/wizards.pm50
1 files changed, 25 insertions, 25 deletions
diff --git a/perl-install/wizards.pm b/perl-install/wizards.pm
index c5a39c4da..b1c9c4516 100644
--- a/perl-install/wizards.pm
+++ b/perl-install/wizards.pm
@@ -1,22 +1,20 @@
package wizards;
-# $Id$
use strict;
use c;
use common;
+# perl_checker: require interactive
=head1 NAME
-wizards - a layer on top of interactive that ensure proper stepping
+wizards - a layer on top of L<interactive> that ensure proper stepping
=head1 SYNOPSIS
- use wizards
- # global wizard options:
-
use wizards;
use interactive;
- my $wiz = {
+
+ my $wiz = wizards->new({
allow_user => "", # do we need root
defaultimage => "", # wizard icon
@@ -44,7 +42,7 @@ wizards - a layer on top of interactive that ensure proper stepping
{
# usual interactive fields:
label => N("Banner:"),
- val => \$o->{var}{wiz_banner}
+ val => \$o->{var}{wiz_banner},
list => [] ,
# wizard layer variables:
boolean_list => "", # provide default status for booleans list
@@ -52,10 +50,9 @@ wizards - a layer on top of interactive that ensure proper stepping
],
},
},
- };
-
- my $w => wizards->new
- $w->process($wiz, $in);
+ });
+ my $in = 'interactive'->vnew;
+ $wiz->process($in);
=head1 DESCRIPTION
@@ -85,14 +82,17 @@ extra exception managment such as destroying the wizard window and the like.
=cut
-sub new { bless {}, $_[0] }
+sub new {
+ my ($class, $o) = @_;
+ bless $o, $class;
+}
sub check_rpm {
- my ($in, $rpms) = @_;
+ my ($in, $rpms) = @_; # perl_checker: $in = interactive->new
foreach my $rpm (@$rpms) {
- next if !$in->do_pkgs->is_installed($rpm);
- if ($in->ask_okcancel(N("Error"), N("%s is not installed\nClick \"Next\" to install or \"Cancel\" to quit", c::from_utf8($rpm)))) {
+ next if $in->do_pkgs->is_installed($rpm);
+ if ($in->ask_okcancel(N("Error"), N("%s is not installed\nClick \"Next\" to install or \"Cancel\" to quit", $rpm))) {
$::testing and next;
if (!$in->do_pkgs->install($rpm)) {
local $::Wizard_finished = 1;
@@ -105,11 +105,11 @@ sub check_rpm {
# sync me with interactive::ask_from_normalize() if needed:
-my %default_callback = (changed => sub {}, focus_out => sub {}, complete => sub { 0 }, canceled => sub { 0 }, advanced => sub {});
+my %default_callback = (complete => sub { 0 });
sub process {
- my ($_w, $o, $in) = @_;
+ my ($o, $in) = @_;
local $::isWizard = 1;
local $::Wizard_title = $o->{name} || $::Wizard_title;
local $::Wizard_pix_up = $o->{defaultimage} || $::Wizard_pix_up;
@@ -119,7 +119,7 @@ sub process {
my ($res, $msg) = &{$o->{init}};
if (!$res) {
$in->ask_okcancel(N("Error"), $msg);
- die "wizard failled" if !$::testing
+ die "wizard failed" if !$::testing;
}
}
@@ -146,10 +146,10 @@ sub process {
my $i;
foreach (@{$d->{boolean_list}}) {
push @$data2, { text => $_, type => 'bool', val => \${$d->{val}}->[$i], disabled => $d->{disabled} };
- $i++
+ $i++;
}
} else {
- push @$data2, $d
+ push @$data2, $d;
}
}
my $name = ref($page->{name}) ? $page->{name}->() : $page->{name};
@@ -161,7 +161,7 @@ sub process {
if (ref $data2 eq 'ARRAY' && @$data2) {
$a = $in->ask_from_({ title => $o->{name},
messages => $name,
- callbacks => { map { $_ => $page->{$_} || $default_callback{$_} } qw(focus_out complete) },
+ (map { $_ => $page->{$_} || $default_callback{$_} } qw(complete)),
if_($page->{interactive_help_id}, interactive_help_id => $page->{interactive_help_id}),
}, $data2);
} else {
@@ -185,16 +185,16 @@ sub process {
die qq(Step "$current": inexistant "$next" page) if !exists $o->{pages}{$next};
} else {
# step back:
- $next = pop @steps
+ $next = pop @steps;
}
- $page = $o->{pages}{$next}
+ $page = $o->{pages}{$next};
}
}
sub safe_process {
- my ($w, $wiz, $in) = @_;
- eval { $w->process($wiz, $in) };
+ my ($o, $in) = @_;
+ eval { $o->process($in) };
my $err = $@;
if ($err =~ /wizcancel/) {
$in->exit(0);