Ask

 view release on metacpan or  search on metacpan

lib/Ask/Zenity.pm  view on Meta::CPAN

	my $self = shift;
	my $zen  = $self->_zenity( error => @_ );
	$zen->close;
	return not $zen->exit;
}

sub file_selection {
	my $self = shift;
	my $text = readline( $self->_zenity( file_selection => @_ )->stdout );
	chomp $text;
	my @files = map path( $_ ), split m#[|]#, $text;
	@files == 1 ? $files[0] : @files;
}

sub single_choice {
	my ( $self, %o ) = @_;
	$o{title} = 'Single choice' unless exists $o{title};
	$o{text}  = 'Choose one.'   unless exists $o{text};
	my ( $c ) = $self->_choice( radiolist => 1, %o );
	return $c;
}

lib/Ask/Zenity.pm  view on Meta::CPAN

		( $o{checklist} ? '--checklist' : () ),
		( $o{multiple}  ? '--multiple'  : () ),
		'--column=Select',
		'--column=Code',
		'--column=Choice',
		'--hide-column=2',
		'--text', $o{text},
		map { ( $subsequent++ ? 'FALSE' : 'TRUE' ), @$_ } @{ $o{choices} },
	);
	chomp( my $line = readline( $zen->stdout ) );
	split m{\|}, $line;
} #/ sub _choice

1;

__END__

=head1 NAME

Ask::Zenity - use /usr/bin/zenity to interact with a user



( run in 0.373 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )