diff options
Diffstat (limited to 'perl-install/wizards.pm')
| -rw-r--r-- | perl-install/wizards.pm | 40 | 
1 files changed, 20 insertions, 20 deletions
| diff --git a/perl-install/wizards.pm b/perl-install/wizards.pm index cb40c881e..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)))) { +        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;          }      } @@ -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 { @@ -193,8 +193,8 @@ sub process {  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); | 
