Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PERL and the Crystal Runtime

Status
Not open for further replies.

TheBoss

Programmer
Jul 31, 2000
1
US
I'm trying to use PERL to automate verifying databases.
The PERL OLE engine has always worked fine before, so I don't expect a bug in it.

The problem is that PERL runs through everything fine and CR8 displayed the correct dialog from the verify() method; however, right after control returns PERL dies with the runtime error "Attempt to free unreferenced scalar". I suspect the problem is in the code of the verify() method and was wondering if anyone else came across this problem.

code inserted below:

require 5.005;
use strict;
use Win32::OLE;
use Win32::OLE::Enum;
use Win32::OLE::Const 'Crystal Report 8 ActiveX Designer Design';
Win32::OLE->Option(Warn => 3);


#--------------------------------------------------------------
# This subroutine sends an error message to STDOUT and exits the
# program.

#--------------------------------------------------------------
sub Usage_error
{
my $error_code = shift;

if($error_code == 1)
{
die "\nUSAGE: VerifyDatabase.pl [path and file name] or [path--for multiple files]\n\n".
" For example: \n".
" VerifyDatabase.pl c:\\wincbs\\main\\projects\\debug\\reports\\prearningsreport1.rpt\n".
" or\n".
" VerifyDatabase.pl c:\\wincbs\\main\\projects\\debug\\reports\n\n".
" The output file will have a .rptline extension.\n".
" If your path contains spaces, please put quotes around it.\n".
" NOTE: This script will not dump the contents of nested subreports\n";
}

if($error_code == 2)
{
print "The file you have targeted was not found in the directory you gave.\n";
}

exit(0);
}


#-------------------------------------------------------------------------------------
# Main
#-------------------------------------------------------------------------------------
my $Rptfile = shift;
my $application;
my $report;
my $database;
my $tables;
my $result;

#$application = Win32::OLE->new('CrystalDesigner.Application.8', \&OleQuit) or die "Oops, cannot verify database";
#$application = Win32::OLE->new('CrystalRuntime.Application.8', \&OleQuit) or die "Oops, cannot verify database";

$report = $application->OpenReport("$Rptfile");

$database = $report->Database;


$result = $database->Verify;
print $result;


sub OleQuit
{
my $self = shift;
$self->Quit;
}



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top