Win32::SqlServer::DTS::Assignment::INI - a class to represent a DTS DynamicPropertiesTaskAssignment object


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

Index


Code Index:

NAME

Top

Win32::SqlServer::DTS::Assignment::INI - a class to represent a DTS DynamicPropertiesTaskAssignment object

SYNOPSIS

Top

    use warnings;
    use strict;
    use Win32::SqlServer::DTS::Application;
    use Test::More;
    use XML::Simple;

    my $xml = XML::Simple->new();
    my $config = $xml->XMLin('test-config.xml');

    my $app = Win32::SqlServer::DTS::Application->new($config->{credential});

    my $package =
      $app->get_db_package(
        { id => '', version_id => '', name => $config->{package}, package_password => '' } );

	my $iterator = $package->get_dynamic_props();

    while ( my $dyn_prop = $iterator->() ) {

        foreach my $assignment_prop ( @{ $dyn_prop->get_properties } ) {

            if ( $assignment_prop->get_type eq 'INI' ) {

			    print $assignment_prop->to_string, "\n";

            }

        }
    }

DESCRIPTION

Top

Win32::SqlServer::DTS::Assignment::INI is a subclass of Win32::SqlServer::DTS::Assignment superclass. It represents a DTS DynamicPropertiesTaskAssignment object that has the properties SourceIniFileFileName, SourceIniFileKey and SourceIniFileSection defined.

Unless you want to extend the DTS API is quite probably that you're going to use Win32::SqlServer::DTS::Assignment::INI returned by the get_properties method from Win32::SqlServer::DTS::Task::DynamicProperty class.

EXPORT

Nothing.

METHODS

Inherits all methods from Win32::SqlServer::DTS::Assignment.

new

Extends superclass method new by modifying the source attribute.

get_source

Overrided method from Win32::SqlServer::DTS::Assignment class. It will returns a result depending on the context the method was invoked. in a scalar context, it will return a string with the results of the methods get_filename, get_section and get_key respectivally, separated by points and quoted with square brackets. In a list context, it will return a list with the three values of the methods get_filename, get_section and get_keys, in this order.

See Win32::SqlServer::DTS::Assignment (get_destination in Win32::SqlServer::DTS::Assigment) method for more information about how a property is setup using a Dynamic Properties Task Assignment.

get_filename

Returns a string with the complete pathname and filename of the INI files that will be read by the Win32::SqlServer::DTS::Assignment::INI object.

get_section

Returns a string with the section of the INI file returned by the get_filename method.

get_key

Returns a string with the key defined in the section returned by the get_section method.

SEE ALSO

Top

* Win32::SqlServer::DTS::Assignment at perldoc.
* Win32::OLE at perldoc.
* MSDN on Microsoft website and MS SQL Server 2000 Books Online are a reference about using DTS' object hierarchy, but one will need to convert examples written in VBScript to Perl code.

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::Assignment::INI;

use 5.008008;
use strict;
use warnings;
use base qw(Win32::SqlServer::DTS::Assignment Class::Accessor);
use Hash::Util qw(lock_keys);

__PACKAGE__->follow_best_practice;
__PACKAGE__->mk_ro_accessors(qw(filename section key));

our $VERSION = '0.03';

sub new {

    my $class = shift;
    my $self  = $class->SUPER::new(@_);

    my $sibling = $self->get_sibling;

    $self->{filename} = $sibling->SourceIniFileFileName;
    $self->{section}  = $sibling->SourceIniFileSection;
    $self->{key}      = $sibling->SourceIniFileKey;

    lock_keys( %{$self} );

    return $self;

}

sub get_source {

    my $self = shift;

    return
      wantarray
      ? ( $self->get_filename, $self->get_section, $self->get_key )
      : '['
      . $self->get_filename . '].['
      . $self->get_section . '].['
      . $self->get_key . ']';

}

1;
__END__