Ante-Deluvian-Dialog
view release on metacpan or search on metacpan
lib/Ante/Deluvian/Dialog.pm view on Meta::CPAN
);
if (!defined($itxt)) {
return;
}
$pref = ref($itxt);
if ($pref eq "ARRAY") {
@txtlns = @$itxt;
}
elsif ($pref eq "SCALAR") {
$text = $$itxt;
# @txtlns = split(/\n/, $$itxt);
}
elsif ($pref eq "IO::File") {
@txtlns = <$itxt>;
}
elsif (($pref eq "") && (-f $itxt)) {
my $fi = IO::File->new("< $itxt");
if (-T $itxt) {
@txtlns = <$fi>;
}
else {
#$/ = "\0";
#while (<$fi>) {
# while (/([\040-\176\s]{4,})/g) {
# push @txtlns, $1;
# }
#}
$doFmt = FALSE;
@filstat = stat($itxt);
@txtlns = ( "$itxt", "appears to be a binary file ...", "");
foreach my $i (0 .. $#filstat) {
push @txtlns, sprintf("%-10s -> %s", $stNames[$i], $stNames[$i] =~ /time/ ? scalar localtime($filstat[$i]) : $filstat[$i]);
}
}
$fi->close();
}
if ($doFmt) {
if (!defined($text)) {
$text = join "", @txtlns;
}
$text =~ s/\n\n+/#PAR#/g;
$text =~ tr/[\n\t ]/ /s;
print "$text\n";
$text =~ s/#PAR#/\n\n/g;
$text =~ s/#LN#/\n/g;
@txtlns = split(/\t/, $text);
$columns = $self->{'cols'} - 4;
$text = wrap("", "", @txtlns);
@lines = split(/\n/, $text);
}
else {
@lines = @txtlns;
}
print "Maximal $columns Spalten ...\n\n@lines\n";
$self->listbox(\@lines, input => "text");
}
1;
__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
Ante::Deluvian::Dialog - Perl extension for very old style user interaction
=head1 SYNOPSIS
use Ante::Deluvian::Dialog;
$d = Ante::Deluvian::Dialog->new(
platform => "MSWIN",
drawframe => 1,
title => "Title of Window",
prompt => "Please make your choice:",
# record => 1,
# replay => "C:/temp/addialog/<username>_<pid>.txt",
);
$fdir = $d->dselect();
print "You have selected directory $fdir ...\n";
$fname = $d->fselect($fdir);
print "You have selected file $fname ...\n";
@aLst = ( "A" .. "Z", "a" .. "z" );
@aRes = $d->listbox(\@aLst, select => "multi");
$rd = $d->radiolist([
[ "List of radio buttons", 1, ],
[ "red", "RED", 0 ],
[ "green", "GRN", 1 ],
[ "blue", "BLU", 0 ],
[ "yellow", "YLW", 0 ],
]);
$d->alert([
"Press <RETURN> to continue ...",
"Attention! This is considered to be",
"an alert box (see below) ...",
"The recent radio list resulted in $rd",
]);
if (-T $fname) {
$inpf = IO::File->new($fname);
$d->textbox($inpf);
}
else {
$d->textbox($fname);
}
=head1 CONSTRUCTOR
=over 4
=item new (platform => "MSWIN", title => "Window's title", prompt => "What do you want");
There are two other options C<record>, which can be set to a boolean value, and C<replay>, which
expects to get some previously recorded input file. This is mainly for testing purposes, if you
don't like to repeat a special input sequence by hand... I'm sure you will find out if this is
interesting to you.
( run in 2.001 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )