Index index by Group index by Distribution index by Vendor index by creation date index by Name Mirrors Help Search

perl-Class-Base-0.09-lp152.3.2 RPM for noarch

From OpenSuSE Leap 15.2 for noarch

Name: perl-Class-Base Distribution: openSUSE Leap 15.2
Version: 0.09 Vendor: openSUSE
Release: lp152.3.2 Build date: Fri Sep 20 19:15:02 2019
Group: Development/Libraries/Perl Build host: morla3
Size: 88750 Source RPM: perl-Class-Base-0.09-lp152.3.2.src.rpm
Packager: https://bugs.opensuse.org
Url: http://search.cpan.org/dist/Class-Base/
Summary: Useful Base Class for Deriving Other Modules
Please consider using Badger::Base instead which is the successor of this
module.

This module implements a simple base class from which other modules can be
derived, thereby inheriting a number of useful methods such as 'new()',
'init()', 'params()', 'clone()', 'error()' and 'debug()'.

For a number of years, I found myself re-writing this module for
practically every Perl project of any significant size. Or rather, I would
copy the module from the last project and perform a global search and
replace to change the names. Each time it got a little more polished and
eventually, I decided to Do The Right Thing and release it as a module in
it's own right.

It doesn't pretend to be an all-encompassing solution for every kind of
object creation problem you might encounter. In fact, it only supports
blessed hash references that are created using the popular, but by no means
universal convention of calling 'new()' with a list or reference to a hash
array of named parameters. Constructor failure is indicated by returning
undef and setting the '$ERROR' package variable in the module's class to
contain a relevant message (which you can also fetch by calling 'error()'
as a class method).

e.g.

    my $object = My::Module->new(
	file => 'myfile.html',
	msg  => 'Hello World'
    ) || die $My::Module::ERROR;

or:

    my $object = My::Module->new({
	file => 'myfile.html',
	msg  => 'Hello World',
    }) || die My::Module->error();

The 'new()' method handles the conversion of a list of arguments into a
hash array and calls the 'init()' method to perform any initialisation. In
many cases, it is therefore sufficient to define a module like so:

    package My::Module;
    use Class::Base;
    use base qw( Class::Base );

    sub init {
	my ($self, $config) = @_;
	
	$self->params($config, qw( FOO BAR )) || return undef;
	return $self;
    }

    

    1;

Then you can go right ahead and use it like this:

    use My::Module;

    my $object = My::Module->new( FOO => 'the foo value',
				  BAR => 'the bar value' )
        || die $My::Module::ERROR;

Despite its limitations, Class::Base can be a surprisingly useful module to
have lying around for those times where you just want to create a regular
object based on a blessed hash reference and don't want to worry too much
about duplicating the same old code to bless a hash, define configuration
values, provide an error reporting mechanism, and so on. Simply derive your
module from 'Class::Base' and leave it to worry about most of the detail.
And don't forget, you can always redefine your own 'new()', 'error()', or
other method, if you don't like the way the Class::Base version works.

Provides

Requires

License

Artistic-1.0 or GPL-1.0+

Changelog

* Fri Jan 05 2018 coolo@suse.com
  - updated to 0.09
    see /usr/share/doc/packages/perl-Class-Base/Changes
* Tue Jul 26 2016 coolo@suse.com
  - updated to 0.08
    see /usr/share/doc/packages/perl-Class-Base/Changes
    0.08 2016.08.25
      Fix release (hopefully)
    0.07 2016.08.25
      BUILD_REQUIRES vs TEST_REQUIRES  (Kent Fredric)
* Mon Apr 13 2015 coolo@suse.com
  - updated to 0.06
    see /usr/share/doc/packages/perl-Class-Base/Changes
    Add license to META files
    Updating the Changes file
* Mon Jun 03 2013 coolo@suse.com
  - updated to 0.05
    * Silencing a warning by chromatic RT 75286
    * Linking to source repository
* Sat Feb 11 2012 coolo@suse.com
  - updated to 0.04
    * Test script is using Test::More instead the home-made ok() and is().
    * Recommend using Badger::Base instead.
* Tue Nov 30 2010 coolo@novell.com
  - switch to perl_requires macro
* Tue Oct 12 2010 jw@novell.com
  - initial package 0.03
    * created by cpanspec 1.78.02

Files

/usr/lib/perl5/vendor_perl/5.26.1/Class
/usr/lib/perl5/vendor_perl/5.26.1/Class/Base.pm
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/share/doc/packages/perl-Class-Base
/usr/share/doc/packages/perl-Class-Base/CONTRIBUTORS
/usr/share/doc/packages/perl-Class-Base/Changes
/usr/share/doc/packages/perl-Class-Base/README
/usr/share/doc/packages/perl-Class-Base/README.mkdn
/usr/share/doc/packages/perl-Class-Base/TODO
/usr/share/doc/packages/perl-Class-Base/doap.xml
/usr/share/licenses/perl-Class-Base
/usr/share/licenses/perl-Class-Base/LICENSE
/usr/share/man/man3/Class::Base.3pm.gz


Generated by rpm2html 1.8.1

Fabrice Bellet, Tue Apr 9 11:50:38 2024