Linux and UNIX Man Pages

Test Your Knowledge in Computers #759
Difficulty: Medium
Commodore filed for bankruptcy in 1994 and its assets were purchased by a German PC manufacturer who created the subsidiary company Amiga Technologies.
True or False?
Linux & Unix Commands - Search Man Pages

rpm2(3) [redhat man page]

RPM2(3) 						User Contributed Perl Documentation						   RPM2(3)

RPM2 - Perl bindings for the RPM Package Manager API SYNOPSIS
use RPM2; my $db = RPM2->open_rpm_db(); my $i = $db->find_all_iter(); print "The following packages are installed (aka, 'rpm -qa'): "; while (my $pkg = $i->next) { print $pkg->as_nvre, " "; } $i = $db->find_by_name_iter("kernel"); print "The following kernels are installed (aka, 'rpm -q kernel'): "; while (my $pkg = $i->next) { print $pkg->as_nvre, " ", int($pkg->size()/1024), "k "; } $i = $db->find_by_provides_iter("kernel"); print "The following packages provide 'kernel' (aka, 'rpm -q --whatprovides kernel'): "; while (my $pkg = $i->next) { print $pkg->as_nvre, " ", int($pkg->size()/1024), "k "; } print "The following packages are installed (aka, 'rpm -qa' once more): "; foreach my $pkg ($db->find_by_file("/bin/sh")) { print $pkg->as_nvre, " "; } my $pkg = RPM2->open_package("/tmp/XFree86-4.1.0-15.src.rpm"); print "Package opened: ", $pkg->as_nvre(), ", is source: ", $pkg->is_source_package, " "; DESCRIPTION
The RPM2 module provides an object-oriented interface to querying both the installed RPM database as well as files on the filesystem. CLASS METHODS
Pretty much all use of the class starts here. There are two main entrypoints into the package -- either through the database of installed rpms (aka the rpmdb) or through a file on the filesystem (such as kernel-2.4.9-31.src.rpm or kernel-2.4.9-31.i386.rpm You can have multiple RPM databases open at once, as well as running multiple queries on each. open_rpm_db(-path => "/path/to/db") As it sounds, it opens the RPM database, and returns it as an object. open_package("foo-1.1-14.noarch.rpm") Opens a specific package (RPM or SRPM). Returns a Header object. RPM DB object methods find_all_iter() Returns an iterator object that iterates over the entire database. find_all() Returns an list of all of the results of the find_all_iter() method. find_by_file_iter($filename) Returns an iterator that returns all packages that contain a given file. find_by_file($filename) Ditto, except it just returns the list find_by_name_iter($package_name) You get the idea. This one is for iterating by package name. find_by_name($package_name) Ditto, except it returns a list. find_by_provides_iter($provides_string) This one iterates over provides. find_by_provides($provides_string) Ditto, except it returns a list. find_by_requires_iter($requires_string) This one iterates over requires. find_by_requires($requires_string) Ditto, except it returns a list. RPM Header object methods stuff goes here TODO
Package installation and removal. Signature validation. HISTORY
0.01 Initial release AUTHOR
Chip Turner <> SEE ALSO
perl. The original RPM module. perl v5.8.0 2002-11-08 RPM2(3)

Check Out this Related Man Page

Package::Pkg(3pm)					User Contributed Perl Documentation					 Package::Pkg(3pm)

Package::Pkg - Handy package munging utilities VERSION
version 0.0020 SYNOPSIS
First, import a new keyword: "pkg" use Package::Pkg; Package name formation: pkg->name( 'Xy', 'A' ) # Xy::A pkg->name( $object, qw/ Cfg / ); # (ref $object)::Cfg Subroutine installation: pkg->install( sub { ... } => 'MyPackage::myfunction' ); # myfunction in MyPackage is now useable MyPackage->myfunction( ... ); Subroutine exporting: package MyPackage; use Package::Pkg; sub this { ... } # Setup an exporter (literally sub import { ... }) for # MyPackage, exporting 'this' and 'that' pkg->export( that => sub { ... }, 'this' ); package main; use MyPackage; this( ... ); that( ... ); DESCRIPTION
Package::Pkg is a collection of useful, miscellaneous package-munging utilities. Functionality is accessed via the imported "pkg" keyword, although you can also invoke functions directly from the package ("Package::Pkg") USAGE
pkg->install( ... ) Install a subroutine, similar to Sub::Install This method takes a number of parameters and also has a two- and three-argument form (see below) # Install an anonymous subroutine as Banana::magic pkg->install( code => sub { ... } , as => 'Banana::magic' ) pkg->install( code => sub { ... } , into => 'Banana::magic' ) # Bzzzt! Throws an error! # Install the subroutine Apple::xyzzy as Banana::magic pkg->install( code => 'Apple::xyzzy', as => 'Banana::magic' ) pkg->install( code => 'Apple::xyzzy', into => 'Banana', as => 'magic' ) pkg->install( from => 'Apple', code => 'xyzzy', as => 'Banana::magic' ) pkg->install( from => 'Apple', code => 'xyzzy', into => 'Banana', as => 'magic' ) # Install the subroutine Apple::xyzzy as Banana::xyzzy pkg->install( code => 'Apple::xyzzy', as => 'Banana::xyzzy' ) pkg->install( code => 'Apple::xyzzy', into => 'Banana' ) pkg->install( from => 'Apple', code => 'xyzzy', as => 'Banana::xyzzy' ) pkg->install( from => 'Apple', code => 'xyzzy', into => 'Banana' ) With implicit "from" (via "caller()") package Apple; sub xyzzy { ... } # Install the subroutine Apple::xyzzy as Banana::xyzzy pkg->install( code => 'xyzzy', as => 'Banana::xyzzy' ) # 'from' is implicitly 'Apple' pkg->install( code => &xyzzy, as => 'Banana::xyzzy' ) Acceptable parameters are: code A subroutine reference, A package-with-name identifier, or The name of a subroutine in the calling package from (optional) A package identifier If :code is an identifier, then :from is the package where the subroutine can be found If :code is an identifier and :from is not given, then :from is assumed to be the calling package (via caller()) as The name of the subroutine to install as. Can be a simple name (when paired with :into) or a full package-with-name into (optional) A package identifier If :as is given, then the full name of the installed subroutine is (:into)::(:as) If :as is not given and we can derive a simple name from :code (It is a package-with-name identifier), then :as will be the name identifier part of :code pkg->install( $code => $as ) This is the two-argument form of subroutine installation Install $code subroutine as $as pkg->install( sub { ... } => 'Banana::xyzzy' ) pkg->install( 'Scalar::Util::blessed' => 'Banana::xyzzy' ) pkg->install( 'Scalar::Util::blessed' => 'Banana::' ) pkg->install( sub { ... } => 'Banana::' ) # Bzzzt! Throws an error! $code should be: o A CODE reference sub { ... } o A package-with-name identifier Scalar::Util::blessed o The name of a subroutine in the calling package sub xyzzy { ... } pkg->install( 'xyzzy' => ... ) $as should be: o A package-with-name identifier Acme::Xyzzy::magic o A package identifier (with a trailing ::) Acme::Xyzzy:: pkg->install( $code => $into, $as ) This is the three-argument form of subroutine installation pkg->install( sub { ... } => 'Banana', 'xyzzy' ) pkg->install( sub { ... } => 'Banana::', 'xyzzy' ) pkg->install( 'Scalar::Util::blessed' => 'Banana', 'xyzzy' ) pkg->install( 'Scalar::Util::blessed' => 'Banana::', 'xyzzy' ) $code can be the same as the two argument form $into should be: o A package identifier (trailing :: is optional) Acme::Xyzzy:: Acme::Xyzzy $as should be: o A name (the name of the subroutine) xyzzy magic $package = pkg->name( $part, [ $part, ..., $part ] ) Return a namespace composed by joining each $part with "::" Superfluous/redundant "::" are automatically cleaned up and stripped from the resulting $package If the first part leads with a "::", the the calling package will be prepended to $package pkg->name( 'Xy', 'A::', '::B' ) # Xy::A::B pkg->name( 'Xy', 'A::' ) # Xy::A:: { package Zy; pkg->name( '::', 'A::', '::B' ) # Zy::A::B pkg->name( '::Xy::A::B' ) # Zy::Xy::A::B } In addition, if any part is blessed, "name" will resolve that part to the package that the part makes reference to: my $object = bless {}, 'Xyzzy'; pkg->name( $object, qw/ Cfg / ); # Xyzzy::Cfg SEE ALSO
Sub::Install Sub::Exporter AUTHOR
This software is copyright (c) 2012 by Robert Krimen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-15 Package::Pkg(3pm)

Featured Tech Videos