Cave::Wrapper - A Wrapper to the Paludis 'cave' Client.
version 1.000000
cave is a package management client for the Paludis package manager available for use with both the Exherbo Linux and Gentoo Linux Distributions.
cave
This module is designed as a syntactic sugar wrapper for that client to minimize development time and clarify code.
my $cave = Cave::Wrapper->new(); my @ids = $cave->print_ids(qw( --matches dev-lang/perl ));
Methods are generated entirely at run-time by introspecting the output from cave print-commands --all and then generating the appropriate methods. This is mostly because we don't want to have to cut a new release every time paludis produce a new release just to avoid breaking code.
cave print-commands --all
There exists 1 command we cannot perform a native mapping for, and its due to a perlism, and that is import.
import
For now, this is named cave_import instead.
cave_import
Hyphenated commands can't be used as method names in Perl, so we've translated the hyphens to underscores in the method names.
i.e.: if you wanted print-ids you now want print_ids
print-ids
print_ids
This is a first-pass "Just get it working" implementation at this time, and is reasonably useful for the print_ family of commands the cave client provides. However, you probably do not wish to use it for more complex things like calling cave resolve as it might cause you untold sorrows while it silently buffers into a growing array and then spews its contents when its finished.
cave resolve
One day we'd like to have a sweeter syntax, like
$cave->print_ids({ matches => 'dev-lang/perl' })
or
$cave->print_ids({ matches => [ 'dev-lang/perl' , 'dev-lang/python' ]});
However, there are a few problems and questions to be answered, which are not a problem with the existing syntax but would be a problem with a possible alternative syntax.
Toggle Switches
There are a lot of toggle switches that don't take a parameter, and while we could just do
$cave->print_commands({ all => 1 });
That means we have to get rid of the '1' before we pass the command to cave, and that is going to be difficult to do without needing tight coupling. Not to mention how to handle all => 2 and all => 1.
all => 2
all => 1
Fixed Order operations.
Some cave functions require operators to be ordered, so if you needed to do this
cave foobar --matching foo --not --matching bar
having a structure
$cave->foobar({ matching => [ 'foo', 'bar' ]} , '--not' )
would obviously not work.
$cave->foobar([ matching => 'foo', not => matching => 'bar' ])
or anything not using a hash is going to be equally confusing, especially as we can now no longer tell what is a key and what is a value, so adding '--' to the front of them becomes impossible.
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2015 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Cave::Wrapper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cave::Wrapper
CPAN shell
perl -MCPAN -e shell install Cave::Wrapper
For more information on module installation, please visit the detailed CPAN module installation guide.