Net::DRI::BaseClass - Superclass of various classes inside Net::DRI


Net-DRI documentation Contained in the Net-DRI distribution.

Index


Code Index:

NAME

Top

Net::DRI::BaseClass - Superclass of various classes inside Net::DRI

VERSION

Top

This documentation refers to Net::DRI::BaseClass version 1.1

SYNOPSIS

Top

Not directly used by users, this is a purely internal class, never visible to the outside of Net::DRI.

DESCRIPTION

Top

This is the superclass of some Net::DRI classes, providing various useful functions.

EXAMPLES

Top

No user examples.

SUBROUTINES/METHODS

Top

This is mostly a pure virtual superclass.

DIAGNOSTICS

Top

None.

CONFIGURATION AND ENVIRONMENT

Top

None.

DEPENDENCIES

Top

This modules has to be used inside the Net::DRI framework and needs the following composants:

Net::DRI::Exception

INCOMPATIBILITIES

Top

None

BUGS AND LIMITATIONS

Top

No known bugs. Please report problems to author (see below) or use CPAN RT system. Patches are welcome.

This should probably be better done with Moose and roles. It would however require a major overhaul to everything inside Net::DRI, so this would probably not happen very soon, maybe with a Perl6 port.

This class was introduced very late in Net::DRI, multiple parts of this framework should be modified to take advantage of this class.

SUPPORT

Top

For now, support questions should be sent to:

<netdri@dotandco.com>

Please also see the SUPPORT file in the distribution.

SEE ALSO

Top

<http://www.dotandco.com/services/software/Net-DRI/>

AUTHOR

Top

Patrick Mevzek, <netdri@dotandco.com>

LICENSE AND COPYRIGHT

Top


Net-DRI documentation Contained in the Net-DRI distribution.

## Domain Registry Interface, Superclass of various classes for Net::DRI
##
## Copyright (c) 2009 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
##
## This file is part of Net::DRI
##
## Net::DRI is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## See the LICENSE file that comes with this distribution for more details.
#
# 
#
####################################################################################################

package Net::DRI::BaseClass;

use strict;
use warnings;

use Net::DRI::Exception;

our $VERSION=do { my @r=(q$Revision: 1.1 $=~/\d+/gxm); sprintf '%d'.('.%02d' x $#r), @r; };

####################################################################################################
## CLASS METHODS

sub make_exception_if_not_implemented
{
 my ($self,@methods)=@_;
 my $class=ref $self || $self;
 foreach my $name (@methods)
 {
  no strict 'refs'; ## no critic (ProhibitNoStrict)
  *{"${class}::${name}"}=sub { my $self=shift; Net::DRI::Exception->die(1,'internal',1,sprintf('Method %s not implemented in %s, please report.',$name,ref $self)); };
 }
 return;
}

sub make_exception_for_unavailable_operations
{
 my ($self,@methods)=@_;
 my $class=ref $self || $self;
 foreach my $name (@methods)
 {
  my @op=split(/_/,$name,2);
  no strict 'refs'; ## no critic (ProhibitNoStrict)
  *{"${class}::${name}"}=sub { my $self=shift; Net::DRI::Exception->die(0,'DRD',4,sprintf('No operation %s %s available for registry %s',@op,$self->name())); };
 }
 no strict 'refs'; ## no critic (ProhibitNoStrict)
 *{"${class}::unavailable_operations"}=sub { return @methods; };
 return;
}

####################################################################################################
## OBJECT METHODS

sub generate_trid
{
 my ($self,$name)=@_;
 if (! defined $name) { $name=$self->name(); }
 return $self->trid_factory()->($name);
}

sub log_setup_channel { my ($self,@r)=@_; $self->logging()->setup_channel(@r); }
sub log_output        { my ($self,@r)=@_; $self->logging()->output(@r);        }

####################################################################################################
1;

__END__