File Coverage

blib/lib/Win32/SqlServer/DTS/Assignment/Constant.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Win32::SqlServer::DTS::Assignment::Constant;
2            
3             =head1 NAME
4            
5             Win32::SqlServer::DTS::Assignment::Constant - a class to represent a DynamicPropertiesTaskAssignment object
6            
7             =head1 SYNOPSIS
8            
9             use warnings;
10             use strict;
11             use Win32::SqlServer::DTS::Application;
12             use Test::More;
13             use XML::Simple;
14            
15             my $xml = XML::Simple->new();
16             my $config = $xml->XMLin('test-config.xml');
17            
18             my $app = Win32::SqlServer::DTS::Application->new($config->{credential});
19            
20             my $package =
21             $app->get_db_package(
22             { id => '', version_id => '', namne => $config->{package}, package_password => '' } );
23            
24             my $iterator = $package->get_dynamic_props();
25            
26             while ( my $dyn_prop = $iterator->() ) {
27            
28             foreach my $assignment_prop ( @{ $dyn_prop->get_properties() } ) {
29            
30             if ( $assignment_prop->get_type() eq 'Constant' ) {
31            
32             print $assignment_prop->to_string(), "\n";
33            
34             }
35            
36             }
37             }
38            
39             =head1 DESCRIPTION
40            
41             C represents a Constant Assignment from a Dynamic Property Task of DTS API. Such
42             element will add a constant value to a desired destination once the Dynamic Property task, which is associated with,
43             is executed.
44            
45             Unless you're developing a new API is quite probably that one is going to use C returned
46             by the C method from C class.
47            
48             =head2 EXPORT
49            
50             Nothing.
51            
52             =cut
53            
54 1     1   13811 use strict;
  1         1  
  1         28  
55 1     1   3 use warnings;
  1         1  
  1         22  
56 1     1   4 use base qw(Win32::SqlServer::DTS::Assignment);
  1         1  
  1         413  
57             use Hash::Util qw(lock_keys);
58            
59             =head2 METHODS
60            
61             Inherits all methods from C.
62            
63             =head3 new
64            
65             Overrides C method from superclass by modifying the attribute C.
66            
67             =cut
68            
69             sub new {
70            
71             my $class = shift;
72             my $self = $class->SUPER::new(@_);
73            
74             $self->{source} = $self->get_sibling()->SourceConstantValue();
75             lock_keys( %{$self} );
76             return $self;
77            
78             }
79            
80             =head3 get_source
81            
82             Overrided method from L superclass.
83            
84             Returns a string that represents the C property, in other words, the value that will be assigned
85             to the destination everytime the C associated object is executed.
86            
87             =cut
88            
89             sub get_source {
90            
91             my $self = shift;
92             return $self->{source};
93            
94             }
95            
96             1;
97            
98             __END__