> $document = Win32::OLE -> GetObject(UPLOAD_DIR . $filename);
> open (FH,">$outputfile");
>
> print "Extracting Text... please wait (this may take a while)...\n";
>
> $paragraphs = $document->Paragraphs();
> $enumerate = new Win32::OLE::Enum($paragraphs);
> while(defined($paragraph = $enumerate->Next()))
>     {
>     $style = $paragraph->{Style}->{NameLocal};
>     print FH "+$style\n";
>     print "+$style\n";
>     $text = $paragraph->{Range}->{Text};
>     $text =~ s/[\n\r]//g;
>     $text =~ s/\x0b/\n/g;
>     print FH "=$text\n";
>     print "=$text\n";
>     }
> -----------------------------------------
> ...I get the following error:
> "Can't call method "Paragraphs" on an undefined value at convert.pl..."
>
> Now, from what I can figure out, Win32::OLE isn't loading the file which
> was uploaded temporarily.  The file is there in the upload directory,
> Win32::OLE just can't grab it as an object.  Any ideas, anyone?

Since the code works at the command line but not CGI it sounds like a
permissions problem.  Unless you changed the default, the user CGI scripts
run as shouldn't have permission to run MS Word.  Try the following, it
should give a better message as to the problem.

$document = Win32::OLE -> GetObject(UPLOAD_DIR . $filename) ||
      die Win32::OLE->LastError();;

-- 
Nathaniel G. Bartusiak
TTMS, Keesler AFB




_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to