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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.