Hi Monks,
I am developing a intranet web report using cgi script to work in windows 2000 environment and IIS 5.0. I want to perform the following activities:
1. Copy an excel template to my working location and name it to todays date.
2. Collect details from a database.
3. Write database query details to an excel File.
4. Generate an HTML file with other details.
5. Embed the HTML file with the body of the Mail and attach the Excel file
All these steps works well when I execute the script in the command line prompt. But, when I execute them in the web all the steps except step 2 fails.
On clicking the link the report either hangs or displays cannot copy the excel file.
The modules used and the functions I have used is show below:
use DBI; use IniConf; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use File::Copy qw(copy); use MIME::Lite; #FOR EXCEL COPY sub CheckDrive(){ if ( ! opendir(TEMPLATEPATH,$GIST_TEMPLATEPATH)) { my $objnet=Win32::OLE->CreateObject("Wscript.Network"); $objnet->MapNetworkDrive("H:","\\\\prodapt-bpo\\bpodata"); } copy("$GIST_TEMPLATEPATH"."$GIST_EXCELNAME","$ExcelName") or die D +isplayError("Copy failed: $ExcelName : $!"); closedir(TEMPLATEPATH); } #TO UPDATE THE EXCEL sub UpdateExcel(){ my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); #Win32:: +OLE->GetActiveObject('Excel.Application') my $Book = $Excel->Workbooks->Open( {FileName => $ExcelName} ); my $GistSheet = $Book->Worksheets("$GIST_ESHEETNAME"); my $AutoGistUptoThisMonth = shift; foreach my $row (5..19) { $col = 14; $GistSheet->Cells($row,$col)->{'Value'}= $AutoGistUptoThisMont +h->{$row}; } foreach my $row (5..19) { $col = 15; $GistSheet->Cells($row,$col)->{'Value'}= $AutoGistExcel{$row}; } $Book->Save; $Book->Close; } #TO SEND MAIL sub SendEmail(){ $msg = MIME::Lite->new( From =>$GIST_MAIL_FROM, To =>$GIST_MAIL_TO, CC =>$GIST_MAIL_CC, Subject =>$GIST_MAIL_SUBJECT.$MailDate, Type =>'text/html', Data => $MailContent ); $msg->attach( Type => 'application/vnd.ms-excel', Path => $ExcelName, Disposition => 'attachment' ); $msg->send('smtp',"mail.prodapt.com"); }
Request your help to resolve this issue. Thanks pdl_babu
In reply to Perl and windows 2000 by pdl_babu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |