The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

NetSDS::Feature - abstract application feature

SYNOPSIS

        package NetSDS::Feature::DBI;

        use DBI;
        use base 'NetSDS::Feature';

        sub init {
                my ($this) = @_;

                my $dsn = $this->conf->{dsn};
                my $user = $this->conf->{user};
                my $passwd = $this->conf->{passwd};

                $this->{dbconn} = DBI->connect($dsn, $user, $passwd);

        }

        # Sample method - DBI::do proxy
        sub do {

                my $this = shift @_;
                return $this->{dbconn}->do(@_);
        }

        1;

DESCRIPTION

Application features are Perl5 packages with unified API for easy integration of some functionality into NetSDS applications infrastructure.

NetSDS::Feature module contains superclass for application features providing the following common feature functionality:

        * class construction
        * initialization stub
        * logging

CLASS METHODS

create($app, $conf) - feature constructor
init() - feature initialization

This method should be rewritten with feature functionality implementation.

OBJECT METHODS

app() - application object

This method allows to use application methods and properties.

        print "Feature included from app: " . $this->app->name;
conf() - feature configuration

This method provides access to feature configuration.

log($level, $message) - implements logging

See NetSDS::Logger documentation for details.

EXAMPLES

See samples/app_features.pl script.

BUGS

Unknown yet

SEE ALSO

NetSDS::App

TODO

None

AUTHOR

Michael Bochkaryov <misha@rattler.kiev.ua>