[13651] in Perl-Users-Digest
Perl-Users Digest, Issue: 1061 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 15 14:31:47 1999
Date: Fri, 15 Oct 1999 11:31:29 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940012288-v9-i1061@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 15 Oct 1999 Volume: 9 Number: 1061
Today's topics:
Help building Ingres DBD on NT <justinc@thentec.com.au>
Re: Help building Ingres DBD on NT <sjohns17@uic.edu>
Re: Help building Ingres DBD on NT <justinc@thentec.com.au>
Help Need Some Insight Perl and MySQL <nprash@monmouth.com>
Re: Help Need Some Insight Perl and MySQL (Michael Budash)
Help weird html with CGI.pm and Ispell.pm <scott_beck@my-deja.com>
Re: Help weird html with CGI.pm and Ispell.pm (Clinton Pierce)
help with array usage <chakri@nortelnetworks.com>
Re: help with array usage <rootbeer@redcat.com>
help with CGI.pm <cliff@scs.uiuc.edu>
Re: help with CGI.pm <jeffp@crusoe.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 13 Oct 1999 14:35:43 +1000
From: Justin Carr <justinc@thentec.com.au>
Subject: Help building Ingres DBD on NT
Message-Id: <38040C1F.6988F00F@thentec.com.au>
OK. I'm now at desperation point. I've spent the last 2 days trying to
get the Ingres DBD to build on NT. Has anyone successfully done this
before? If so, what am I missing? Should I even bother trying?
For what it's worth, I've attached output of the latest attempts at
'perl Makefile.PL -v' and 'nmake', and the start of the .c file for the
compilation
that's currently failing.
I would be extremely grateful for any help or better yet a pre-built
package :)
Thanks,
Justin
=================================================================================================
perl Makefile.PL -v
Configuring DBD::Ingres ...
Try 'perl Makefile.PL -v'
if you have any problems.
Using Ingres in D:\CA\IngresII
System: perl5.00503
Compiler: cl.exe -Od -MD -DNDEBUG -TP -GX -Od -MD -DNDEBUG -TP -GX
-DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
SQL-precompiler: D:\CA\IngresII\ingres\bin\esqlc.exe
II_SYSTEM: D:\CA\IngresII, OpenIngres
Linkwith: 'ingres.lib shell32.lib msvcrt.lib libc.lib kernel32.lib
user32.lib mpr.lib advapi32.lib netapi32.lib libcmt.lib'
MakeMaker (v5.4302)
Checking if your kit is complete...
Looks good
ABSTRACT_FROM => q[Ingres.pm]
AUTHOR => q[Henrik Tougaard (ht@datani.dk)]
DEFINE => q[-DOPENINGRES]
INC => q[-Id:\Perl\site\lib/auto/DBI]
LIBS => [q[ ingres.lib shell32.lib msvcrt.lib libc.lib kernel32.lib
user32.lib mpr.lib advapi32.lib netapi32.lib libcmt.lib]]
LINKTYPE => q[dynamic]
NAME => q[DBD::Ingres]
OBJECT => q[Ingres$(OBJ_EXT) dbdimp$(OBJ_EXT)]
OPTIMIZE => q[]
PREREQ_PM => { }
VERSION_FROM => q[Ingres.pm]
clean => { FILES=>q[dbdimp.c dbdimp.sc Ingres.h Ingres.sc Ingres.xsi] }
depend => { Ingres$(OBJ_EXT)=>q[Ingres.h], dbdimp$(OBJ_EXT)=>q[dbdimp.c
Ingres.h] }
dist => { DIST_DEFAULT=>q[clean distcheck disttest ci tardist],
COMPRESS=>q[gzip], SUFFIX=>q[gz], PREOP=>q[$(MAKE) -f Makefile.old
distdir] }
dynamic_lib => { OTHERLDFLAGS=>q[ ingres.lib shell32.lib msvcrt.lib
libc.lib kernel32.lib user32.lib mpr.lib advapi32.lib netapi32.lib
libcmt.lib $(COMPOBJS)] }
macro => { ESQLC=>q[D:\CA\IngresII\ingres\bin\esqlc.exe],
ESQLCOPT=>q[-o.h] }
Using PERL=D:\Perl\bin\perl.exe
Potential libraries are 'ingres.lib shell32.lib msvcrt.lib libc.lib
kernel32.lib user32.lib mpr.lib advapi32.lib netapi32.lib libcmt.lib
oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib
odbc32.lib odbccp32.lib PerlCRT.lib':
'ingres.lib' not found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\ingres.lib'
'ingres.lib' not found as 'd:/Perl/lib/CORE\ingres.lib'
'ingres.lib' not found as 'D:/Jasmine/jasmine/lib\ingres.lib'
'ingres.lib' found as 'D:/CA/IngresII/ingres/lib\ingres.lib'
'shell32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\shell32.lib'
'msvcrt.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\msvcrt.lib'
'libc.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\libc.lib'
'kernel32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\kernel32.lib'
'user32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\user32.lib'
'mpr.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\mpr.lib'
'advapi32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\advapi32.lib'
'netapi32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\netapi32.lib'
'libcmt.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\libcmt.lib'
'oldnames.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\oldnames.lib'
'kernel32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\kernel32.lib'
'user32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\user32.lib'
'gdi32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\gdi32.lib'
'winspool.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\winspool.lib'
'comdlg32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\comdlg32.lib'
'advapi32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\advapi32.lib'
'shell32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\shell32.lib'
'ole32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\ole32.lib'
'oleaut32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\oleaut32.lib'
'netapi32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\netapi32.lib'
'uuid.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\uuid.lib'
'wsock32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\wsock32.lib'
'mpr.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\mpr.lib'
'winmm.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\winmm.lib'
'version.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\version.lib'
'odbc32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\odbc32.lib'
'odbccp32.lib' found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\odbccp32.lib'
'PerlCRT.lib' not found as 'C:/PROGRA~1/MICROS~1/VC98/Lib\PerlCRT.lib'
'PerlCRT.lib' found as 'd:/Perl/lib/CORE\PerlCRT.lib'
Result: D:\CA\IngresII\ingres\lib\ingres.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\shell32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\msvcrt.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\libc.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\kernel32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\user32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\mpr.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\advapi32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\netapi32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\libcmt.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\oldnames.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\kernel32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\user32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\gdi32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\winspool.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\comdlg32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\advapi32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\shell32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\ole32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\oleaut32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\netapi32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\uuid.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\wsock32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\mpr.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\winmm.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\version.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\odbc32.lib
C:\PROGRA~1\MICROS~1\VC98\Lib\odbccp32.lib d:\Perl\lib\CORE\PerlCRT.lib
Writing Makefile for DBD::Ingres
=================================================================================================
nmake
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
mkdir blib
mkdir blib\lib
mkdir blib\lib\DBD
mkdir blib\arch
mkdir blib\arch\auto
mkdir blib\arch\auto\DBD
mkdir blib\arch\auto\DBD\Ingres
mkdir blib\lib\auto
mkdir blib\lib\auto\DBD
mkdir blib\lib\auto\DBD\Ingres
mkdir blib\man3
cp ingtest.pl blib\lib\DBD\ingtest.pl
cp Ingres.pm blib\lib\DBD\Ingres.pm
cp ingperl.pl blib\lib/ingperl.pl
cp Ingperl.pm blib\lib/Ingperl.pm
D:\Perl\bin\perl.exe -p -e "s!/\*OI\*!!" dbdimp.psc > dbdimp.sc
D:\CA\IngresII\ingres\bin\esqlc.exe -o.h dbdimp.sc
ESQL dbdimp.sc:
D:\Perl\bin\perl.exe -p -e "s/~DRIVER~/Ingres/g"
<d:\Perl\site\lib/auto/DBI/Driver.xst >Ingres.xsi
D:\Perl\bin\perl.exe -Id:\Perl\lib -Id:\Perl\lib
D:\Perl\lib\ExtUtils/xsubpp -typemap D:\Perl\lib\ExtUtils\typemap
Ingres.xs >xstmp.c && D:\Perl\bin\perl.exe -Id:\Perl\lib -Id:\Perl\lib
-MExtUtils::Command -e mv xstmp.c Ingres.c
cl.exe -c -Id:\Perl\site\lib/auto/DBI -Od -MD -DNDEBUG -TP -GX -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -Od -MD -DNDEBUG -TP -GX
-DVERSION=\"0.21\" -DXS_VERSION=\"0.21\" -ID:\Perl\lib\CORE
-DOPENINGRES Ingres.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
Ingres.c
cl.exe -c -Id:\Perl\site\lib/auto/DBI -Od -MD -DNDEBUG -TP -GX -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -Od -MD -DNDEBUG -TP -GX
-DVERSION=\"0.21\" -DXS_VERSION=\"0.21\" -ID:\Perl\lib\CORE
-DOPENINGRES dbdimp.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
dbdimp.c
dbdimp.c(23) : error C2065: 'sqlda' : undeclared identifier
dbdimp.c(24) : error C2182: 'dump_sqlda' : illegal use of type 'void'
dbdimp.c(24) : error C2146: syntax error : missing ';' before identifier
'IISQLDA'
dbdimp.c(24) : fatal error C1004: unexpected end of file found
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Stop.
=================================================================================================
dbdimp.c
# include "D:\CA\IngresII\ingres\files\eqdef.h"
/* -*- Mode: C -*-
* $Id: dbdimp.psc,v 2.114 1999/09/16 14:49:53 ht000 Exp $
*
* Copyright (c) 1994,1995 Tim Bunce
* (c) 1996,1997 Henrik Tougaard
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the Perl README
file.
*
* This file is a copy of the oracle dbdimp.c, that has been mangled,
cut
* to shreds, thrown together and shamelessly mistreated, so that it can
* have some (small) chance of success in the Ingres world.
*
* The blame for this abuse of Tim Bunce's good code lies solely on
* me: ht@datani.dk.
*
*/
# include "Ingres.h"
DBISTATE_DECLARE;
static int cur_session; /* the 'current' Ingres session_id */
static int nxt_session; /* the next 'available' session_id */
static void dump_sqlda(sqlda)
IISQLDA* sqlda;
{
int i;
if (dbis->debug < 3) return;
fprintf(DBILOGFP, "Dump of sqlda:\n");
=================================================================================================
--
-------------------------------------------------------------
Justin Carr
Senior Consultant, Thentec Group (http://www.thentec.com.au)
E-mail: justinc@thentec.com.au
Thentec Group of Companies
Mezzanine Level, 185 Moggill Road, Taringa Qld 4068, AUSTRALIA
Phone: +61 7 3371 6611 Fax: +61 7 3371 6633
Thentec - "Partnering with our clients to enhance the way they do
business"
------------------------------
Date: Wed, 13 Oct 1999 00:47:23 -0500
From: Seth David Johnson <sjohns17@uic.edu>
Subject: Re: Help building Ingres DBD on NT
Message-Id: <Pine.A41.4.10.9910130046240.305678-100000@tigger.cc.uic.edu>
On Wed, 13 Oct 1999, Justin Carr wrote:
> OK. I'm now at desperation point. I've spent the last 2 days trying to
> get the Ingres DBD to build on NT. Has anyone successfully done this
> before? If so, what am I missing? Should I even bother trying?
That's questionable. Can't this be installed via ppm?
-Seth
www.pdamusic.com
------------------------------
Date: Wed, 13 Oct 1999 17:33:07 +1000
From: Justin Carr <justinc@thentec.com.au>
Subject: Re: Help building Ingres DBD on NT
Message-Id: <380435B3.36AD3F47@thentec.com.au>
Seth David Johnson wrote:
>
> On Wed, 13 Oct 1999, Justin Carr wrote:
>
> > OK. I'm now at desperation point. I've spent the last 2 days trying to
> > get the Ingres DBD to build on NT. Has anyone successfully done this
> > before? If so, what am I missing? Should I even bother trying?
>
> That's questionable. Can't this be installed via ppm?
If only... It seems yet again that Ingres has got the short end of the
stick and there's a ppm package for every DBMS except Ingres. I would
love to be proved wrong on this.
Justin
------------------------------
Date: Thu, 14 Oct 1999 08:08:19 -0400
From: "Monmouth Internet" <nprash@monmouth.com>
Subject: Help Need Some Insight Perl and MySQL
Message-Id: <7u4h5q$j3b$1@news.monmouth.com>
I am a freelance web designer, working on a project that requires SQL, and
query lookup from the web. I am using MySQL and Perl 5, I don't know how I
should start, I know there are many different ways that I can do this, but I
just wanted to get another opinnion.
I have to create a dynamicly generated serach results for a real estate
agency, using zip OR city OR sqft. I pretty much expect this database to
sit on a UNIX server. As far as programming goes, what are my options using
MySQL and Perl, is there a better one, if so please reply
------------------------------
Date: Thu, 14 Oct 1999 10:50:37 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Help Need Some Insight Perl and MySQL
Message-Id: <mbudash-1410991050370001@ppp-216-101-156-52.dialup.snrf01.pacbell.net>
In article <7u4h5q$j3b$1@news.monmouth.com>, "Monmouth Internet"
<nprash@monmouth.com> wrote:
>I am a freelance web designer, working on a project that requires SQL, and
>query lookup from the web. I am using MySQL and Perl 5, I don't know how I
>should start, I know there are many different ways that I can do this, but I
>just wanted to get another opinnion.
>
>I have to create a dynamicly generated serach results for a real estate
>agency, using zip OR city OR sqft. I pretty much expect this database to
>sit on a UNIX server. As far as programming goes, what are my options using
>MySQL and Perl, is there a better one, if so please reply
if you use perl and DBI, it [almost] won't matter which db you use. i say
'almost', since there will need to be a DBD module for the db you choose,
but since all the majors have such modules (incl. mysql, oracle, sybase,
informix, etc.), you shouldn't have a problem.
using DBI is definitely the way to go (imho). e.g., if you choose one of
the supported db's, then change your choice later, it can be as easy as
changing *one-line* of code! plus, when using mysql, error handling is
much easier than using the Mysql.pm module.
please feel free to contact me with additional questions.
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Thu, 14 Oct 1999 11:28:07 GMT
From: Scott Beck <scott_beck@my-deja.com>
Subject: Help weird html with CGI.pm and Ispell.pm
Message-Id: <7u4enu$dsd$1@nnrp1.deja.com>
I can't seem to figure this out.
My complete header on my script is
being printed twice.
REALLY WEIRD!
I am using CGI.pm to print my header
and I am running some test scripts with
Text::Ispell. Everything is working except
for the header. I have pretty much narrowed it
down to one thing that I put in my script that
causes it but I can't see how it would cause
it.
When I call Text::Ispell::spellcheck.
Here is the test script.
#!/usr/local/bin/perl5 -w
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
use strict;
use vars qw/ $q $r /;
use Text::Ispell;
my $text = "hello hacking perl salmoning fruithammer shrdlu 42";
$q = new CGI;
print $q->header;
print $q->start_html(-title=>'Spell Check Tests',
-bgcolor=>'#FFFFFF');
Text::Ispell::allow_compounds(1);
for $r ( Text::Ispell::spellcheck( $text ) ) {
if ( $r->{'type'} eq 'miss' ) {
$r->{'misses'} =~ s/ /, /g;
print "<BR>'$r->{'term'}' was not found in the dictionary;\n<BR>\n";
print "Suggestions:<BR> $r->{'misses'}";
}
elsif ( $r->{'type'} eq 'guess' ) {
print "'$r->{'term'}' was not found in the dictionary;\n<P>\n";
print "Root/affix Guesses: $r->{'guesses'}\n<P>\n";
}
elsif ( $r->{'type'} eq 'none' ) {
print "<BR>No match for term '$r->{'term'}'\n<P>\n";
}
}
print $q->end_html;
__END__
Here is the output I get with this.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Spell Check Tests</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF">Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Spell Check Tests</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF"><BR>'perl' was not found in the
dictionary;
<BR>
Suggestions:<BR> pearl, peril, Perla, perle, per, herl, jerl, merl,
pirl, purl, peal, peel, pell, Peul, peri, perk, perm, pern, pert,
Peru<BR>No match for term 'shrdlu'
<P>
</BODY></HTML>
____END OUTPUT____
Thanks
Scott Beck
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 14 Oct 1999 14:40:46 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Help weird html with CGI.pm and Ispell.pm
Message-Id: <3805e92c.769715632@news.ford.com>
[poster cc'd in e-mail]
On Thu, 14 Oct 1999 11:28:07 GMT, Scott Beck <scott_beck@my-deja.com>
wrote:
>I can't seem to figure this out.
>My complete header on my script is
>being printed twice.
>REALLY WEIRD!
Heh. Nah, not really.
>When I call Text::Ispell::spellcheck.
Does Text::Ispell use the external program "spell" or "ispell"? I don't
have that one installed, so I couldn't tell ya. From the name, I'd guess
so.
>Here is the test script.
>
>#!/usr/local/bin/perl5 -w
>
>use CGI;
>use CGI::Carp qw/fatalsToBrowser/;
>use strict;
>use vars qw/ $q $r /;
>use Text::Ispell;
>
>my $text = "hello hacking perl salmoning fruithammer shrdlu 42";
>
>$q = new CGI;
$|=1; # Insert one of these right here.
>print $q->header;
>print $q->start_html(-title=>'Spell Check Tests',
> -bgcolor=>'#FFFFFF');
>
>
>Text::Ispell::allow_compounds(1);
I think what's biting you is buffering. Your headers, and the start_html
stuff are still sitting in a buffer waiting to go out when Text::Ispell
does a fork() in order to run "ispell". When that fork() happens, both
your program, and the fork()'d program have a copy of the headers in a
buffer waiting to go out.[1]
When ispell writes enough, or exits, that buffer flushes and you get to
copies of the header.
Putting $|=1 causes an auto-flush to happen after every print in your
program. That way, when the fork() happens, the buffer is empty.
[1] It's not really a bug, it's expected behaviour. However, I think the
upcoming 5.6 release of Perl is supposed to flush waiting buffers before
the fork() automagically so it doesn't trap unsuspecting programmers like
yourself. :)
--
Clinton A. Pierce "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org Miracles." -- Miracle Max, The Princess Bride
http://www.geeksalad.org
------------------------------
Date: Wed, 13 Oct 1999 09:03:48 -0500
From: Chakri Paila <chakri@nortelnetworks.com>
Subject: help with array usage
Message-Id: <38049144.3B916407@nortelnetworks.com>
Hi,
I have searched for two strings and when I find them I want to store
some of the fields in the $_ and use at a later stage. I search for
"called" and would like to capture the time stamp information in the
first field and the Identifier. Similarly, I would search for the "hung
up" and capture the time stamp information. After looking for the common
indentifier, I would want to do some simple calculations with the
earlier stored information related to the Identifier.
I am not clear what the approach should be. I have posted the code in an
earlier message today at 0:01 am.
TIA
++++++++++++++++++ This is the code
$[ = 1; # changing the index origination at 1
foreach $file (@ARGV) {
open(FILE,$file) || warn "Can't open $file $!\n";
$calls_made = 0;
$call_ID = 0;
$call_start = 0.0;
$call_stop = 0.0;
$call_duration = 0.0;
while (<FILE>) {
chop;
@Fld = split(' ', $_);
if (($Fld[8] =~ /called\b/) || ($Fld[9] =~ /hung up\b/)) ### This is
redundant
{
if($Fld[8] =~ /called\b/) { #setup lines are selected
$call_start{$Fld[1]}++; ### how should store the value in Fld[1] of
$_
### this is a timestamp
information
$call_ID_orig{$Fld[2]}++;
}
if($Fld[9] =~ /hung up\b/) { #released lines are selected
$call_stop{$Fld[1]}++; #### I want to use the Fld[1] value for
later use.
### My approach does'nt work
$call_ID_term{$Fld[2]}++; ### similarly Fld[2] is to be used for later
use.
}
}
}
} # end of the look
printf ("\t\t_______________\n\n\n");
$calls_made = 0;
$time_start = 0.0;
$time_stop = 0.0;
foreach $callo (keys %call_ID_orig) { ## call_ID is unique.
foreach $callt (keys %call_ID_term) {
### this is where I would want to have the stored information used. To
do simple calc.
# $time_diff = ($callt($call_stop)-$time_start);
# printf ("\n%s\t",$time_diff);
### if the call ID is the same, the timing information for these should
be used.
if ($callt == $callo)
{
#printf ("\n\n%s\t",$callt);
$calls_made++;
}
}
}
------------------------------
Date: Wed, 13 Oct 1999 14:06:11 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: help with array usage
Message-Id: <Pine.GSO.4.10.9910131358110.25558-100000@user2.teleport.com>
On Wed, 13 Oct 1999, Chakri Paila wrote:
> I have searched for two strings and when I find them I want to store
> some of the fields in the $_ and use at a later stage. I search for
> "called" and would like to capture the time stamp information in the
> first field and the Identifier. Similarly, I would search for the
> "hung up" and capture the time stamp information. After looking for
> the common indentifier, I would want to do some simple calculations
> with the earlier stored information related to the Identifier.
You seem to know what you want. But I don't understand what your problem
is. Did you have a Perl question?
If your native language is not English, please consider asking your
question in a language you are more comfortable in.
> $[ = 1; # changing the index origination at 1
Don't do that. See the docs for reasons why it's a bad idea.
> $calls_made = 0;
> $call_ID = 0;
> $call_start = 0.0;
> $call_stop = 0.0;
> $call_duration = 0.0;
There's no difference between 0 and 0.0, of course.
> while (<FILE>) {
> chop;
You probably want chomp and proper indentation. Did you learn Perl from an
old book, perhaps? Buying a newer book might be a good next step.
> @Fld = split(' ', $_);
>
> if (($Fld[8] =~ /called\b/) || ($Fld[9] =~ /hung up\b/)) ### This is
> redundant
> {
I'm not sure why you're using the word break in those patterns. It's not
_incorrect_ per se, but maybe you wanted something more like /\bcalled\b/i
instead? Of course, a pattern with a space can't match these data - but
maybe that's what the comment means?
> printf ("\t\t_______________\n\n\n");
Although this works, you probably want just plain print.
Good luck in learning Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 13 Oct 1999 10:28:19 -0500
From: Clifford Meece <cliff@scs.uiuc.edu>
Subject: help with CGI.pm
Message-Id: <3804A513.B3235083@scs.uiuc.edu>
I'm building a web interface to a program and have run into a couple of
stumbling blocks.
For one, the program takes a long time to exec, and I would like the
user to get a page letting them know that the calculation(program) is
under way, and to be patient(that part works). To do this I implemented
server push. The problem is when I send input to the external program,
normal execution occurs immediately without waiting for the process to
finish.
code:
# Open pipe to external program
open(NEXUS, "|/mnt/staff/httpd/cgi-bin/nexus1.2 > /dev/null");
# give input to external program
print NEXUS $input;
# print results
print multipart_start(-type=>'text/html');
print start_html;
print "<pre>";
open(RESULT,"<fort.1");
while (<RESULT>){
print $_;
}
print "</pre>";
$query->delete_all();
$new=1;
print end_html;
print multipart_end;
end-code
The 'print NEXUS $input;' part returns immediately. Is there a way to
wait for that process to end?
The second part of the problem is that this nexus1.2 program writes
output to a file(fort.1). I can make it write to STDOUT, but I don't
know how to redirect the output into a perl variable. This requires
having 2 filehandles I imagine, but the FAQ on this subject is a little
too brief. It basically says 'you don't want to do that'. Nexus1.2
only writes to STDOUT after it receives it's input, so I don't see a
problem doing it this way, I just need a little more detailed
instructions.
Thanks in advance,
ctm
--
===============================================================
Cliff Meece \\ Phone: (217) 333-1728
Unix Systems Administrator \\ Email: cliff@scs.uiuc.edu
School of Chemical Sciences \\ 153 Noyes Lab
University of Illinois \\
===============================================================
------------------------------
Date: Wed, 13 Oct 1999 12:16:08 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: help with CGI.pm
Message-Id: <Pine.GSO.4.10.9910131212570.14462-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 13, Clifford Meece blah blah blah:
> open(NEXUS, "|/mnt/staff/httpd/cgi-bin/nexus1.2 > /dev/null");
> print NEXUS $input;
add a
close NEXUS;
after that print statement. That will force Perl to wait until the
program is done doing whatever.
> print multipart_start(-type=>'text/html');
>
> print start_html;
> print "<pre>";
> open(RESULT,"<fort.1");
>
> while (<RESULT>){
> print $_;
>
> }
> print "</pre>";
> $query->delete_all();
> $new=1;
> print end_html;
>
> print multipart_end;
>
>
> The second part of the problem is that this nexus1.2 program writes
> output to a file(fort.1). I can make it write to STDOUT, but I don't
> know how to redirect the output into a perl variable. This requires
> having 2 filehandles I imagine, but the FAQ on this subject is a little
> too brief. It basically says 'you don't want to do that'. Nexus1.2
> only writes to STDOUT after it receives it's input, so I don't see a
> problem doing it this way, I just need a little more detailed
> instructions.
Well, you might want to use the IPC::Open2 module.
use IPC::Open2;
open2(\*READ,\*WRITE,"command","arg","arg") or die "...: $!";
# this is what you SHOULD do when you try to do
# open (FH, "| command arg arg |"); the infamous double pipe
print WRITE "input\n";
$getback = <READ>;
# etc...
close READ;
close WRITE;
--
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1061
**************************************