[7399] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1024 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 14 21:07:19 1997

Date: Sun, 14 Sep 97 18:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 14 Sep 1997     Volume: 8 Number: 1024

Today's topics:
     automatically generating regex patterns (Snow White)
     Re: automatically generating regex patterns <rootbeer@teleport.com>
     compiling perl 5.004 on linux 2.* with Dynaloader <ptrainor@aura.title14.com>
     Graphics in Perl <kalpana@ece.vill.edu>
     Re: Graphics in Perl <rootbeer@teleport.com>
     Guestbook eric@wicksend.com
     Re: HELP! subroutine is making me cry! <sue_chen@ix.netcom.com>
     Re: How can I tell which modules are installed ? <jerryp.usenet@SPAMconnected.demon.co.uk>
     Re: Howto Parse data in spaced columns??? <matthew.rice@ftlsol.com>
     Re: Howto Parse data in spaced columns??? (Bart Lateur)
     memory leak with concatenation operator <gargash@ix.netcom.com>
     Re: memory leak with concatenation operator <rootbeer@teleport.com>
     Re: Method call bug <fawcett@SPAMLESS.nynexst.com>
     Re: Method call bug <rootbeer@teleport.com>
     Newbie Question: Passing parameters <jmotter@fgi.net>
     Re: NT 4.0 twod@not.valid
     Reading stdin on Win32 and in a portable way. <w.stanton@auckland.ac.nz>
     Re: Reading stdin on Win32 and in a portable way. <w.stanton@auckland.ac.nz>
     Streaming chat mode with Perl running on Win32s. Any id <icon@lambuth.edu>
     Re: Streaming chat mode with Perl running on Win32s. An <rootbeer@teleport.com>
     Re: unshift function <rootbeer@teleport.com>
     why exec finger doesnt work!!!?? <nrana@aludra.usc.edu>
     Re: why exec finger doesnt work!!!?? <rootbeer@teleport.com>
     Win95 cgi <ian.dickson@btinternet.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 14 Sep 97 15:56:08 EDT (-0400)
From: anybody2@nospam.bellsouth.net (Snow White)
Subject: automatically generating regex patterns
Message-Id: <874270568.5365@bellsouth.net>


Any modules for generating regex patterns from a set of strings?

NOTE:  I am looking for something more elegant than:

  str1, str2, str3, str4 "generates" (str1|str2|str3|str4}

Also, what about the inverse operation of taking a pattern
and generating all possible strings (for those patterns only
that generate a finite set, of course)?

Thanks for any pointers.



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

Date: Sun, 14 Sep 1997 16:41:48 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Snow White <anybody2@nospam.bellsouth.net>
Subject: Re: automatically generating regex patterns
Message-Id: <Pine.GSO.3.96.970914163641.26125D-100000@julie.teleport.com>

On Sun, 14 Sep 1997, Snow White wrote:

> Any modules for generating regex patterns from a set of strings?

Sure:

    sub patternmaker {
	'[\d\D]'; 
    }

:-)

Although you could make subroutine to generate a pattern based upon a
number of strings you wish to match, it wouldn't be very useful in the
real world. There's no way to generate a regular expression that's
substantially easier than writing one, in general.

For good advice on writing one, get the Hip Owls book. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sun, 14 Sep 1997 14:57:50 -0400
From: Pat Trainor <ptrainor@aura.title14.com>
Subject: compiling perl 5.004 on linux 2.* with Dynaloader
Message-Id: <Pine.LNX.3.95.970914143051.991B-100000@aura>


	No room on the subject line to say that this wasn't a pleasant
story. 
	After several attempts at compiling perl on the above box, it was
evident that getting DynaLoader to install properly was going to be a
pain.
	Msqlperl was the major problem (MsqlPerl-1.11), as this was/is the
exhumed report:

Can't load module Msql, dynamic loading not available in this perl.
  (You may need to build a new perl executable which either supports
  dynamic loading or has the Msql module statically linked into it.)
 at /web/htdocs/pc/digest.pl line 6
BEGIN failed--compilation aborted at /web/htdocs/pc/digest.pl line 6

	I guess I don't have to, but here's line 6:

use Msql;

	Anyway, a search in FAQs and WWW revealed that DynaLoader was
originated from:

/usr/src/perl5.004/ext/DynaLoader/

	And the README there says:

"The dl_*.xs files should either be named after the dynamic linking
operating system interface used if that interface is available on more
than one type of system, e.g.:
        dlopen  for dlopen()/dlsym() type functions (SunOS, BSD)
        dld     for the GNU dld library functions (linux, ?)
or else the osname, e.g., hpux, next, vms etc."

	..the files in the dir (and choices in Configure are:

root[/usr/src/perl5.004/ext/DynaLoader]> ls -l *xs
-r--r--r--   1 root     root        13270 Jan 24  1997 dl_aix.xs
-r--r--r--   1 root     root         3589 Apr  4 16:50 dl_cygwin32.xs
-r--r--r--   1 root     root         4754 Jan 24  1997 dl_dld.xs
-r--r--r--   1 root     root         6130 Apr 23 14:20 dl_dlopen.xs
-r--r--r--   1 root     root         3784 May  8 11:24 dl_hpux.xs
-r--r--r--   1 root     root         6801 Apr 25 09:55 dl_next.xs
-r--r--r--   1 root     root          272 Oct 18  1994 dl_none.xs
-r--r--r--   1 root     root        12931 Apr 24 13:14 dl_vms.xs

	..so.. I assumed dl_dld.xs was for the linux i586 box.

	Here's some notes from sh Configure:

Use which C compiler? [cc] 
 
Checking for GNU cc in disguise and/or its version number...
You are using GNU cc 2.7.2.1.

------

Checking for optional libraries...
No -lsfio.
No -lnet.
No -lsocket.
No -linet.
No -lnsl.
No -lnm.
Found -lndbm (shared).
Found -lgdbm (shared).
Found -ldbm (shared).
Found -ldb (shared).
No -lmalloc.
Found -ldl (shared).
No -ldld.
No -lld.
No -lsun.
Found -lm (shared).
Found -lc (shared).
No -lcposix.
No -lposix.
No -lndir.
No -ldir.
No -lcrypt.
No -lucb.
No -lBSD.
No -lPW.
No -lx.
 
--------- eek!

	I think this may have something to do with my problem:

Checking your choice of C compiler, libs, and flags for coherency...
I've tried to compile and run a simple program with:

        cc -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include
-L/usr/local/lib -o try try.c -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc
        ./try

and I got the following output:

/usr/i486-linux/bin/ld: cannot open -ldl: No such file or directory
I can't compile the test program.
(The supplied flags might be incorrect with this C compiler.)
 
You have a BIG problem.  Shall I abort Configure [y] 

----------

	mind you, /usr/i486-linux/bin/ld _is_ there, it's another file
it's arguing about.

	If I continue on, hoping for the best, I notice there is a problem
with pp.o/pp.c compiling. I trust I don't have to bore you with that
output. 
	Anyway, my 5.003 +suid patch was from a cd distribution, and
worked well. So, after I force it through and try it, I realize how bad
this is, and restore the /usr/binperl link to the old 5.003 executable.
One thing is wrong, though.. Now all access to dbm files that was ok with
5.003 does not work. Core dumps, error_log shows incomplete script
(really?!).
	I'll re-write the dbm access scripts to use msql, but now I seem
to be stuck between versions, unable to fully either go back or go ahead.

	Any ideas, or similar horror stories? If I'm ignorantly leaving
some scrap of pivotal info out, forgive me as I just got pretty
comfortable with the programming in perl! Now the compilation is kicking
my butt!

	As always, thanks very, very much in advance.

pat 	
:)
  	
#        ptrainor@aura.title14.com (PT46) ptrainor@bbnplanet.net
#  Perl, PHP/FI, *NIX, HTML, CGI, SQL, RDBMS, NT*, Security, Admin, ... 
# "I've got LOTS of experience doing practically nothing!" -Heffer Wolfe



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

Date: Sun, 14 Sep 1997 12:22:56 -0400
From: Kalpana Reddy Kothapally <kalpana@ece.vill.edu>
Subject: Graphics in Perl
Message-Id: <Pine.SV4.3.95.970914122020.17048A-100000@ernie.ee.vill.edu>


Hi all,

I would like to know if there is anyway of displaying a barchart graph
using PERL assuming that the output device is emulating a Tek terminal..

I do know that there are some functions like graph(1). But I am unable to
use it for my needs...

Thanks
 ..Kalpana



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

Date: Sun, 14 Sep 1997 16:45:50 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Kalpana Reddy Kothapally <kalpana@ece.vill.edu>
Subject: Re: Graphics in Perl
Message-Id: <Pine.GSO.3.96.970914164531.26125F-100000@julie.teleport.com>

On Sun, 14 Sep 1997, Kalpana Reddy Kothapally wrote:

> I would like to know if there is anyway of displaying a barchart graph
> using PERL assuming that the output device is emulating a Tek terminal..

If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-)  Hope this helps!

    http://www.perl.org/CPAN/
    http://www.perl.com/CPAN/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sun, 14 Sep 1997 15:37:18 -0600
From: eric@wicksend.com
Subject: Guestbook
Message-Id: <874268806.19366@dejanews.com>

I am presently using a guestbook program that was modified with webstar
for the mac and is an exe. Does anyone know of a guestbook script written
in perl that has the ability to take input from a form and write output to
MORE THAN ONE existing html file. This output needs to be inserted into a
specific place within the existing html files...Thanks for any info..>ERic

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Sun, 14 Sep 1997 15:32:48 -0700
From: Sue Chen <sue_chen@ix.netcom.com>
To: dlripber@one.net
Subject: Re: HELP! subroutine is making me cry!
Message-Id: <341C6610.8AB7643E@ix.netcom.com>

> I'm sure you will get better help in this group, but I'm acting fast
> to get in a suggestion on this one :)
>
> To do this I will assume the subroutine works from a shell account on
> a UNIX machine, but does not work when ran from the browser.  This may
>
> be because you are writing to a directory owned by you.  Problem can
> occur from browser if browser logs on as a different user, which is
> what happens at my ISP.  It can be solved by either writing to a
> directory that you make writable by the browser uid, or by enabling
> setuid for the perl script via a C wrapper.  I won't go into details
> unless you think I guessed the problem.
>
> Sorry if I completely missed the mark.
>
> Dave

Dave:

  Your guess should be true to my situation now.  I run the program
perfectly in my account or even the cgi-bin directory, but behavior
weirly on the brower, like, I can't open the text file to read and can't
pipe the data from a java program.

  Can you tell me how to set the uid up? I just got my feet wet in the
Unix system.

Thanks
Sue



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

Date: Sun, 14 Sep 1997 19:56:52 +0100
From: Jerry Pank <jerryp.usenet@SPAMconnected.demon.co.uk>
Subject: Re: How can I tell which modules are installed ?
Message-Id: <NfyjAAA0NDH0EwBB@connected.demon.co.uk>

>From the divine hand of  Tom Phoenix
Tom Phoenix <rootbeer@teleport.com>, fell this pearl:
>On Sat, 13 Sep 1997, Jerry Pank wrote:
Hi Tom
>
>> My ISP gives me a very limited shell, (only the safest /bin commands are
>> available) and for security? will not allow perl to be run from the
>> command line. 
Extra question Tom, while I've (hopefully) got your attention!
        If I can't run perl from the command line, does this mean I 
        can't run makefile to install modules ? | is there another way
        to do this from a script ?
>> 
>> This has not caused me problems so far but I can't seem to find which
>> perl modules are already installed on the server by snooping about. 
>> 
>> Is there an easy way to find exactly which module are already installed? 
>
>Yes: Ask the sysadmin. :-)  But if the sysadmin won't let you run Perl,
OK, that is the easiest way.  But you learn by doing things the hard way
don't you? :o)
>IMHO you should install a new one. :-)
But they are such nice friendly people !
>
My ISP, Demon (BIG on this side of the pond) lets me run Perl but only
by calling a script, not from the command line.  If I Telnet to my site
and type 'perl any_legal_command' It answers with 'perl : not found'   

