<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# This file was preprocessed, do not edit!


package Debconf::FrontEnd;
use warnings;
use strict;
use Debconf::Gettext;
use Debconf::Priority;
use Debconf::Log ':all';
use base qw(Debconf::Base);


sub init {
	my $this=shift;

	$this-&gt;elements([]);
	$this-&gt;interactive('');
	$this-&gt;capb('');
	$this-&gt;title('');
	$this-&gt;requested_title('');
	$this-&gt;info(undef);
	$this-&gt;need_tty(1);
}


sub elementtype {
	my $this=shift;

	my $ret;
	if (ref $this) {
		($ret) = ref($this) =~ m/Debconf::FrontEnd::(.*)/;
	}
	else {
		($ret) = $this =~ m/Debconf::FrontEnd::(.*)/;
	}
	return $ret;
}

my %nouse;

sub _loadelementclass {
	my $this=shift;
	my $type=shift;
	my $nodebug=shift;

	if (! UNIVERSAL::can("Debconf::Element::$type", 'new')) {
		return if $nouse{$type};
		eval qq{use Debconf::Element::$type};
		if ($@ || ! UNIVERSAL::can("Debconf::Element::$type", 'new')) {
			warn sprintf(gettext("Unable to load Debconf::Element::%s. Failed because: %s"), $type, $@) if ! $nodebug;
			$nouse{$type}=1;
			return;
		}
	}
}


sub makeelement {
	my $this=shift;
	my $question=shift;
	my $nodebug=shift;

	my $type=$this-&gt;elementtype.'::'.ucfirst($question-&gt;type);
	$type=~s/::$//; # in case the question has no type..

	$this-&gt;_loadelementclass($type, $nodebug);

	my $element="Debconf::Element::$type"-&gt;new(question =&gt; $question);
	return if ! ref $element;
	return $element;
}


sub add {
	my $this=shift;
	my $element=shift;

	foreach (@{$this-&gt;elements}) {
		return if $element-&gt;question == $_-&gt;question;
	}

	$element-&gt;frontend($this);
	push @{$this-&gt;elements}, $element;
}


sub go {
	my $this=shift;
	$this-&gt;backup('');
	foreach my $element (@{$this-&gt;elements}) {
		$element-&gt;show;
		return if $this-&gt;backup &amp;&amp; $this-&gt;capb_backup;
	}
	return 1;
}


sub progress_start {
	my $this=shift;
	my $min=shift;
	my $max=shift;
	my $question=shift;

	my $type = $this-&gt;elementtype.'::Progress';
	$this-&gt;_loadelementclass($type);

	my $element="Debconf::Element::$type"-&gt;new(question =&gt; $question);
	unless (ref $element) {
		return;
	}
	$element-&gt;frontend($this);
	$element-&gt;progress_min($min);
	$element-&gt;progress_max($max);
	$element-&gt;progress_cur($min);

	$element-&gt;start;

	$this-&gt;progress_bar($element);
}


sub progress_set {
	my $this=shift;
	my $value=shift;

	return $this-&gt;progress_bar-&gt;set($value);
}


sub progress_step {
	my $this=shift;
	my $inc=shift;

	return $this-&gt;progress_set($this-&gt;progress_bar-&gt;progress_cur + $inc);
}


sub progress_info {
	my $this=shift;
	my $question=shift;

	return $this-&gt;progress_bar-&gt;info($question);
}


sub progress_stop {
	my $this=shift;

	$this-&gt;progress_bar-&gt;stop;
	$this-&gt;progress_bar(undef);
}


sub clear {
	my $this=shift;

	$this-&gt;elements([]);
}


sub default_title {
	my $this=shift;

	$this-&gt;title(sprintf(gettext("Configuring %s"), shift));
	$this-&gt;requested_title($this-&gt;title);
}


sub shutdown {}


1
</pre></body></html>