Egg::Base - General-purpose base class for Egg.


  use base qw/Egg::Base/;
  # A peculiar configuration to the class is set.
  __PACKAGE__->config( ... );
  # Global HASH peculiar to the project is set.
  __PACKAGE__->global( ... );
  my $self= __PACKAGE__->new([egg_object]);
  # The parameter is set to the object.
  $self->param( in_param => 'in_value' );
  # The class name under operation is obtained.
  print $self->namespace;
  # The error message is set.
  $self->error('internal error.');
  # The error is checked.
  if (my $err= $self->errstr) { die $err }


Some methods of the fixed form are offered to the class that succeeds to this module.


mk_classdata ( [METHOD] )

It is a method offered by Class::Data::Inheritable.

see Class::Data::Inheritable

config ( [HASH_REF] )

Passed HASH_REF is set as a configuration.

global ( [HASH_REF] )

It sets it as a variable that can use passed HASH_REF globally in the project. * It is necessary to be called from the class including the project name.

mk_accessors ( [ACCESSOR_LIST] )

It is a method offered by Class::Accessor::Fast.



It can access PROJECT_OBJECT with $self->e.

It can access PARAM with parameters.


Accessor to project object.


param ( [KEY], [VALUE] )

This moves a general param similar method.

If the argument is omitted, the parameter key list that has been set is returned.

If KEY is passed, the value of the corresponding parameter is returned.

If KEY and VALUE are passed, the value is set in the corresponding parameter.


The HASH reference of the parameter is returned.

  • Alias: params


The class name of the object is returned while operating. It is the same as 'ref($self)'.

  • Alias: myname


The result of doing $self->namespace in uc is returned.

  • Alias: uc_myname


The result of doing $self->namespace in lc is returned.

  • Alias: lc_myname

include ( [PACKAGE_NAME] )

PACKAGE_NAME is done in require and registered.

  __PACKAGE__->include( 'Include::Package' );


The list of the package read by 'include' method is returned by the ARRAY reference. An empty ARRAY reference returns to anything when there is no registration.

  my $include_package= $self->include_packages->[0] || 'none.';

replace_deep ( [PARAM_HASH_REF], [HASH or ARRAY etc] )

It does in the data such as passed HASH and ARRAY and $self->replace is recurrently done.

replace ( [PARAM_HASH_REF], [VALUE] )

It replaces it with the value to which the place of the following descriptions of passed VALUE is returned by PARAM_HASH_REF.

  < $e.param_name >  or < $ >
  * It is enclosed with < > and an inside character string is $e. The description
    that starts is substituted.
  * If the name of the parameter is delimited by '.', the hierarchy is expressible.
  * The CODE reference is appreciable in the parameter value of the object.

* The value of VALUE should be SCALAR that is the SCALAR reference or usual.

error ( [ERROR_MESSAGE] )

The passed error message is maintained.

If ERROR_MESSAGE is omitted and the error message has defined it, the ARRAY reference is returned.


If $self->error has defined it, the error message made a changing line delimitation is returned.

If the receiving side is ARRAY, usual ARRAY is returned.


Class::C3 UNIVERSAL::require Class::Accessor::Fast Class::Data::Inheritable Egg::Release,


Masatoshi Mizuno <>


Copyright (C) 2007 by Bee Flag, Corp. <>, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.