Alceu Rodrigues de Freitas Junior > Win32-SqlServer-DTS > Win32::SqlServer::DTS::Assignment::Destination



Annotate this POD


View/Report Bugs
Module Version: 0.13   Source  


Win32::SqlServer::DTS::Assignment::Destination - abstract class to represent a destination string of a DTS DynamicPropertiesTaskAssignment object.


    use warnings;
    use strict;
    use Win32::SqlServer::DTS::Application;
    my $xml = XML::Simple->new();
    my $config = $xml->XMLin('test-config.xml');

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

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

        # checking out all destination string from all assignments from 
        # all Dynamic Property tasks of a package
        my $iterator = $package->get_dynamic_props();

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

                my $assign_iterator = $dyn_props->get_assignments;

                while ( my $assignment = $assign_iterator->() ) {

                        print $assignment->get_string(), "\n";




Win32::SqlServer::DTS::Assignment::Destination represents the destination string of a DTS DynamicPropertiesTaskAssignment object. The Destination string is usually something like

Object;Name of object;Properties;Name of the property

but this will change depending on the type of object which is mean to be the target of the assignment. Win32::SqlServer::DTS::Assignment::Destination is a "syntatic sugar" to allow the different types of Destination string to be used with a set of methods, hidding the complexity and hardwork to deal with this string.

Win32::SqlServer::DTS::Assignment::Destination is a abstract class and it's not meant to be used directly: to instantiate objects, look for the subclasses of it.

Although is part of the package, Win32::SqlServer::DTS::Assignment::Destination is not a subclass of Win32::SqlServer::DTS::Assignment, so no method from is inherited. Besides that, the package is not part of the original MS SQL Server API.





The object constructor method of the class. new is implemented to setup de object with two basic attributes: string and destination.

Expects as an argument the Destination string as a parameter. Subclasses of Win32::SqlServer::DTS::Assignment::Destination must implement the initialize method that parses the string and define the destination property correctly.


This method must be overrided by subclasses of Win32::SqlServer::DTS::Assignment::Destination. It should parse the string attribute and define the destination attribute with the proper value.

initialize is invoked automatically by the new method during object creation.


Returns the target of the Destination object, in other words, what will be modified by the related Assignment.


Returns a formatted destination string where all "'" (single quotes) are stripped.


Returns the destination string without any formating, as it's defined by the DTS API.


Modifies the destination string in the object. The string is validated against a regular expression before starting changing the property. The regex is "^(\'[\w\s\(\)]+\'\;\'[\w\s\(\)]+\')(\'[\w\s\(\)]+\')*" and it's based on the destination string specification in MSDN. If the regex does not match, the method will abort program execution.

The programmer must be aware that invoking set_string will automatically execute the initialize method (to setup other attributes related to the destination) and notify the related Win32::SqlServer::DTS::Assignmentt object to modify the property in it's _sibling attribute, to keep all values syncronized.


This method tests which object is being changed by the Win32::SqlServer::DTS::Assignment::Destination object. Expects a object name as a parameter; returns true if it changes the same object name, false if not.

An valid object name is equal to one of the subclasses of Win32::SqlServer::DTS::Assignment::Destination.

Since a Dynamic Property task can hold several assignments, this method is usefull for testing if an assignment is the one that you want to deal with. It's also possible to test that using the isa method, like this:

        if ( $destination->isa('Win32::SqlServer::DTS::Assignment::Destination::Connection') ) {

                #do something


But that is a lot of typing. Instead, use:

        if ( $destination->changes('Connection') ) {

                #do something


The result will be the same.



Alceu Rodrigues de Freitas Junior, <>


Copyright (C) 2007 by Alceu Rodrigues de Freitas Junior

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.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: