[13546] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 956 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 30 18:17:15 1999

Date: Thu, 30 Sep 1999 15:10:25 -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: <938729425-v9-i956@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 30 Sep 1999     Volume: 9 Number: 956

Today's topics:
        perl can not find libperl.so Robert.Lopez@abq.sc.philips.com
    Re: Perl IDE for X <gellyfish@gellyfish.com>
        Perl NOT catching Signal "INT" <sushant@ntwrks.com>
    Re: Problem with list! (Larry Rosler)
    Re: Q: Syntax to open a file in PERL on an NT server (Necromancer)
    Re: Q: Syntax to open a file in PERL on an NT server (Larry Rosler)
        Question <ICEMOUNTAIN@prodigy.net>
    Re: Recurring segmentation fault <rootbeer@redcat.com>
        RegEx for html->plain text <sushant@ntwrks.com>
        SDBM bug ? <terryking@hot-shot.com>
    Re: Server dies: <gellyfish@gellyfish.com>
    Re: strange problem with variable interpolation makau@multimania.com
    Re: strange problem with variable interpolation makau@multimania.com
    Re: strange problem with variable interpolation makau@multimania.com
    Re: strange problem with variable interpolation <sariq@texas.net>
    Re: strange problem with variable interpolation (Larry Rosler)
    Re: Suggestion - comp.lang.perl.flame (was Re: You shou (Kai Henningsen)
    Re: Suggestion - comp.lang.perl.flame (was Re: You shou <uri@sysarch.com>
    Re: using CPAN to upgrade perl version <gellyfish@gellyfish.com>
    Re: Using multiple query strings <gellyfish@gellyfish.com>
    Re: using tr? <gellyfish@gellyfish.com>
        What is the best way to design for Client/Server hand s <otis.nettles@intel.com>
    Re: You should be admired (Kai Henningsen)
    Re: You should be admired (Kai Henningsen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 30 Sep 1999 12:20:31 -0700
From: Robert.Lopez@abq.sc.philips.com
Subject: perl can not find libperl.so
Message-Id: <7t0d5v$2m32@edrn.newsguy.com>

I just rebuild perl to use shared library as per DBD::Informix README
instructions. All of the tests passed. I went on to build the TeX
version of the pod.

abqn07% cd pod
/usr/local1/Perl/perl5.005_03/pod
abqn07% make tex
 ../miniperl -I../lib pod2latex perl.pod
ld.so.1: ../miniperl: fatal: libperl.so: open failed: No such file or directory
make: *** [perl.tex] Killed
abqn07% 

I at first thought that the libperl.so had not been built. I searched back in
the build log and I found it should be at
/usr/local1/lib/perl5/5.00503/sun4-solaris/CORE/libperl.so
and I confirmed that it was just installed there and it is -r-xr-xr-x.

Then I did perl -V with these results:

abqn07% perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=solaris, osvers=2.7, archname=sun4-solaris
    uname='sunos abqn07 5.7 generic sun4m sparc '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc -B/usr/ccs/bin/', optimize='-O', gccversion=2.95.1 19990816 (release)
    cppflags='-I/usr/local1/include'
    ccflags ='-I/usr/local1/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc -B/usr/ccs/bin/', ldflags =' -L/usr/local1/lib'
    libpth=/usr/local1/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -R
/usr/local1/lib/perl5/5.00503/sun4-solaris/CORE'
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local1/lib'


Characteristics of this binary (from libperl): 
  Built under solaris
  Compiled at Sep 30 1999 11:40:53
  @INC:
    /usr/local1/lib/perl5/5.00503/sun4-solaris
    /usr/local1/lib/perl5/5.00503
    /usr/local1/lib/perl5/site_perl/5.005/sun4-solaris
    /usr/local1/lib/perl5/site_perl/5.005
    .

It appears to me that perl knows just where it is.

How to I explain the make tex failure and how do I work
around it?  The DBI, BDB etc stuff will apparently need it.

Please cc to Robert.Lopez@abq.sc.philips.com

Thanks.

-Robert Lopez



------------------------------

Date: 30 Sep 1999 21:34:26 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl IDE for X
Message-Id: <7t0l12$32o$1@gellyfish.btinternet.com>

On Thu, 30 Sep 1999 08:08:55 GMT Matthew Bloch wrote:
> In article <37F2C2FF.C7B72BA3@csudh.edu>, Francisco Romero wrote:
>>I rather use pico, it's easier.  I just want somthing that will make my life
>>easier in hacking Perl.
> 
> Nobody seems to have mentioned lpe (look it up on freshmeat.net); it's
> pico on steroids (it has syntax colouring) with aspirations to being emacs
> (it has the beginnings of a list of silly keystrokes).
> 

Fine, fine.  But I dont see editor in the name of the group - Please
see <http://www.perl.com/reference/query.cg?editors> for editors that
are particularly recommeded for working with Perl.  

The advocacy of editors is no less off-topic than web servers or OS
preferences...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Thu, 30 Sep 1999 17:03:15 -0400
From: Sushant Gargya <sushant@ntwrks.com>
Subject: Perl NOT catching Signal "INT"
Message-Id: <37F3D013.1B5CEE81@ntwrks.com>

> Hi everyone,
> Story is a little wierd, so please bear with me:
> Last night, I wrote a program on a NT machine using perl that catches
> the
> interrupt signal. It was working lastnight. This morning when I tried to
>
> interrupt the program, the signal was not being caught. After a little
> debugging I
> wrote the following bare program:
>     print "In main....\n";
>     $SIG{'INT'} = 'handler';
>     sleep(10);
>     $SIG{'INT'} = 'DEFAULT';
>      print "End of progarm";
>     sub handler {
>         print "Caught sigint\n\n";
>         exit(0);
>     }
> The output with perl 5.005:
>     ON NT Machine:
>             K:\perl>sigint.pl
>             In main....^C                      (pressed control+c here)
>             K:\perl>^C
>     ON LINUX.:
>             No output when I do "./sigint.pl";
>             When I do control+c, I get:
>                     In main....
>                     Caught sigint
> Any ideas why NT machine is not catching the sigint??? I know for sure
> it did
> last night when I first wrote the program.  Next, when the script is run
> on linux,
> I don't even see the print output (In main..), Howcome? Any help would
> be greatly
> appreciated.  Please direct all the responses to sushant@vnet.net
> -sushant



------------------------------

Date: Thu, 30 Sep 1999 14:19:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Problem with list!
Message-Id: <MPG.125d73c351ab9e1798a00c@nntp.hpl.hp.com>

In article <PaPI3.4748$gE.123521@stones> on Thu, 30 Sep 1999 19:11:13 
+0100, Cut and Paste Scripts <cutandpastescripts@exl.co.uk> says...
> Here is my problem, does anyone has a solution.  I have a value called
> $usernames which is a list of usernames people have chosen formatted like
> $usernames = "myname, nextname, nameafter"; and so on.
> 
> I want to create a HTML page which contains all the usernames, formated in a
> form like this -
> 
> <HTML>
> <BODY>
> <FORM>
> <INPUT TYPE=CHECKBOX VALUE="myname">myname
> <INPUT TYPE=CHECKBOX VALUE="nextname">nextname
> <INPUT TYPE=CHECKBOX VALUE="nameafter">nameafter
> 
> and so on.  Is this possable?  I do not know the number of usernames, the
> usernames etc.  Any ideas?

Are you familiar with loops?  Judging by your 'name', I doubt it.

If not, I would suggest you read an introductory book on programming and 
then read 'Learning Perl' from O'Reilly & Associates.  Or hire a 
programmer.

If so, read these:

perlsyn (for loops in Perl)
perldoc -f split (for how to convert a string to a list)
perldoc -f print (for how to generate output)

And read a tutorial on HTML, where you will learn that each of those 
checkboxes has to have a NAME attribute with the same value.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Thu, 30 Sep 1999 20:20:56 GMT
From: necr0mancer@myremarq.com (Necromancer)
Subject: Re: Q: Syntax to open a file in PERL on an NT server
Message-Id: <3876c4ff.102689059@news>

On Thu, 30 Sep 1999 12:42:03 -0700, lr@hpl.hp.com (Larry Rosler)
wrote:

>In article <3875b629.98891198@news> on Thu, 30 Sep 1999 19:21:10 GMT, 
>Necromancer <necr0mancer@myremarq.com> says...
>> Thanks to all who have contributed information.  I have found the
>> syntax that works.  The file resides (physically) at:
>> 
>> d:\www\client\data\data.txt
>> 
>> so, the correct way to open it (keeping ActiveState in mind) is:
>> 
>> OPEN (DATAIN, "</www/client/data/data.txt") or die "Error! $!";
>
>Why do you assume that your current drive is D: ?  That is still a 
>relative path, not an absolute path.

I cannot specify the drive letter in the syntax... the site's IP is
mapped to that location, so while I am in the site, how could the
current drive be anywhere else?


------------------------------

Date: Thu, 30 Sep 1999 14:09:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Q: Syntax to open a file in PERL on an NT server
Message-Id: <MPG.125d7167d0b19a3b98a00a@nntp.hpl.hp.com>

In article <3876c4ff.102689059@news> on Thu, 30 Sep 1999 20:20:56 GMT, 
Necromancer <necr0mancer@myremarq.com> says...
> On Thu, 30 Sep 1999 12:42:03 -0700, lr@hpl.hp.com (Larry Rosler)
> wrote:
> >In article <3875b629.98891198@news> on Thu, 30 Sep 1999 19:21:10 GMT, 
> >Necromancer <necr0mancer@myremarq.com> says...
> >> Thanks to all who have contributed information.  I have found the
> >> syntax that works.  The file resides (physically) at:
> >> 
> >> d:\www\client\data\data.txt
> >> 
> >> so, the correct way to open it (keeping ActiveState in mind) is:
> >> 
> >> OPEN (DATAIN, "</www/client/data/data.txt") or die "Error! $!";
> >
> >Why do you assume that your current drive is D: ?  That is still a 
> >relative path, not an absolute path.
> 
> I cannot specify the drive letter in the syntax...

Huh?

     OPEN (DATAIN, "<D:/www/client/data/data.txt") or die "Error! $!";

>                                                     the site's IP is
> mapped to that location, so while I am in the site, how could the
> current drive be anywhere else?

I presume you are referring to a CGI program invoked by a web server.  
There is no promise whatever as to what the current directory is when 
the CGI program starts.  Servers are free to do anything they please.

What you show is a relative path, and (as has been quoted here several 
times recently), you are living in a state of sin.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Thu, 30 Sep 1999 16:59:13 -0400
From: <ICEMOUNTAIN@prodigy.net>
Subject: Question
Message-Id: <7t0j1i$21c0$1@newssvr03-int.news.prodigy.com>

This is the part of the script that shows the cars five at a time.
Everything works except the next link. If you have time to look it over, can
you and see if you can find out what the problem is. Thanks in advance for
any help.

$MaxDisplay = 5;

%model = ("RS" => "rs",
                   "Iroc-Z" => "iroc-z",
                   "Z28" => "z28",
                   "Berlinetta" => "berlinetta");

open (ENTRIES, "gallerydata.file") || die ("Couldn't open camaro gallery
entries file.");
         @entries = <ENTRIES>;
close (ENTRIES);

$Total = @entries;
$LastArrayNumber = $Total - 1;
if ($Total < $MaxDisplay) {
 $MaxDisplay = $Total;
}

@sortentries = (@entries);
$TotalEntries = @sortentries;

if ($FORM{'startwith'} eq "") {
$startarraynum = "0";
$start = "1";
}  else {
$startarraynum = $in{'startwith'};
$start = $startarraynum + 1;
}
$MaxDisplay--;

$endarraynum = $startarraynum + $MaxDisplay;
$end = $endarraynum + 1;
if ($end > $Total) {
$endarraynum = $Total - 1;
$end = $Total;
}
$startwith = $endarraynum + 1;


if ($startwith < $Total) {
 $ContinueWording = qq(<img src=/image/blank.jpg" height=10 width=1><br><A
HREF="gallerysearch.cgi?model=$FORM{'model'}\&startwith=$startwith">Next</A>
);
}  else {
 $ContinueWording = "";
}

for $thisentry(@finalarray)  {
@entryline = split(/\|\|/, $thisentry);
chomp($entryline[6]);

if ($FORM{'model'} eq $entryline[1]) {

print <<GUTS;
<tr><td align="center">
<a
href="http://www.3gc.net/cgi-bin/scripts/gallerysearch.cgi?action=desc\&mode
l=$FORM{'model'}\&year=$entryline[2]\&num=$entryline[3]">
<img
src="/gallery/$model{$FORM{'model'}}/images/$entryline[2]$entryline[3]\small
 .jpg" height="150" width="$entryline[4]" border="0" alt="Click for larger
image and description"></a>
</td></tr>
<tr><td align="center">
<a
href="http://www.3gc.net/cgi-bin/scripts/gallerysearch.cgi?action=desc\&mode
l=$FORM{'model'}\&year=$entryline[2]\&num=$entryline[3]">
19$entryline[2] $entryline[1]</a>
</td></tr>
GUTS
;
}
}






------------------------------

Date: Thu, 30 Sep 1999 13:22:09 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Recurring segmentation fault
Message-Id: <Pine.GSO.4.10.9909301320430.17231-100000@user2.teleport.com>

On Thu, 30 Sep 1999 c_j_marshall@hotmail.com wrote:

> Except that everytime I run it it completes OK.
> When I then run it a second time I will get a segmentation fault unless
> I run 'rehash' first (I'm using csh on a solaris box)

Could it be that csh is giving the segfault, not perl? In any case, if
'rehash' (a csh builtin!) is "fixing" the problem, that's a sign that it's
more likely to be a csh bug than a Perl bug. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Thu, 30 Sep 1999 17:01:47 -0400
From: Sushant Gargya <sushant@ntwrks.com>
Subject: RegEx for html->plain text
Message-Id: <37F3CFBA.34BDE75D@ntwrks.com>

Looking for "parser" that would take an html input file and
output the file without the html tags encountered. In other words,
need a converter that converts html file to plain text file.

-sushant



------------------------------

Date: Thu, 30 Sep 1999 22:45:03 +0100
From: "Terry King" <terryking@hot-shot.com>
Subject: SDBM bug ?
Message-Id: <7t0llt$jgm$1@nclient11-gui.server.virgin.net>

I'm getting very strange behaviour using SDBM. The code here simply creates
1000 unique 5 digit hashes each time it's run but the results do not step up
in 1000's but the keys are unique.

use Fcntl;
use SDBM_File;
if (-e '/Apache/cgi-bin/test.pag'){
  tie(%hash, "SDBM_File" ,'/Apache/cgi-bin/test', O_RDWR,0640) or
error("Can't read database");
} else {
 tie(%hash, "SDBM_File" ,'/Apache/cgi-bin/test', O_CREAT|O_RDWR,0640) or
error("Can't create database");
}
for($i=0;$i<1000;$i++){
  $value = sprintf("%05d",rand(99999));
  while (defined($hash{$value})){
    $value++;
  }
 $hash{$value} = 1;
}
print scalar(keys %hash);
untie %hash;

The first time it runs and creates the database it prints it correctly. The
second time it won't necessarily display 2000.
Actually I've tested it again as I write this and I noticed the first time
the .pag file was 16k but then jumped up to 122k on the second run. I looked
at the file in notepad and there's a whole load of other files crammed in
there, corruption !. Hmmmm, I did a thorough scandisk and it said my disk is
fine. Anyone experienced problems with this ?
Thanks,
Terry






------------------------------

Date: 30 Sep 1999 21:03:24 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Server dies:
Message-Id: <7t0j6s$32a$1@gellyfish.btinternet.com>

On Thu, 30 Sep 1999 16:53:00 GMT pyammine@my-deja.com wrote:
> Hello,
> 
> I am working with IIS 4. connecting to a SQL Server 7 db with Perl
> (dist 5.005_03).
> 
> I am conducting some performance tests and things seem to work well but
> after a couple of days the IIS server dies on me. 
>

Actually I find the 'couple of days' uptime impressive - I would start
looking at the platform and the HTTP server before Perl ...

[followups set]

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Thu, 30 Sep 1999 20:32:57 GMT
From: makau@multimania.com
Subject: Re: strange problem with variable interpolation
Message-Id: <7t0hdp$jev$1@nnrp1.deja.com>

In article <m1r9jgxo0n.fsf@halfdome.holdit.com>,
  merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "makau" == makau  <makau@multimania.com> writes:
>
> makau> I want to do this :
> makau> $list = '1.2,1.3';
> makau> @list = (
> makau>     ["a","b","c","d"],
> makau>     [$list,1.4,1.5],
> makau> );
>
> makau> but perl doesn't apply the interpolation :-(
>
> makau> Any ideas?
>
> I would expect that to result in @{$list[1]} having the value
> ("1.2,1.3", 1.4, 1.5).  If that wasn't your expectation, perhaps you
> should adjust your expectation.  You have a single string, being
> inserted as a scalar into a list, so it takes up one element.
>
> If you want two elements interpolated, start with a list:
>
>     @data = (1.2, 1.3);
>
>     @list = (["a","b","c","d"], [@data, 1.4, 1.5]);
>
> There.
>
> print "Just another Perl hacker,"
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!
>


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 30 Sep 1999 20:33:59 GMT
From: makau@multimania.com
Subject: Re: strange problem with variable interpolation
Message-Id: <7t0hfm$jff$1@nnrp1.deja.com>

Thanks Randal.

You are a very talented programmer.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 30 Sep 1999 20:37:52 GMT
From: makau@multimania.com
Subject: Re: strange problem with variable interpolation
Message-Id: <7t0hmu$jpc$1@nnrp1.deja.com>

Larry, thanks for your help!

> If you want to insert a list, either split the string:
>
>       [split(/\s*,\s*/ => $list), 1.4, 1.5],

I have never thought such a split was possible.

This newsgroup's skill level is amazingly high!

(but hey, i can't complain about that :)


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 30 Sep 1999 15:55:55 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: strange problem with variable interpolation
Message-Id: <37F3CE5B.D9192BC7@texas.net>

makau@multimania.com wrote:
> 
> Thanks Randal.

Spelled correctly, even!

> You are a very talented programmer.

Hogwash.  But you oughta see him perform stand-up!

- Tom


------------------------------

Date: Thu, 30 Sep 1999 14:12:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: strange problem with variable interpolation
Message-Id: <MPG.125d72211cfe0b0e98a00b@nntp.hpl.hp.com>

In article <7t0hfm$jff$1@nnrp1.deja.com> on Thu, 30 Sep 1999 20:33:59 
GMT, makau@multimania.com <makau@multimania.com> says...
> Thanks Randal.
> 
> You are a very talented programmer.

Hey!  Toss me a bone, too.  My answer was a superset of Randal's.  :-)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 30 Sep 1999 22:48:00 +0200
From: kaih=7Pq08Bpmw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: Suggestion - comp.lang.perl.flame (was Re: You should be admired)
Message-Id: <7Pq08Bpmw-B@khms.westfalen.de>

abigail@delanet.com (Abigail)  wrote on 29.09.99 in <slrn7v3a6l.a6f.abigail@alexandra.delanet.com>:

> Matthew O. Persico (mpersico@erols.com) wrote on MMCCXX September
> MCMXCIII in <URL:news:37F1662F.F30801C2@erols.com>:

> ~~ None of these (to me anyway) is what I consider obvious enough for a
> newbie ~~ to stumble across. So what does s/he do next? Turns to the
> B<language> that ~~ is being used to implement cgi and that leads them
> straight to ~~ comp.lang.perl.misc.

# must ... not ... flame ... about ... nonstandard ... quoting ...

> And? Just because newbies can't find the obvious group, a new group in
> the wrong hierarchie should be created? That's stupid.

Well yes, the world often *is* stupid. You hadn't noticed?

Don't think of it as accommodating the idiots. Think of it as a fly trap.

Kai
-- 
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
  - Russ Allbery (rra@stanford.edu)


------------------------------

Date: 30 Sep 1999 18:03:22 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Suggestion - comp.lang.perl.flame (was Re: You should be admired)
Message-Id: <x7iu4suket.fsf@home.sysarch.com>

>>>>> "KH" == Kai Henningsen <kaih> writes:

  >> ~~ None of these (to me anyway) is what I consider obvious enough
  >> for a newbie ~~ to stumble across. So what does s/he do next? Turns
  >> to the B<language> that ~~ is being used to implement cgi and that
  >> leads them straight to ~~ comp.lang.perl.misc.

  KH> # must ... not ... flame ... about ... nonstandard ... quoting ...

<KIRK>
if ... you .. continue ... to ... jeopardy .... quote .... usenet
 ... will  .... cease ... to .... exist!
</KIRK>
<MCCOY -- RIP> 
that newbie's brain dead, jim. i'm a doctor not a perl hacker
</MCCOY> 

  >> And? Just because newbies can't find the obvious group, a new group
  >> in the wrong hierarchie should be created? That's stupid.

  KH> Well yes, the world often *is* stupid. You hadn't noticed?

  KH> Don't think of it as accommodating the idiots. Think of it as a
  KH> fly trap.

you mean create a group like c.l.p.gurus and have no gurus subscribe? i
like it. reverse psychology to get the clueless out of here. hell, send
them to alt.perl. i don't mind newbies unless they show no clue about
usenet or computer stuff in general.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


------------------------------

Date: 30 Sep 1999 21:22:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: using CPAN to upgrade perl version
Message-Id: <7t0ka0$32k$1@gellyfish.btinternet.com>

On 30 Sep 1999 03:20:37 GMT Danny Aldham wrote:
> X-Newsreader: TIN [version 1.2 PL2]
> 

Hmm thats broken behaviour - I would get a more recent version.

> I am not sure I would want to, but is it possible to use the CPAN module
> to actually upgrade the version of perl running?
> 

Try i /Perl/ and see what it gives you - I actually did this by accident
once by trying to install some module that only comes as part of the
core Perl installation ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 30 Sep 1999 21:58:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Using multiple query strings
Message-Id: <7t0mek$32s$1@gellyfish.btinternet.com>

On Thu, 30 Sep 1999 12:36:38 -0400 Donboy wrote:
> 
>> In article <EXyI3.5566$xJ4.272031@newscontent-01.sprint.ca>,
>> "Vox" <v0xman@yahoo.com> writes:
>> > I've also been programming cgi with perl for about a couple of months
> now
>> > with no book but the tutorials on the net and pieces of other code put
>> > together.  I had this same problem not too long ago.
>> >
>> > you don't need 'read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});' for query
>> > strings.  Also $buffer = "$buffer\&$ENV{'QUERY_STRING'}";  really is
>> > unnessary
>> -Vox
> 
> 
> Hey Vox!  Glad to see I'm not alone in the world!!!  I've been scabbing
> scripts together for about a year now.  I've never had any formal classes,
> but I would love to take a few.  Maybe we can exchange notes sometime!
> Thanks for the tips!!!  Those should really help me.  
> 

I wouldnt - Unless you understand what it is that you are dealing with it
is a great mistake to be using this handrolled query parsing code.  

You should read the CGI specification at:

<http://hoohoo.ncsa.uiuc.ed/cgi>

and the CGI FAQ at:

<http://www.webthing.com/tutorials/cgifaq.html>

You will probably want to read rfc1945 which describes HTTP 1.0 as this
explains some of the core ideas.

Unless you understand what is happening here and understand the code
required to deal with it you would be highly recommended to use a well
debugged and supported module like CGI.pm to do this stuff.

> 
>> Gawddd no. Not again. Is some one breeding these idiots just to annoy us?
> 
> 
> I'm not sure what to make of this.  Ian, I really appreciate the help, but
> do you think it's necessary (or productive) to be so condescending?  
>
<blah blah>
> 

Don't, Just Don't OK .. You asked this in the wrong newsgroup in the 
first place.  Go back and read some of the articles in news.announce.newusers.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 30 Sep 1999 20:10:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: using tr?
Message-Id: <7t0g4d$320$1@gellyfish.btinternet.com>

On Thu, 30 Sep 1999 16:03:20 GMT amonotod wrote:
> In article <37F3769B.5A0638C7@texas.net>,
>   Tom Briles <sariq@texas.net> wrote:
>> James Stevenson wrote:
>> >
>> > Hi
>> >
>> > could somebody please send me an example of useing
>> > tr in perl
>>
>> #!/usr/bin/perl -w
>>
>> use strict;
>>
>> print 'tr';
>>
>> If you look closely, you'll see that I managed to use 'tr' more than
>> once!
>>
>> > thanks
>>
>> You're welcome.
>>
>> HTH.  HAND.
>>
>> - Tom
>>
> 
> Tom,
>   You rock!  That was even better than an Abagail reply!
> 

Now I know what happened to my pet rock all those years ago - I didnt
lose it, it evolved into Tom Briles ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Thu, 30 Sep 1999 13:42:09 -0700
From: "Otis Nettles" <otis.nettles@intel.com>
Subject: What is the best way to design for Client/Server hand shaking/communication
Message-Id: <7t0hv5$3j5@news.or.intel.com>

Hello,

I'm working on a client/server app in which I need to have the client give
the server commands, which the server then processes, and sends back the
results.

I'm using IO::Socket and IO::Select, and nonblocking reads.

My server works great when I telnet to it and issue the commands, but when I
try and have the client talk to the server, there seem to be some
synchronization issues.

What is the best way to implement this type of design?

Currently, my server runs in a loop, waiting for commands, for which it may
have to prompt the client for additional commands or parameters.

For instance, if the Client issues the command NEW_TICKET, then the server
determines if the connection to the database has been established yet.  If
not, it needs to prompt the client for server, username, and password, get
the answer back for each of these, and then perform the login, create the
ticket, and send the results back to the client.

On the server side, the client is also set up to run in a loop.  It tries to
recognize the various command prompts issued by the server (i.e,. Command?,
Server:, User:, etc), issue the corresponding command, and wait for
response.

What seems to be happening is that the client and server don't seem to be
waiting for each other correctly.

I've included the initialization and main loops from both the server and the
client.  Thanks for any help.

server
my $sock = IO::Socket::INET->new(LocalAddr => $myhost,
                                 LocalPort => $port,
                                 Listen => 5,
                                 Proto => 'tcp',
                                 Reuse => 1);

die "Can't create listen socket: $!" unless $sock;
print "Listening for connections on port $port\n";
$sock->autoflush(1);

my $readable = IO::Select->new;
my $errors = IO::Select->new;
$readable->add($sock);
open(LOG,">server.log") || die "Could not open log: $!\n";
while (1) {
print STDERR "";
    my ($ready) = IO::Select->select($readable, undef, $errors, 1);
    foreach my $s (@$ready) {
#print STDERR "inner loop\n";
        # see if this is a new connection
        if($s == $sock) {
            my $new_sock = $sock->accept;
            # add it to our read set
            $readable->add($new_sock) if $new_sock;
            welcome($new_sock);
        }
        # nope, it's something that's ready to read
        else {
#print STDERR "else\n";
            # try to read a line
   print $s "\n";
   print $s "Command? \n";
   #select $s;
   #$| = 1;
   if ($errors->has_error($CONN_TIMEOUT)){
     print STDERR "Client error occurred\n";
#                 $readable->remove($s);
#                 $errors->remove($s);
#                 $s->close;
                 # just notify us that someone shut down
                 # if we cared who, we could map the sock
                 # to the client address, but we don't...
                 print STDERR "Client Connection closed\n";
   }
   if ($readable->can_read($CONN_TIMEOUT)){
print STDERR "\n";
             my $buf = <$s>;
             # see if the client closed the socked
             if( defined $buf ) {
     print LOG "Got command $buf\n";
                 process_command($buf, $s);
             }
             # yup, it's closed
             else {
     print LOG "No client found\n";
                 $readable->remove($s);
     $errors->remove($s);
                 $s->close;
                 # just notify us that someone shut down
                 # if we cared who, we could map the sock
                 # to the client address, but we don't...
                 print LOG "Client Connection closed\n";
             }
         }
  }
    }
}

Here's an example of where the client issues more prompts, and tries to get
the clients answers:

  print $s "Server Name: \n";
  $cmd = <$s>;
  $input{ARS_SERVER} = &clean_commands($cmd);
  print $s "Login Name: \n";
  $cmd = <$s>;
  $input{USERNAME} = &clean_commands($cmd);
  print $s "PASSWORD: \n";
  $cmd = <$s>;
  $input{PASSWORD} = &clean_commands($cmd);
  $ARS_SERVER = $input{'ARS_SERVER'} if ($input{'ARS_SERVER'});
  print $s "Attempting connection $ARS_SERVER . . . ";
  print LOG "Attempting connection to $ARS_SERVER for user $input{USERNAME}
 . . . ";



----------------------------------------------------------------------------
----------------
# client

# connect to server

my $remote = IO::Socket::INET->new(
              Proto => 'tcp',
              PeerAddr => $host,
              PeerPort => $port,
              Type => SOCK_STREAM) or die $!;

print STDOUT "SUCCESSFULLY CONNECTED TO $host ON PORT $port\n";

$remote->autoflush(1);

my $ClientData = new IO::Select(*STDIN);
my $RemoteData = new IO::Select($remote);
my $TimeOut = 1;
my $buffer;


while(1){
  $lcount ++;
   last if $exitProgram;
   unless ($RemoteData->exists($remote)){
        last;
   }
   if ( $RemoteData->has_error(0)){
        print STDERR "Got error\n";
        print $remote "Quit\n";
        last;
   }

   if( $ClientData->can_read(0) )
      {
   #     print  STDERR "ClientData->can_read\n";
        my $DataToServer = <STDIN>;
   #     print "Sending $DataToServer to server\n";
        #chomp( $DataToServer );
        print $remote $DataToServer;
        #send($remote, $DataToServer,0);
        last if $DataToServer =~ /quit/i;
        last if $DataToServer =~ /shutdown/i;
   }

   if ( $RemoteData->can_read(0) )
      {
#       print STDERR "RemoteData->can_read\n";
        $lcount = 0;
        &process($remote); next;
        $buffer = <$remote>;
        print "$buffer";
   }
   if ($lcount > 30){
      $lcount = 0;
      print $remote "\n";
   }
   last if $exitProgram;
   #print "looping\n";
}
do dokill();
exit(0);

sub process{
    local ($sock) = shift;
   $_ = <$sock>;
   print;
#print STDERR "processing ";
        if (/Server Name/){
            print STDERR "ats0.sc.intel.com\n";
            print $sock "rasats1.ra.intel.com\n";
        }
        elsif (/Schema Name:/){
            print "$input{'schema'}\n";
                print $sock "$input{'schema'}\n";
        }
        elsif (/Login Name:/){
                print "ownettle\n";
                print $sock "ownettle\n";
        }
        elsif (/PASSWORD:/){
                print  "test\n";
                print $sock "test\n";
        }
        elsif (/How many keys/){
                print "11\n";
        elsif (/^Key/){
                print "$keyarray[$index]\n";
                print $sock "$keyarray[$index]\n";
                $index ++;
        }
        elsif (/^Value/){
                print "$fieldList{$keyarray[$index]}\n";
                print $sock "$fieldList{$keyarray[$index]}\n";
        }
        elsif (/Command/){
                if ($ticketMade){
                        print "Quitting . ..\n";
                        print $sock "QUIT\n";
                }elsif ($sentCmd ++){
                     print "Waiting for command completion\n";
                }else{
                $sentCmd ++;
                print "ARS_NEW_TICKET\n";
                print $sock "ARS_NEW_TICKET\n\n";
                }
        }
        elsif (/OK Welcome/){
                #print $sock "\n";
        }
        elsif (/Successfully created ticket/){
                $ticketMade ++;
        }
        elsif (/Fool! You have been denied/){
                print "Quitting .  .  .\n";
                print $sock "QUIT\n";
                $exitProgram ++;
        }
}





------------------------------

Date: 30 Sep 1999 22:10:00 +0200
From: kaih=7Pq07YB1w-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: You should be admired
Message-Id: <7Pq07YB1w-B@khms.westfalen.de>

uri@sysarch.com (Uri Guttman)  wrote on 23.09.99 in <x74sgl4j01.fsf@home.sysarch.com>:

> >>>>> "KP" == Kent Perrier <kperrier@blkbox.com> writes:

KP>> This is what all new readers of ANY news group should do.  Except that
KP>> the standard lurking time is two weeks, not three months.

> for some very small values of two weeks, it seems.

In a busy group (like this one), it's possible to just read a hundred or  
so articles currently on the spool and get a pretty good feel for how the  
group works.

Of course, people don't actually do even that. Otherwise, they'd not ask  
HTML questions here.

Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
  - Russ Allbery (rra@stanford.edu)


------------------------------

Date: 30 Sep 1999 22:38:00 +0200
From: kaih=7Pq07qZ1w-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: You should be admired
Message-Id: <7Pq07qZ1w-B@khms.westfalen.de>

spamfree@metropolis.net.au (Henry Penninkilampi)  wrote on 24.09.99 in <spamfree-2409990516010001@d6.metropolis.net.au>:

> I don't know.  This is all pure speculation.  Personally, I only know two
> female programmers and they are both into frighteningly hardcore C/C++.
> Not statistically significant, by any stretch of the imagination, but it's
> two data points you can use...

I currently personally know one (as in, have sat on the same table, as  
opposed to, say, Usenet - and in any case, programming doesn't exactly  
seem to be her job description anyway), and she's doing Perl.

Kai
-- 
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
  - Russ Allbery (rra@stanford.edu)


------------------------------

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 956
*************************************


home help back first fref pref prev next nref lref last post