IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#19048 - 11/03/06 05:59 PM Running Perl Script in Watch - Issue
Ken Stulce Offline
OL Expert

Registered: 07/06/01
Posts: 451
Loc: St. Louis, MO
_________________________
-------------------
Ken Stulce
Manager of Application Development
Essex Industries, Inc.
-------------------

Top
#19049 - 11/06/06 01:25 PM Re: Running Perl Script in Watch - Issue
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc
Hi Ken,

Debugging your entire script is next to impossible without having the data files you're using.

But I wrote a sample PERL script that does part of what your own script does: it counts the form feeds in a text file. Just provide a sample data file that has some form feeds in it and you'll see the results. The script also makes use of 3 PPWatch-declared functions ( GetJobFileName( ), Log( ) and ShowMessage( ) ) so you can see how they work within PERL.
Code:
# Utilize the File::Copy module
use File::Copy;

# Copy job file to temp destination
$fileIN = $Watch->GetJobFileName();
copy $fileIN, "C:\\Test\\TestIn.txt";

# Open job file for Input
$fileIN = "C:\\Test\\TestIn.txt";
open(IN, "<$fileIN" &#0124;&#0124; die "Something is wrong opening Data File");
$PageIndex=0;

# Read each line in the file
while($nextline = <IN>)
{
        # Check if Form Feed present in the line
        if($nextline =~ m/\f/)
        {
                # Form feed was found: Output the line to the debug log
                $Watch->Log("This line has a form feed: " . $nextline,4);
                # Increment Page Count
                $PageIndex++;
        }
}

# Display a pop-up with the number of Form Feeds found in the file
$Watch->ShowMessage($PageIndex);

# Close the filehandle
close(IN);
I hope this can help put you on the right track.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#19050 - 11/24/06 03:10 PM Re: Running Perl Script in Watch - Issue
Anonymous
Unregistered


The problem comes from the way the input and output files are set. Instead of doing this

# Initialize variables
$fileIN = "";
$fileOUT = "";

# For use with Watch
#$fileIN = $Watch->GetJobFileName();

# For use with Watch
#$fileOUT = $Watch->GetJobFileName();

#### Copy Watch temp file to Temp directory for processing
copy $fileIN, "C:\\tempFolder\\StatementTemp.txt";

#### Read temp input file
open(IN, "C:\\tempFolder\\StatementTemp.txt" || die "Something is wrong opening Data File");

#### Open FH, watch temp file, for writing
open(OUT, ">$fileOUT" || die "Something is wrong opening Data File");

you should do this :

# Initialize variables
$fileIN = "C:\\tempFolder\\StatementTemp.txt";
$fileOUT = "";

#### Copy Watch temp file to Temp directory for processing
# For use with Watch
copy $Watch->GetJobFileName(), $fileIN;

#### Read temp input file
open(IN, $fileIN || die "Something is wrong opening Data File");

# For use with Watch
$fileOUT = $Watch->GetJobFileName();

#### Open FH, watch temp file, for writing
open(OUT, ">$fileOUT" || die "Something is wrong opening Data File");

Thanks.

Pierre P

Top
#19051 - 12/07/06 10:25 AM Re: Running Perl Script in Watch - Issue
Ken Stulce Offline
OL Expert

Registered: 07/06/01
Posts: 451
Loc: St. Louis, MO
Pierre,

I just wanted to let you know that I was finally able to implement the script changes and test on the customer's PP server and everything processed great. I'm still baffled as to why my original version of the script didn't work, as I have used the exact same format for another customer, but it could be that I had a slightly older version of Perl installed on the other server.

Thanks again.
_________________________
-------------------
Ken Stulce
Manager of Application Development
Essex Industries, Inc.
-------------------

Top
#19052 - 01/24/07 08:14 AM Re: Running Perl Script in Watch - Issue
Anonymous
Unregistered


Hello,

Here is a link that has the syntax

http://www.objectiflune.com/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=47;t=000017#000000

Top