File-AptFetch
view release on metacpan or search on metacpan
lib/AptFetch.pm view on Meta::CPAN
# $Id: AptFetch.pm 562 2023-01-07 23:31:53Z whynot $
# Copyright 2009, 2010, 2014, 2017, 2023 Eric Pozharski <whynot@pozharski.name>
# GNU LGPLv3
# AS-IS, NO-WARRANTY, HOPE-TO-BE-USEFUL
use warnings;
use strict;
package File::AptFetch;
use version 0.77; our $VERSION = version->declare( v0.1.15 );
use File::AptFetch::ConfigData;
use Carp;
use IO::Pipe;
=head1 NAME
File::AptFetch - perl interface onto APT-Methods
=head1 SYNOPSIS
use File::AptFetch::Simple; # No, seriously.
=head1 DESCRIPTION
Shortly:
=over
=item *
Methods are usual executables.
Hence B<F:AF> forks.
=item *
There's no command-line interface for methods.
The IPC is two pipes (I<STDIN> and I<STDOUT> from method's POV).
=item *
Each portion of communication (named B<message>) consists of numerical code
with explaining text and a sequence of colon (C<':'>) separated lines.
A message is terminated with empty line.
=item *
L<File::AptFetch::Cookbook> has more.
=back
I<(disclaimer)>
Right now, B<F::AF> is in "proof-of-concept" state.
It surely works with local methods (F<file> and F<copy>);
I hope it will work with trivial cases of remote methods
(I<v0.1.9> I've left to hope, it totally does;
no manual interaction (credentials and/or tray closing) provided).
(B<F::AF> has no means to accept (not talking about to pass along)
authentication credentials;
So if your upstream needs authentication, B<F::AF> is of no help here.)
And one more warning:
you're supposed to do all the dirty work of managing --
B<F::AF> is only for comunication.
Hopefully, there will be someday a kind of super-module what would simplify all
this.
I<(warning)>
You should understand one potential tension with B<F::AF>:
B<wget(1)>, B<curl(1)>, various FTP clients, or whatever else that constitutes
B<fetcher> are (I hope so) thoroughly tested against monkey-wrench on the other
side of connection.
APT methods are B<not>.
APT talks to repositories;
those repositories are mostly mirrors.
Administrators of mirrors and mirror-net roots have at least a basic clue.
Pending discovery of APT methods behaviour when they face idiots on the other
side of connection.
There's a list of known bugs, caveats, and deficiencies.
=over
=item *
(I<v0.1.9>)
There were some concerns about signals.
Surprisingly, they're gone now.
The only corner left to try is a child ignoring signals at all
(stuck in syscall?).
=item *
That seems that upon normal operation there're no zombies left.
However, I'm not sure if B<waitpid> would work as expected.
(What if some method would take lots of time to die after being signaled?)
=item *
Methods are supposed (or not?) to write extra diagnostic at its I<STDERR>.
It stays the same as of your process.
However, I still haven't seen any output.
So, (first) I (and you) have nothing to worry about
and (second) I have nothing to work with.
That's possible that issue will stay as caveat.
=item *
I<@$log> is fragile.
Don't touch it.
However, there's a possibility of I<@$log> corruption, like this.
If method goes insane and outputs unparsable messages, then L</gain()> will
give
up immedately leaving I<@$log> unempty.
In that case you're supposed to recreate B<F::AF> object (or give up).
If you don't then strange things can happen (mostly -- give-ups again).
So, please, do.
=item *
( run in 2.050 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )