Arch

 view release on metacpan or  search on metacpan

perllib/Arch/Run.pm  view on Meta::CPAN

    my $window = Gtk2::Window->new;
    my $label = Gtk2::Label->new;
    my $pbar = Gtk2::ProgressBar->new;
    my $vbox = Gtk2::VBox->new;
    $vbox->add($label); $vbox->add($pbar); $window->add($vbox);
    $window->signal_connect(destroy => sub { Gtk2->main_quit; });
    $window->set_default_size(200, 48); $window->show_all;
    sub set_str { $label->set_text($_[0]); }

    my $go = 1;  # keep progress bar pulsing
    Glib::Timeout->add(100, sub { $pbar->pulse; poll(0); $go; });

    run_async(   
        command => [ 'du', '-hs', glob('/usr/share/*') ],
        mode    => LINES,
        datacb  => sub { chomp(my $str = $_[0]); set_str($str); },
        exitcb  => sub { $go = 0; set_str("exit code: $_[0]"); },
    );

    Gtk2->main;

perllib/Arch/SharedIndex.pm  view on Meta::CPAN

=item B<can_create>

Whether the index file is automatically created.  Defaults to 1.

=item B<max_size>

Maximum number of entries in the index.  Defaults to 0 (no limit).

=item B<expiration>

Timeout in seconds after which unused entries are removed.  Defaults
to 0 (don't expire entries)

=item B<time_renewal>

Whether fetching values resets the entry expiration timeout.  Defaults
to 1 if B<max_size> is set, 0 otherwise.

=item B<perl_data>

Whether non-scalar perl data can be stored.  If true, values are

samples/arch-run-demo-1  view on Meta::CPAN


$window->signal_connect(destroy => sub { Gtk2->main_quit });
$window->set_default_size(300, 400); $window->show_all;

sub append_text {
	my $str = shift;
	$text->get_buffer->insert($text->get_buffer->get_end_iter, $str);
}

my $keep = 1;
Glib::Timeout->add(50, sub { $pbar->pulse; Arch::Run::poll(0); $keep });

Arch::Run::run_async(
	command => [ 'du', '-hs', @dirs ],
	mode    => Arch::Run::LINES,
	datacb  => sub { append_text($_[0]); },
	exitcb  => sub { $keep = 0 },
);

Gtk2->main;

samples/arch-run-demo-2  view on Meta::CPAN

my $window = Gtk2::Window->new;
my $label = Gtk2::Label->new("no du output yet");
my $pbar = Gtk2::ProgressBar->new;
my $vbox = Gtk2::VBox->new;
$vbox->add($label); $vbox->add($pbar); $window->add($vbox);
$window->signal_connect(destroy => sub { Gtk2->main_quit; });
$window->set_default_size(200, 48); $window->show_all;
sub set_str { $label->set_text($_[0]); }

my $keep = 1;
Glib::Timeout->add(100, sub { $pbar->pulse; poll(0); $keep; });

run_async(
	command => [ 'du', '-hs', @dirs ],
	mode    => LINES,
	datacb  => sub { chomp(my $str = $_[0]); set_str($str); },
	exitcb  => sub { $keep = 0; set_str("exit code: $_[0]"); },
);

Gtk2->main;



( run in 0.291 second using v1.01-cache-2.11-cpan-4d50c553e7e )