/usr/share/perl5/Lire/UI/BoolWidget.pm is in lire 2:2.1.1-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | package Lire::UI::BoolWidget;
use strict;
use base qw/ Curses::UI::Radiobuttonbox Lire::UI::Widget /;
use Carp;
use Curses::UI::Common;
use Locale::TextDomain 'lire';
use Lire::Utils qw/ check_object_param /;
use vars qw/@CARP_NOT/;
@CARP_NOT = qw/Curses::UI::Container/;
sub new {
my $class = shift;
my %userargs = @_;
keys_to_lowercase(\%userargs);
check_object_param( $userargs{'value'}, 'value',
'Lire::Config::Scalar' );
my %args = (
%userargs,
'-height' => 2,
'-values' => [ __('yes'), __('no') ],
'-onchange' => \&_on_change_cb,
);
my $self = $class->Curses::UI::Radiobuttonbox::new( %args );
$self->refresh_view();
return $self;
}
sub layout {
my $self = $_[0];
$self->{'-height'} = 2;
return $self->SUPER::layout();
}
sub refresh_view {
my $self = $_[0];
# We don't want to use as_value() which will generate a
# warning when the value is undef.
my $bool = $self->{'value'}->spec()->normalize( $self->{'value'}->get() );
$self->{'-selected'} = ( $bool ? 0 : 1 );
$self->intellidraw();
return;
}
sub _on_change_cb {
my $self = $_[0];
$self->{'value'}->set( ! $self->{'-selected'} );
$self->run_event( 'onvaluechanged' );
return;
}
1;
|