Jan Dubois, you are the ASPerl GOD...

I just did a little browsing and came up with the answer.  Below is the
modified code... 
use Win32::OLE::Variant; 
#... 
sub StepErrors 
{
        my $ErrorCode=Variant(VT_I4|VT_BYREF, "-1");
        my $Source=Variant(VT_BSTR|VT_BYREF, "<none >");
        my $Description=Variant(VT_BSTR|VT_BYREF, "<none >");
        foreach my $steps (in {$package->{Steps}})
        {
                if ($steps->{ExecutionStatus} == 4)
                {
                        if ($steps->{ExecutionResult} == 1)
                        {
                                $err = -1;
        
$steps->GetExecutionErrorInfo($ErrorCode,$Source,$Description);
                                print Win32::OLE->LastError;            
                                $errmsg = "$errmsg \n Step
$steps->{Name} failed, error:\n  $ErrorCode \n $Description \n";
                        }
                }
        }
        return $errmsg, $err;
}               

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Brown, Jeremy
Sent: Monday, March 14, 2005 2:36 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Calling DTS GetExecutionErrorInfo method with "by
reference"arguments of types other than variant.


I don't know if there is any way to do this in ASPerl.  If so, some
advice is appreciated.

I have constructed a Perl script to create a DTS package.  I'm trying to
print the step errors returned by the  GetExecutionErrorInfo method, and
am having a bit of trouble.

When researching MSDN, I came across this little blurb...

http://support.microsoft.com/default.aspx?scid=kb;en-us;252987
"This approach also has the advantage of giving access to the
GetExecutionErrorInfo method, which is not available in a scripting
environment because it uses "by reference" arguments of types other than
variant." 

Below is a sample of my code.  Of course it doesn't work because the
GetExecutionErrorInfo expects the variable to be passed as a reference.

sub StepErrors 
{
        my ($ErrorCode, $Source,$Description);
        foreach my $steps (in {$package->{Steps}})
        {
                if ($steps->{ExecutionStatus} == 4)
                {
                        if ($steps->{ExecutionResult} == 1)
                        {
                                $err = -1;
        
($ErrorCode,$Source,$Description)=$steps->GetExecutionErrorInfo;
                                print Win32::OLE->LastError;            
                                $errmsg = "$errmsg \n Step
$steps->{Name} failed, error:  $ErrorCode \n $Description \n";
                        }
                }
        }
        return $errmsg, $err;
}               

Of course I've tried passing $ErrorCode, $Source, and $Description as
variants defined with WIN32::OLE::Variant, but obviously this doesn't
work...

                 ************** N O T I C E **************
The information contained in this transmission is intended for the
exclusive use of the 
addressee(s) and may contain information that is privileged,
confidential, and/or 
protected from disclosure.  If you are not the intended recipient, you
are hereby 
notified that any dissemination, distribution or copying of this
communication is 
strictly prohibited.  If you have received this transmission in error,
please 
immediately reply to the sender and then delete it.  Thank you for your
compliance.


_______________________________________________
Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
                 ************** N O T I C E **************
The information contained in this transmission is intended for the exclusive 
use of the 
addressee(s) and may contain information that is privileged, confidential, 
and/or 
protected from disclosure.  If you are not the intended recipient, you are 
hereby 
notified that any dissemination, distribution or copying of this communication 
is 
strictly prohibited.  If you have received this transmission in error, please 
immediately reply to the sender and then delete it.  Thank you for your 
compliance.


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to