Win32::SqlServer::DTS::Package::Step::Result - a Perl class to represent a DTS Package Step execution result.


Win32-SqlServer-DTS documentation Contained in the Win32-SqlServer-DTS distribution.

Index


Code Index:

NAME

Top

Win32::SqlServer::DTS::Package::Step::Result - a Perl class to represent a DTS Package Step execution result.

SYNOPSIS

Top

    use Win32::SqlServer::DTS::Package::Step::Result;

DESCRIPTION

Top

Win32::SqlServer::DTS::Package::Step::Result does not exists in the regular MS SQL Server DTS 2000 API.

EXPORT

Nothing.

METHODS

new

Instantiates a new Win32::SqlServer::DTS::Package::Step::Result. Expects as a parameter a hash reference with the following keys:

* error_code: scalar value.
* source: scalar value.
* description: scalar value.
* step_name: scalar value.
* is_success: "boolean". Accepts 0 or 1.
* exec_status: scalar value.

to_string

Returns the DTS:Package::Step::Result as a pure text content. Useful for simple reports.

to_xml

Returns the DTS:Package::Step::Result as an XML content.

is_success

Returns true if the step was executed successfully.

SEE ALSO

Top

* Win32::SqlServer::DTS::Package::Step documentation.

AUTHOR

Top

Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>

COPYRIGHT AND LICENSE

Top


Win32-SqlServer-DTS documentation Contained in the Win32-SqlServer-DTS distribution.
package Win32::SqlServer::DTS::Package::Step::Result;

use 5.008008;
use strict;
use warnings;
use base qw(Class::Accessor);
use Carp qw(confess);
use XML::Simple;
use Params::Validate qw(validate :types);
use Hash::Util qw(lock_keys);

__PACKAGE__->follow_best_practice();
__PACKAGE__->mk_ro_accessors(
    qw(exec_status step_name error_code source description));

our $VERSION = '0.01';

sub new {

    my $class = shift;

    validate(
        @_,
        {
            error_code  => { type => SCALAR },
            source      => { type => SCALAR },
            description => { type => SCALAR },
            step_name   => { type => SCALAR },
            is_success  => { type => SCALAR, regex => qr/[10]{1}/ },
            exec_status => { type => SCALAR }
        }
    );

    my $self = shift;

    bless $self, $class;

    lock_keys( %{$self} );

    return $self;

}

sub to_string {

    my $self = shift;

    my @attrib_names = keys( %{$self} );

	my $string;

    foreach my $attrib_name (@attrib_names) {

        $string .= "$attrib_name => $self->{$attrib_name}\n";

    }

	return $string;

}

sub to_xml {

    my $self = shift;

    my $xs = XML::Simple->new();

    return $xs->XMLout($self);

}

sub is_success {

    my $self = shift;

    return $self->{is_success};

}

1;

__END__