>But it wouldn't be hard to write a program to run on a web server which
      any clues or FAQs ?  _______//_______________________//   
                   
>would report the names of installed modules. Is that the kind of server
>you mean, or is it a news server, FTP server, or domain name server you're
>talking about? :-)
Yes, the server where my web pages and my scripts are held.


Thanks for your help.
You (and many others) make this ng. such an enjoyable read !
--      Jerry Pank
This post in every-way totally reflects the views of my employer...
I am he.
jerryp(dot)usenet(at)connected(dot)demon(dot)co(dot)uk



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

Date: Sun, 14 Sep 1997 11:40:30 -0400
From: Matthew Rice <matthew.rice@ftlsol.com>
To: nospam.gibsonc@aztec.asu.edu
Subject: Re: Howto Parse data in spaced columns???
Message-Id: <341C056E.78CE0C03@ftlsol.com>

Gip wrote:
> How do I parse data out of the following computed text file, you can
> assume no tabs, just plain old spaces:
> 
> column 1         column 2               column 3               column4
> 
> aaa                  bbb                       ccc
> ddd
> eee                                                     fff
> 
> I want to be able to know that fff is in column 4, and that ccc is in
> column 3.

Are the columns of equal width?  If so then try this script (set $length
as appropriate) and send the data as stdin (eg. script < data_file):

#!/usr/bin/perl -w

$length = 10;

while (<>) {
    chop;
    $line++;
    $col = 0;
    print map { $col++; "$line $col: $_\n"; } /.{1,$length}/g;
}

It's up to you to strip surrounding whitespace.
Even if the widths aren't equal it isn't much harder.  Also you could
just assign the values to a list, a la:
	@list = /.{1,$length}/g;

Please excuse the (possibly) bad formatting.  I'm stuck posting
news with netscape until I can get Pnews working.
-- 
Matthew Rice                             e-mail: matthew.rice@ftlsol.com


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

Date: Sun, 14 Sep 1997 22:42:11 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Howto Parse data in spaced columns???
Message-Id: <342067eb.1582828@news.tornado.be>

Funny that no-one thought of unpack.

smonson@tri.sbc.com (Steve Monson) wrote:

>Gip  <nospam.gibsonc@aztec.asu.edu> wrote:

>>How do I parse data out of the following computed text file, you can
>>assume no tabs, just plain old spaces:
>>>>column 1         column 2               column 3                column 4
>>
>>aaa                  bbb                       ccc
>>ddd
>>eee                                                     fff
>>
>>I want to be able to know that fff is in column 4, and that ccc is in
>>column 3.

>column 1 is 17 characters wide (1-17)
>column 2 is 23 characters wide (18-40)
>column 3 is 24 characters wide (41-64)
>column 4 is the rest.

	@col = unpack("A17A23A24A*",$_);

This will strip trailing whitespaces in the colums too.


Or, if the ciumns aren't fixed width, the next will assume columns are
divided by at least two spaces:

	@col = split(/  +/);

HTH,
Bart.


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

Date: Sun, 14 Sep 1997 15:03:26 -0600
From: Scott Gargash <gargash@ix.netcom.com>
Subject: memory leak with concatenation operator
Message-Id: <341C511E.663F@ix.netcom.com>

I've found a memory leak when using perl v5.004_01 when using 
the concatenation operator (the dot operator) and implicit type 
conversion from integers to strings. Here's a short test case 
that exhibits the behavior:

#!/usr/local/bin/perl
$var = "0001110000";
for ( $i = 0; $i < 5000000; $i++ ) {
  if ( !( $i % 10000 ) ) { print "done with $i iterations\n"; }
  dummy ( $var );
}

sub dummy {
  my $var1 = shift;

  my $var2 = 0;        # this leaks
#  my $var2 = "0";      # this doesn't

  my $var3 = $var1 . $var2;
  return;
}

Now I have found a workaround (always use strings), but the camel 
book implies that this should work (p15-16). If anyody has been 
having trouble with leaks, they may want to look for this in their 
code.

	Scott


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

