Debconf Perl Help.
Hey there!
I've been working on some debconf-perl stuff to get some package to
use debconf. But while shaping my helper scripts I got into some
wiredness and I'm really out of tricks to debug this one.
on the attached code you should notice that a call to sub
parse_template() makes debconf calls (get()) sit for ever. AND I
REALLY DON'T KNOW WHY ! as you can see in the code, calling a dummy
function doesn't brake anything and I don't think that
parse_template() does anything wired nor wrong...
Hope someone can help !
Cheers,
#!/usr/bin/perl -w
use strict;
use Debconf::Client::ConfModule ':all';
debug ("first ", get("demo/boolean"));
dummy();
debug ("after dummy() ", get("demo/boolean"));
my @ta = parse_template("/dev/null");
dump_keys(\@ta);
debug ("after parse_template ", get("demo/boolean"));
sub dummy {
debug ("dummy");
}
sub parse_template {
my @templates;
for my $file (@_) {
debug("opening `$file'");
open (TEMPLATE, $file) or die "Could not open $file: $!";
$/ = "";
while (<TEMPLATE>) {
/^Template: ([\w\/]+)\n(?:.*\n)*Default: ([\w\/]+)/
and push @templates, [[split /\//, $1], $2];
}
close(TEMPLATE);
}
return @templates;
}
sub dump_keys {
for (@{$_[0]}) {
debug (join("/", @{$_->[0]}));
}
}
# shamelessly ripped from bugzilla's postinst-db.pl
# only here for debugging purposes.
sub debug {
warn "DEBUG:\t".join(" ",@_)."\n";
}
--
Niv Sardi-Altivanik <xaiki+deb@cxhome.ath.cx>
Debian::GNU/Linux::Addict, Wannabe Debian Developper,
please test my packages: http://cxhome.ath.cx/debian
> Random Fortune (To make your day better if not wiser) <
El que canta, sus males espanta.
Reply to: