Archive-RPM
view release on metacpan or search on metacpan
lib/Archive/RPM.pm view on Meta::CPAN
#############################################################################
#
# Manipulate an RPM archive
#
# Author: Chris Weyl (cpan:RSRCHBOY), <cweyl@alumni.drew.edu>
# Company: No company, personal work
#
# Copyright (c) 2009, 2010 Chris Weyl <cweyl@alumni.drew.edu>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
#############################################################################
package Archive::RPM;
use Moose;
use MooseX::MarkAsMethods autoclean => 1;
use MooseX::AttributeHelpers;
use MooseX::Types::Path::Class ':all';
use overload '""' => sub { shift->rpm->basename };
use English '-no_match_vars';
use File::Temp 'tempdir';
use Path::Class;
use RPM2 0.67;
use Archive::RPM::ChangeLogEntry;
our $VERSION = '0.07';
with 'MooseX::Traits';
has '+_trait_namespace' => (default => 'Archive::RPM::TraitFor');
# debugging
#use Smart::Comments '###', '####';
around BUILDARGS => sub {
my ($orig, $self) = (shift, shift);
# if it's a single non-ref value, assume it's meant for 'rpm'
return $self->$orig({ rpm => $_[0] }) if @_ == 1 && (!ref $_[0] || ref $_[0] ne 'HASH');
return $self->$orig(@_);
};
sub BUILD {
my $self = shift @_;
my $rpm = $self->rpm;
die "$rpm does not exist!\n" unless $rpm->stat;
return;
}
has rpm => (is => 'ro', isa => File, coerce => 1, required => 1);
sub nvr { (my $nvr = shift->as_nvre) =~ s/^.*://; $nvr }
has _header => (
is => 'ro',
isa => 'RPM2::Header',
lazy_build => 1,
# http://www.perlmonks.org/?node_id=588315 kick ass!
handles => qr/^(?!(?s:.*)^(files|changelog|nvr)$)/,
);
sub _build__header { RPM2->open_package(shift->rpm) }
# lazy cheats! :-)
sub nvre { shift->as_nvre }
sub is_srpm { shift->is_source_package }
sub is_source { shift->is_source_package }
has auto_cleanup => (is => 'ro', isa => 'Bool', default => 0);
has extracted_to => (
( run in 0.828 second using v1.01-cache-2.11-cpan-39bf76dae61 )