Date: Sun, 14 Sep 1997 16:49:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Scott Gargash <gargash@ix.netcom.com>
Subject: Re: memory leak with concatenation operator
Message-Id: <Pine.GSO.3.96.970914164852.26125H-100000@julie.teleport.com>

On Sun, 14 Sep 1997, Scott Gargash wrote:

> I've found a memory leak when using perl v5.004_01 

If you can reproduce it in 5.004_03 (which is currently an unreleased test
version) then please run perlbug to report it. Thanks!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 14 Sep 1997 14:48:02 -0400
From: Tom Fawcett <fawcett@SPAMLESS.nynexst.com>
Subject: Re: Method call bug
Message-Id: <8jvi03wx3x.fsf@SPAMLESS.nynexst.com>

Krisztian Flautner <manowar@sauropod.engin.umich.edu> writes:
> Below is a small program I tried:
>[MOST OF PROGRAM DELETED]
> 
>     package main;
> 
>     $a = new test;
> 
>     print $a, "\n";
>     $a->print();
> 
>     %ttt = ();
>     $ttt{$a} = 1;
> 
>     foreach $key (keys %ttt) {
>         print $key, "\n";
>         $key->print();
> 
>
> I got the following output using perl5.003 and perl5.004 on
> Solaris and HP-UX machines:
> 
>     test=HASH(0x227c50)
>     hehehe
>     test=HASH(0x227c50)
>     Can't call method "print" in empty package "test=HASH(0x227c50)"
>     at ./ttt line 42.
> 
> 
> I do no understand why this code would produce an error. Does the
> key somehow forget what class it belongs to? 
> 
> Is this a bug in perl5 or am I doing something wrong?

You're doing something wrong.  Hash keys are strings.  When you say
$ttt{$a}=1 you're saying $ttt{"test=HASH(0x227c50)"}=1.  The hash key is
just a string, not a blessed reference, hence the error.

-Tom



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

Date: Sun, 14 Sep 1997 16:33:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Krisztian Flautner <manowar@sauropod.engin.umich.edu>
Subject: Re: Method call bug
Message-Id: <Pine.GSO.3.96.970914162915.26125B-100000@julie.teleport.com>

On 13 Sep 1997, Krisztian Flautner wrote:

>     foreach $key (keys %ttt) {
>         print $key, "\n";
>         $key->print();

Keys of a hash are always stringified, so they no longer have the magic of
references. Maybe a future version of Perl will make this possible, but
it's not in the current implementation.

One (possibly awkward) way to get around this is to use the fact that the
stringification of a reference is guaranteed to be unique (at least, so
long as the reference itself is valid). So you could have a hash whose
keys are the stringifications and whose values are the actual objects.

    $object{$obj} = $obj;		# Stash the ref until later

     . . . 

    foreach $key (keys %ttt) {
	my $real_obj = $object{$key};
	print $key, "\n";
	print $real_obj, "\n";		# should be same output twice
	$real_obj->print();

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 14 Sep 1997 23:59:28 GMT
From: "Jeff Motter" <jmotter@fgi.net>
Subject: Newbie Question: Passing parameters
Message-Id: <01bcc16b$9f741e60$2a4682d0@mott1>

I have a script named "me.pl" and I want to pass a filename to the script
when it is started.
Ex: c:\perl\me.pl data.txt".

What would be the variable for the file "data.txt" in the script.  I'm
going to open the file
in the script to parse it.



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

Date: 14 Sep 1997 23:52:32 GMT
From: twod@not.valid
Subject: Re: NT 4.0
Message-Id: <5vhtc0$9dv$1@vnetnews.value.net>

webadmin (webadmin@prestel.net) wrote:
: Is there perl for NT 4.0 on the web somewhere.

The Perl for Win32 FAQ can be found at :

http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html

It features the URLs for a couple of win32 ports including NT4.0

Also be aware that PERL5.004 will compile under NT if you have a C compiler
such as MS Visual C++, Borland C++ or the Cygnus port of gcc. I compiled
a version using VC++ along with some modules and everything works just fine.

: Also are there any helpful guides. i can do perl on unix, I just need to
: know if theres anything special/different that I should know about

Read the FAQ.

IAP



: Iqbal

--
In an attempt to reduce junk email I use an invalid 'From' address.
My correct email address can be determined by replacing 'not.valid' with with
'value.net'


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

Date: 15 Sep 1997 11:05:49 +1300
From: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: Reading stdin on Win32 and in a portable way.
Message-Id: <wkzppfy2iq.fsf@auckland.ac.nz>

Friends.

I have read the faq how_do_i_read_a_single...
and how_can_i_tell_if_there_is_a_char....

But the methods given do not work on my system.

The how_do_i_read_a_single... answer is no good because (at least) I
cannot use POSIX. 

how_can_i_tell_if_there_is_a_char....

The select/4 method does not work like it should.

    vec($sin, fileno(STDIN), 1) = 1;
    select($r = $sin, undef, undef, 0);
    my $o = 0; # Offset
    while($r eq $sin){
	print "Going to read\n";
	my $i = sysread STDIN, $line, 1, $o;
	print "Reading: $line\t$i\n";
	$o++;
	select($r = $sin, undef, undef, 0);
    }

is an infinite loop.

I have given up on the keyboard (my preferred solution) and I have
instead written a java application that runs perl with my script.  I
can trivially get the command strings I want to send my script from a
TextField.  

When I type an <enter> the java application opens the STDIN for the
perl process, writes the line, then closes the stream.

The PERL programme allways recieves the command, but 

select($r = $sin,undef, undef, 0);

allways returns $r eq $sin.  Even with the stream from java closed.


There must be a way of doing this.  I must have made an elementry
mistake, or be confused.  Can anybody help?

Worik Stanton
w.stanton@auckland.ac.nz

PS: I am hoping that I will be able to shift my efforts away from
Windows95, hence I would like the method I use to be portable. (I
think that rules out the keyboard. True?).


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

Date: 15 Sep 1997 12:19:02 +1300
From: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: Re: Reading stdin on Win32 and in a portable way.
Message-Id: <wkyb4zxz4p.fsf@auckland.ac.nz>

Worik Macky Stanton <w.stanton@auckland.ac.nz> writes:

Yes. Well. Problem sort of solved...

> 
> The select/4 method does not work like it should.
> 
>     vec($sin, fileno(STDIN), 1) = 1;
>     select($r = $sin, undef, undef, 0);
>     my $o = 0; # Offset
>     while($r eq $sin){
> 	print "Going to read\n";
> 	my $i = sysread STDIN, $line, 1, $o;
> 	print "Reading: $line\t$i\n";
> 	$o++;
> 	select($r = $sin, undef, undef, 0);
>     }
> 
> is an infinite loop.

    my @a = stat STDIN;
    while($a[7]){
	my $i = sysread STDIN, $line, 1, $o;
	$o++;
	@a = stat STDIN;
    }

is not an infinite loop *SO LONG AS* stdin is from (in my case) the
java application.  Does not work for keyboard input.

Does anybody know how to do this for keyboard input?

Also, why does stat work where select/4 fails?  It is the other way
around for a socket.

> When I type an <enter> the java application opens the STDIN for the
> perl process, writes the line, then closes the stream.
                                 ^^^^^^^^^^^^^^^^^^^^^^ 
oops!  Bad!
Just flush it!  The details would probably belong in a java group, so
I will spare you!

> Windows95, hence I would like the method I use to be portable. (I 
> think that rules out the keyboard. True?).

Is it?

Worik Stanton 
w.stanton@auckland.ac.nz


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

Date: Sun, 14 Sep 1997 16:02:16 -0600
From: Icon Riabitsev <icon@lambuth.edu>
Subject: Streaming chat mode with Perl running on Win32s. Any ideas?
Message-Id: <874270545.20277@dejanews.com>

Hi!
I have run into problems trying to figure out how to create a
streaming
chat mode with Perl (as on wbs chat). So far, the page won't show up
until all code is compiled, and that's understandable. Is there any
workaround to this problem? Or should I use something other than perl
for
that (sob-sob...)?

A little explanation -- Streaming chat is the one where new posts are
added to the page constantly, without reloading the page itself, as if
that was just a slowly-downloading huge page (but it's not).

If anybody has any ideas, please E-MAIL me (I'm not subscribed -- our
school doesn't have a news server and I'm tired of switching from one
open
NNTP to another as they close on me).

My e-mail is icon@lambuth.edu. Any input will be highly appreciated!

Thanks a lot.

Icon Riabitsev.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Sun, 14 Sep 1997 16:48:30 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Icon Riabitsev <icon@lambuth.edu>
Subject: Re: Streaming chat mode with Perl running on Win32s. Any ideas?
Message-Id: <Pine.GSO.3.96.970914164611.26125G-100000@julie.teleport.com>

On Sun, 14 Sep 1997, Icon Riabitsev wrote:

> I have run into problems trying to figure out how to create a streaming
> chat mode with Perl (as on wbs chat). So far, the page won't show up
> until all code is compiled, and that's understandable. Is there any
> workaround to this problem? Or should I use something other than perl
> for that (sob-sob...)? 

If this project can be done in any other language, I don't see any reason
you can't do it in Perl.

> A little explanation -- Streaming chat is the one where new posts are
> added to the page constantly, without reloading the page itself, as if
> that was just a slowly-downloading huge page (but it's not).

Sounds as if you merely need to find out how a server can send this, then
get Perl to do the same thing. Check with the docs and FAQs about servers
and browsers, and (if you don't find the answer there) try asking in a
newsgroup about servers or browsers. You'll get a better and more complete
answer there than you can in a Perl-specific newsgroup.

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sun, 14 Sep 1997 16:36:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Rick B Teh <boonteh@acsu.buffalo.edu>
Subject: Re: unshift function
Message-Id: <Pine.GSO.3.96.970914163456.26125C-100000@julie.teleport.com>

On 14 Sep 1997, Rick B Teh wrote:

> Can someone please show me an example of using the unshift function?
> I have just lost my camel book. 

Are you going to ask again when you need an example of the select
function? :-)  Instead, get all of the docs: Type 'perldoc perldoc' at the
prompt, and if your computer doesn't tell you something interesting, ask
your sysadmin to explain the unshift function to you. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 14 Sep 1997 13:44:48 -0700
From: Nadeem Rana <nrana@aludra.usc.edu>
Subject: why exec finger doesnt work!!!??
Message-Id: <Pine.SV4.3.94.970914134122.6712A-100000@aludra.usc.edu>

I have some user Ids in a file temp. I am writing a simple perl script but
it doesnt work.
Heres the script

	#!/usr/bin/perl
	while($_ = <ARGV>){
	 chop($_);
	 exec 'finger', $_;
	}
but it runs finger ONLY on the first user id in temp. Could you please
help me why is it doing so?
My temp sile is something like this...

userid1
userid2
 ..
 .




Thanks
Nadim



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

Date: Sun, 14 Sep 1997 16:44:46 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nadeem Rana <nrana@aludra.usc.edu>
Subject: Re: why exec finger doesnt work!!!??
Message-Id: <Pine.GSO.3.96.970914164413.26125E-100000@julie.teleport.com>

On 14 Sep 1997, Nadeem Rana wrote:

> Heres the script
> 
> 	#!/usr/bin/perl
> 	while($_ = <ARGV>){
> 	 chop($_);
> 	 exec 'finger', $_;
> 	}
> but it runs finger ONLY on the first user id in temp. Could you please
> help me why is it doing so?

Because that's what exec does. :-)  Check the docs for exec in the
perlfunc(1) manpage. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sun, 14 Sep 1997 18:50:05 +0100
From: Ian Dickson <ian.dickson@btinternet.com>
Subject: Win95 cgi
Message-Id: <341C23CC.2021ED53@btinternet.com>

I am trying to get HTML forms to communicate with perl
scripts (using aWin95 server --WebSite).  I gather from the
FAQ that I will probably need to convert my scripts using
pl2bat, I'd be really grateful if someone could tell me
where I can find pl2bat -- it didn't come with my Win32
version of perl.  Or, even better, mail me the binary code.

Hope this isn't a Read the F'ing Manual Question

Ian





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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 1024
**************************************

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