[7379] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1004 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 10 07:07:19 1997

Date: Wed, 10 Sep 97 04: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           Wed, 10 Sep 1997     Volume: 8 Number: 1004

Today's topics:
     Re: A simpler perl question. <rshadian@hawaii.edu>
     Advice on "including" files <bob@inorbit.com.NOSPAM>
     array of references won't work (Mats Larsson)
     Basic question relating to ReadParse on NT (long inc. c nospam@XXX.co.uk
     Re: Calling a sub function on submit <jurgen@ittpub.nl>
     Getting a file from some other server <tdlee@terrylee.com>
     Re: Getting a file from some other server <sfink@cs.berkeley.edu>
     Re: Getting rid of \n in textarea input (Bart Lateur)
     Matrices in Perl (Kevin Bass)
     Re: Matrices in Perl (Daniel E. Macks)
     Re: Matrices in Perl (Kevin Bass)
     Memory management  <mirek@lesinski.demon.co.uk>
     Re: Migrating to Berkeley db 2 using DB_File? (Paul Marquess)
     Re: Perl and dll:s <leberre@bandol.grenoble.hp.com>
     perl4 to perl5 ? (Sheldon E. Newhouse)
     Re: perl4 to perl5 ? (Martien Verbruggen)
     PerlXS: "Unresolved external..." <Jan.Schormann@Informatik.Uni-Oldenburg.DE>
     ping and catching output <tom.van.mierlo@ordina.be>
     Re: Regexp a Yes or No question? (Gabor Egressy)
     Re: Regexp a Yes or No question? (Ilya Zakharevich)
     Re: Regexp a Yes or No question? (Damian Conway)
     Re: Server Push problem...I think <ghowland@hotlava.com>
     Re: Shortest Path Algorithm (Dirge )
     STDIN buffer empty ? <bpioline@mail.cern.ch>
     Re: STDIN buffer empty ? <sfink@cs.berkeley.edu>
     Re: Um... a bug? <arauramo@alpha.hut.fi>
     Using Pipes <ryanr@poolpros.com>
     Re: Using Pipes (brian d foy)
     what/where is dld.h? <ckilburn@nbnet.nb.ca>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 9 Sep 1997 16:15:06 -1000
From: Ritchard Shadian <rshadian@hawaii.edu>
To: OrdwayNet Webmaster <ordway@iwshost.net>
Subject: Re: A simpler perl question.
Message-Id: <Pine.GSO.3.95q.970909161209.15260A-100000@uhunix1>


Another really easy UNIX way is:

chop(@files = `ls mydirectory`)
foreach $file (@files) {..};
--
Ritchard

On 6 Sep 1997, OrdwayNet Webmaster wrote:

> I have a directory full of files.  Lets say that I want to add something to
> each one of those files.  How would I do it?
> 
> I think it would be something like this, but it isn't enough-
> 
> foreach $file
> 
> print "bla bla"\n";
> 
> How do I make $file mean every file in the dir.   




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

Date: Wed, 10 Sep 1997 11:43:35 +0200
From: "Robert J. Alexander" <bob@inorbit.com.NOSPAM>
Subject: Advice on "including" files
Message-Id: <34166BC7.41C6@inorbit.com.NOSPAM>

I have a common set of variables to be shared by different source files
in perl 5.004.

If I do the following all is OK :

perl.inc
--------
$myvar1 = "abcdef";
$myvar2 = 12345;

perlprog.pl
-----------
do 'perl.inc';
print "My include variable \$myvar1 holds $myvar1\n";


but if I want to use the 'use strict;' clause in my perlprog.pl I
correctly get an error $myvar1 not being declared with a my() ....

How should I correctly employ "C-like includes" in my programs keeping
the "use strict" construct ???
-- 
Robert Alexander <bob@inorbit.com>   
Via Sciangai, 53 00144 Roma - Italy fax int+39(6)5966.4949


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

Date: 10 Sep 1997 05:19:31 GMT
From: matlar@rsv.se (Mats Larsson)
Subject: array of references won't work
Message-Id: <5v5al3$957$1@u30039.rsv.svskt.se>


There is apparently something I don't understand about references (yes I
have read the manual). 
To me it seems the the behaviour is different when the reference is 
stored in a scalar and when in an array?

The script looks like this :

#!/rsv/pd/bin/perl5

$one = "Stockholm";
$two = "Rome";

# array of references won't work
# @tab = (\$one, \$two);
$tab[0] = \$one;
$tab[1] = \$two;
# both of the two methods above tested, neither works as intended
print $$tab[0],"\n";     # ? prints just an empty line
print $tab[0],@\n";      # prints address to scalar 
# $$tab[0] = "Athens";   # No use to test this as long as the above doesn't work

# Scalar of references works fine 
$ein = \$one;
$zwei =\$two;
print "$$ein, $$zwei\n"; #prints ok "Stockholm, Rome"
$$ein = "Athens";
print "$one, $two\n";    #prints ok "Athens, Rome"

When run poduces :

$ ref

SCALAR(0x40019bb0)
Stockholm, Rome
Athens, Rome
$

Can someone shed a little light over this please.

TIA Mats

mats-larsson@iname.com (Mats Larsson)


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

Date: Wed, 10 Sep 1997 10:03:19 GMT
From: nospam@XXX.co.uk
Subject: Basic question relating to ReadParse on NT (long inc. code)
Message-Id: <873885811.24325.0.nnrp-07.9e980333@news.demon.co.uk>

Hi

I am running Perl32 on NT/IIS, and seem to be having many problems
using the ReadParse function from the cgi_lib.pl  In an attempt to
figure out why it doesn't work at all, I have extracted the relevant
code and written a perl code that uses just that as a sub-routine.
Thing is it returns some weird results!

**Start Code

HTML Page
==========

<HTML>
<BODY>
<FORM ACTION="../cgi-bin/rich1.pl" METHOD=POST>
1  <INPUT TYPE="text" NAME="richard" SIZE=30"><BR>
<INPUT TYPE=SUBMIT VALUE="Test it">
</FORM>
</BODY>
</HTML>


PERL Code
=========
#!/usr/bin/perl

sub ReadParse {
  local (*in) = @_ if @_;
  local ($i, $key, $val);

  # Read in text
  if ($ENV{'REQUEST_METHOD'} eq "GET") {
    $in = $ENV{'QUERY_STRING'};
  } elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
    read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
  }

  @in = split(/&/,$in); 

  foreach $i (0 .. $#in) {
    # Convert pluses to spaces
    $in[$i] =~ s/\+/ /g;

    # Split into key and value.  
    ($key, $val) = split(/=/,$in[$i],2); # splits on the first =.

    # Convert %XX from hex numbers to alphanumeric
    $key =~ s/%(..)/pack("c",hex($1))/ge;
    $val =~ s/%(..)/pack("c",hex($1))/ge;

    # Associate key and value
    $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple
separator
    $in{$key} .= $val;

  }

  return 1;
}

&ReadParse(*input);

print %input;

$mystuff = $input{'richard'};


print "<HTML>";
print "<BODY>";
print "<H1>Testing</H1>";
print "Your first input was $mystuff";
print "</BODY>";
print "</HTML>";


Page returned
===========


ichardtested 

Testing

Your first input was 

**End Code


So as you can see the page returned does not include the value entered
in the form, because the perl code strips the first letter of the
name:value pair, meaning that the part of the code that writes that
field in based on the name 'richard' cant find it.  WHY?!!

What is wrong with this?

This is a pretty good example of why it is failing when using the
ReadParse function from teh library as well.  Any gurus who could
solve this would earn my eternal gratitude!

Please also e-mail any solutions to:

richard@the-web-works.co.uk

Many thanks in advance

Richard Clarke



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

Date: Wed, 10 Sep 1997 08:07:43 GMT
From: "Jurgen Hildebrand" <jurgen@ittpub.nl>
Subject: Re: Calling a sub function on submit
Message-Id: <EGAA7z.FIo@ittpub.nl>

I think you need http://www.activeware.com perlscript for doing such
things
Unfortunately that scheme would only work for IE browsers on winNT/95
as far as I know....
 fischers@execpc.com wrote in article <34153A3F.9AB0FD8D@execpc.com>...
:Here is a dilly of a problem.
:I have a perl script that updates a database.  I want to do a 'onSubmit'
:button that calls a sub function in the current script.  Problem is,
:when the form is submitted, the script looks for the function on my
:server, not in the script itself.  How do I get the script to look for
:the function in itself, not on the server?
:
: 




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

Date: Wed, 10 Sep 1997 01:15:48 -0700
From: Terry Lee <tdlee@terrylee.com>
Subject: Getting a file from some other server
Message-Id: <34165734.5685@terrylee.com>

This code works:

open(InFile, "data.txt") || die "Sorry Bozo!\n";
while ($line = <InFile>)
 {
    print "$line\n";
 }
close(InFile);


What do I use to open the file on another server other than where the
code is running?
For instance, let's suppose I saw a file on
tigger.number1.com/var/www/temp/data.txt and wanted to display the
contents like the above example.

I tried this and it did not work:

open(InFile, "tigger.number1.com/var/www/temp/data.txt") || die "Sorry
Bozo!\n";
while ($line = <InFile>)
 {
    print "$line\n";
 }
close(InFile);





Any suggestions?
Thanks in advance!
Terry


-- 
The beatings will continue until morale improves.....


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

Date: Wed, 10 Sep 1997 03:11:04 -0700
From: Steve Fink <sfink@cs.berkeley.edu>
To: tdlee@terrylee.com
Subject: Re: Getting a file from some other server
Message-Id: <34167238.1F1A@cs.berkeley.edu>

Life generally isn't that simple. But if you have lynx installed and
don't worry about portability and that kind of stuff...

open(InFile, "lynx -source http://tigger.number1.com/temp/data.txt|") or
die "Sorry bozo: $!\n";

if it's reachable by http. Or you might be able to play tricks with rcp.


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

Date: Wed, 10 Sep 1997 10:23:02 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Getting rid of \n in textarea input
Message-Id: <341b7251.3471589@news.tornado.be>

Javier Figueroa <info@backroompr.com> wrote:

>I tried
>
>$FORM{'information'} =~ s/\n/ /g;
>
>but it does not work, the carriage return is still being displayed in my
>database file.

Is that before or after the CGI variables have been converted to their
plain Ascii representation?

You can also try

	tr/\000-\037 / /s;

Which will replace ALL control characters (including tabs, newlines and
carriage returns) and spaces, to one single space. This takes care of
cross-platform problems as well.

HTH,
Bart.


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

Date: Wed, 10 Sep 1997 01:10:34 GMT
From: akil1@mindspring.com (Kevin Bass)
Subject: Matrices in Perl
Message-Id: <5v4s3h$p4h@camel2.mindspring.com>

(1)
@matrix = (
	[1, 2, 3 ],
	[4, 5, 6 ],
	[7, 8, 9]
);
$matrix [1]  [2] = 100;

Why would the value of 6 at row 1, column 2 in the matrix change to
100?  Why wouldn't the answer be a change of value 2 in the matrix?


(2)
Why would the following created the answer (matrix) below?
$matrix {0} {2} = 100;
$matrix {1} {0} = 200;
$matrix {2} {1} = 300;

answer
[0, 0, 100]
[200, 0, 0]
[0, 300, 0]


Kevin Bass



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

Date: 10 Sep 1997 02:35:40 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: Matrices in Perl
Message-Id: <5v511s$8l8$1@netnews.upenn.edu>

Kevin Bass (akil1@mindspring.com) said:
: (1)
: @matrix = (
: 	[1, 2, 3 ],
: 	[4, 5, 6 ],
: 	[7, 8, 9]
: );
: $matrix [1]  [2] = 100;
: 
: Why would the value of 6 at row 1, column 2 in the matrix change to
: 100?  Why wouldn't the answer be a change of value 2 in the matrix?

'cuz indexing begins with zero. The value 2 is in the zeroth row,
first position.

: (2)
: Why would the following created the answer (matrix) below?
: $matrix {0} {2} = 100;
: $matrix {1} {0} = 200;
: $matrix {2} {1} = 300;
: 
: answer
: [0, 0, 100]
: [200, 0, 0]
: [0, 300, 0]

I would think you'd get a hash of hashes rather than a list of array
refs, and that there'd be undefs rather than zeros, but otherwise it's
the same situation.

dan

-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: Wed, 10 Sep 1997 10:29:48 GMT
From: akil1@mindspring.com (Kevin Bass)
Subject: Re: Matrices in Perl
Message-Id: <5v5ss4$9cp@camel2.mindspring.com>

Thanks for answering my post.  I understand the matrix concept.  
Sometimes, when learning a different language, things are not
understood right away but that's life.  



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

Date: Wed, 10 Sep 1997 11:39:42 +0100
From: Les Lesinski <mirek@lesinski.demon.co.uk>
Subject: Memory management 
Message-Id: <dgwpOCAujnF0EwQd@lesinski.demon.co.uk>

We have a persistent perl process running on NT. Over a period of days
the space used grows steadily.

Using a "my array" is it possible that each time the array is grown that
some space is consumed never to be recouped and would it not be
preferable to make the array global so that it only grows to the max
size once?
-- 
Bob Smith


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

Date: 10 Sep 1997 08:43:35 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: Migrating to Berkeley db 2 using DB_File?
Message-Id: <5v5mjn$ra$1@pheidippides.axion.bt.co.uk>

[Posted & Mailed]

Ken Williams (ken@forum.swarthmore.edu) wrote:
: Hi-

: I rely on Berkeley DB files for some very mission-critical applications. 
: I've experienced some unstable behavior with them, and I've read that the
: Berkeley folks want people to move to version 2.  I'm happy to do so. 
: However, I can't figure out how to do so gracefully using DB_File.

: If I build DB_File with DB version 2, then won't all my programs that rely
: on DB_File be broken until I switch their databases to the new file
: format?  If true, this seems not-so-good.  I can't do this all in one fell
: swoop, and people rely on these programs all the time.

: I'd much rather that the new DB_File (which will fully support version 2
: DB) not be called DB_File anymore.  Then I could switch each program to
: version 2 as I build my confidence in the new products.  Doesn't it make
: sense to give a new module a new name?

: Of course, if someone can tell me a gentle, gradual way to migrate to DB
: version 2, I'd sure appreciate it.

Here is my current plan for DB_File.

Firstly, to allow existing DB_File scripts that use Berkeley DB 1.x to
be easily migrated to Berkeley DB 2.x, I've modified DB_File to allow
it to be built with either DB 1.x or 2.x (but not both at the same
time). I uploaded the most recent version of DB_File, 1.53, to CPAN
yesterday.

When DB_File is built with DB 2.x I've arranged things so that it
mirrors the DB 1.x API. This means that none of the new functionality
available in DB 2.x is available. It also means that all existing
DB_File scripts should run unchanged.

The only thing you have to do is migrate your existing DB 1.x databases
to DB 2.x. Luckily Berkeley DB 2.x comes with utilities to dump 1.x
databases and load them into 2.x format.

Next is proper support for all the new stuff in DB 2.x. This is nearly
ready for its first alpha release. It will not be called DB_File.

Hope that clarified things.

Paul


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

Date: Wed, 10 Sep 1997 09:28:46 +0200
From: Philippe Le Berre <leberre@bandol.grenoble.hp.com>
To: Per Mosseby <d94-pmo@mumrik.nada.kth.se>
Subject: Re: Perl and dll:s
Message-Id: <34164C2E.50FCC613@bandol.grenoble.hp.com>

Hi,

Check out M$ KB for a tech note on rundll32.exe. That should do the
trick.

Regards,

-- 
Philippe Le Berre
SSG - CSBU R&D
Advance Technology Lab, Europe
----------------------------------------------------------------
Hewlett-Packard					<leberre@bandol.grenoble.hp.com>
5 av Raymond Chanas				Tel : 33 4 76 14 66 05
38053 Grenoble Cedex 9, France	Fax : 33 4 76 14 14 65


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

Date: 09 Sep 1997 21:18:12 -0400
From: sen1@math.msu.edu (Sheldon E. Newhouse)
Subject: perl4 to perl5 ?
Message-Id: <o8d8minezv.fsf@chaos>

Hi,
 I have a colleague who has inherited a large number of perl4
scripts. She wants to write new ones in perl5. Are there any simple
conversion scripts available?  I am thinking of something like the f2c
program which would just convert the perl4 source to a perl5 source. 

Thanks for any information.

-sen
-- 
 ---------------------------------------------------------------------------
 | Sheldon E. Newhouse            |    e-mail: sen1@math.msu.edu           |
 | Mathematics Department         |       				   |
 | Michigan State University      | telephone: 517-355-9684                |
 | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562                |
 ---------------------------------------------------------------------------


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

Date: 10 Sep 1997 03:26:03 GMT
From: mgjv@mali.comdyn.com.au (Martien Verbruggen)
Subject: Re: perl4 to perl5 ?
Message-Id: <5v540b$hn4$1@comdyn.comdyn.com.au>

In article <o8d8minezv.fsf@chaos>,
sen1@math.msu.edu (Sheldon E. Newhouse) writes:

>  I have a colleague who has inherited a large number of perl4
> scripts. She wants to write new ones in perl5. Are there any simple
> conversion scripts available?  I am thinking of something like the f2c
> program which would just convert the perl4 source to a perl5 source. 

I don't think there is such a beastie, but you most definitely will want to
read the 'perltrap' documentation, which has a section on perl4 to perl5
porting warnings.

map perltrap

or

perldoc perltrap

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 10 Sep 1997 10:16:15 +0200
From: "Jan Schormann" <Jan.Schormann@Informatik.Uni-Oldenburg.DE>
Subject: PerlXS: "Unresolved external..."
Message-Id: <5v5l0l$jqf@news.Informatik.Uni-Oldenburg.DE>


Hi!

I'm writing a perl extension in C using perlXS, ExtUtils, DynaLoader
and the like, and the C code refers to some self-made library, too.
This is on an HP 715/100 running HP-UX 10.20 and perl 5.003.
Finally I can start "make test" but get:

| [...]
| 	  PERL_DL_NONLAZY=1 /usr/contrib/bin/perl -I./blib/arch -I./blib/lib -I/opt/perl5/lib/PA-RISC1.1/5.003 -I/opt/perl5/lib test.pl
| 1..7
| Can't load 'blib/arch/auto/Bismas/Bismas.sl' for module Bismas: Unresolved external at /opt/perl5/lib/DynaLoader.pm line 140.
| 
|  at blib/lib/Bismas.pm line 41
| BEGIN failed--compilation aborted at test.pl line 12.
| not ok 1
(Bismas is the name of my extension)

Is there something obvious missing?
Now, of course, I'd like to know *what* was unresolved to find out
*why*. Is there a way to make the output a bit more verbose without
recompiling the binary portion of DynaLoader?

Any help appreciated!
	Jan.
                   =o= M-1 0 0 M-x praise-emacs =o=
   Jan.Schormann@informatik.uni-oldenburg.de / voice: 0441/777 248


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

Date: Wed, 10 Sep 1997 10:05:11 +0200
From: tom <tom.van.mierlo@ordina.be>
Subject: ping and catching output
Message-Id: <341654B6.E9D08EA3@ordina.be>

Hi,

I've got the following problem.

I'm working under an Windows 95 environment and I'm writing perl scripts
using the cgi.pm module.

I want to use a ping command to check if my mail server is on line, I've
already tried the pingecho function in the ping.pm module but i always
get the next error message : Error parse exception

This is the test script i wrote that generated the error message :

use lib 'c:\perl\lib';
use Net::Ping;

$ip_adres = "192.92.130.6";
$timeout = 10;

print "yes\n" if pingecho($ip_adres, $timeout);

What could this error message mean ?

I also tried to use the ping command that comes with windows.
but the problem with this is, i don't know how to check if the server is
online or not. The yes is always printed out!

perl script for this :

$ip_adres = "192.92.130.6";
$ping="ping";

open(PING, "|$ping $ip_adres");
close(PING);
if (!$?) { print "yes" };

I'm just a beginner, please help me



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

Date: 10 Sep 1997 00:49:41 GMT
From: gabor@vinyl.quickweb.com (Gabor Egressy)
Subject: Re: Regexp a Yes or No question?
Message-Id: <5v4qr5$ers$1@flint.sentex.net>

Matthew Cravit (mcravit@best.com) wrote:
: In article <5v1u1k$8jn$2@flint.sentex.net>,
: Gabor Egressy <gabor@vinyl.quickweb.com> wrote:
: >:     if ($response =~ /^[YyTtOo]/) {
: >
: >what if the user types 'yellow'
: >should that be accepted?

: As far as I'm concerned, if my program asks the user 

:     Do you want to frobnicate the data (yes/no)?

: and the user types "yellow", then s/he deserves what s/he gets. :)

: Seriously, though, if you're really concerned about the user typing
: random text in response to a yes/no prompt, it's probably better to
: say


I was thinking more along the line
if(/^([yY]([eE][sS])?)?$/) {
    do whatever;
}
else {
    say something nasty; :-)
}

:     while ($response !~ /^yes/i) {
:         print "Your response was not understood.\n";
:         print "Please answer yes or no.\n";
:     }
:     if ($response =~ /^yes$/i) { 
:         &DoSomething;
:     else {
:         &DoSomethingElse;
:     }

--
And don't tell me there isn't one bit of difference between null and space,
because that's exactly how much difference there is.  :-)
        --Larry Wall in <10209@jpl-devvax.JPL.NASA.GOV>
Check out this site about the persecution of Randal Schwartz by Intel
http://www.rahul.net/jeffrey/ovs/


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

Date: 10 Sep 1997 03:15:32 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regexp a Yes or No question?
Message-Id: <5v53ck$su5@agate.berkeley.edu>


In article <5v4qr5$ers$1@flint.sentex.net>,
Gabor Egressy <gabor@vinyl.quickweb.com> wrote:
> if(/^([yY]([eE][sS])?)?$/) {

Friends do not let friends to write code like this.  Learn //i.

Hope this helps,
Ilya


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

Date: 10 Sep 1997 07:12:03 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Regexp a Yes or No question?
Message-Id: <5v5h83$bem$1@towncrier.cc.monash.edu.au>


Why not create a sub to handle the whole problem:

	sub ask ($)
	{
		while (1) { print "$_[0] (yes/no): ";
			    my $response = <>;
		  	    return 1 if $response =~ /^y(es)?$/i;
		  	    return 0 if $response =~ /^no?$/i;
			  }
	}


Then just use it wherever you need it:

	if ( ask "Do you want to quit?" && ask "Are you sure?" )
	{
		exit(0);
	}
	else
	{
		print "continuing...\n";
	}


Damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  who: Damian Conway                 email: damian@cs.monash.edu.au
where: Computer Science Dept.          web: http://www.cs.monash.edu.au/~damian
       Monash University             quote: "The best form of self-defence is
       Clayton 3168, Australia               not being there in the first place"


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

Date: Wed, 10 Sep 1997 09:54:12 +0200
From: Gary Howland <ghowland@hotlava.com>
To: Matt Weber <mweber@vt.edu>
Subject: Re: Server Push problem...I think
Message-Id: <34165224.2898@hotlava.com>


Matt Weber wrote:
> 
> Here is the deal:  I have a perl script that is executed from the web.  The
> problem is that it takes way too long for it to give any output to the user.  I
> want to do something that gives output to the user right away, while the script
> finishes executing.  I was thinking of a server push.  However, this will not
> help me because the web server still waits for the script to finish executing
> before it creates any output...even server push.
> 
> Any suggestions?


This is often due to the server blocking the output.  Try reading up on
'nph' in your server documentation.  You may find that something as
simple as renaming your script to start with 'nph' may do the trick.

Gary


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

Date: 10 Sep 1997 08:55:19 GMT
From: mjw101@york.ac.uk (Dirge )
Subject: Re: Shortest Path Algorithm
Message-Id: <5v5n9n$ss$1@netty.york.ac.uk>

Creeping stealthily through the corridors of comp.lang.perl.misc,
I overheard Andy say:

: In article <5u2qkq$g5v$1@newbabylon.rs.itd.umich.edu>, Matthew Scott Britt
: <msbritt@ren.us.itd.umich.edu> wrote:

: > Does anyone know of a shortest path algorithm written in perl?  I search
: > CPAN with no luck...

: The algoithm would depend on whether you want depth-first or breadth-first
: searching done, I would have thought..

Too true... IME depth first is a pain in the backside to code tho'

My advice: go and have a look at the Priority ordered queue solution in
Algorithms by Sedgwick pg 461.

Nice, simple and (even with rather a lot of other wibbly stuff to do with
displaying the results) quick to write. The Code I can't post due to
employer, but I can say that it took me about 230 lines, including some
*very* odd formatting to make the Java applet the results are displayed
through work correctly.

--
  /\ 	Michael							  /\
 <  >	   Only cat lovers know the joy of a fur-covered	 <  >
  \/		musical hot-water bottle that never goes cold.    \/



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

Date: Wed, 10 Sep 1997 09:15:53 GMT
From: Boris Pioline <bpioline@mail.cern.ch>
Subject: STDIN buffer empty ?
Message-Id: <Pine.GSO.3.95a.970910111442.17536O-100000@thwgs1>


Hello,
is there (of course there is) a way of finding out
whether there is **already** something in <STDIN>, without affecting
its contents ?

Thanks

Boris Pioline



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

Date: Wed, 10 Sep 1997 02:55:24 -0700
From: Steve Fink <sfink@cs.berkeley.edu>
To: Boris Pioline <bpioline@mail.cern.ch>
Subject: Re: STDIN buffer empty ?
Message-Id: <34166E8C.122B@cs.berkeley.edu>

Use the select() system call on file descriptor zero. (man select for
details.)


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

Date: 10 Sep 1997 12:00:02 +0300
From: Antti Rauramo <arauramo@alpha.hut.fi>
Subject: Re: Um... a bug?
Message-Id: <j3e7mcpr1bh.fsf@alpha.hut.fi>

Tom Phoenix <rootbeer@teleport.com> writes:

> No, roundoff error. 0.1 cannot be represented in a finite binary
> bitstring. If this doesn't happen in some other language, it's because
> that language is somehow hiding the ugly truth from you! :-) 

	Yep, ok, I see. And I thought Perl was letting me get used to
'too good'.

Antti Rauramo |   In  a  Czechoslovakin  tourist  agency:  Take  one  of  our
arauramo@     | horse-driven city tours - we guarantee no  miscarriages.
    cc.hut.fi |  
0422 - 326 311|  


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

Date: Tue, 09 Sep 1997 22:39:55 -0700
From: Ryan Rose <ryanr@poolpros.com>
Subject: Using Pipes
Message-Id: <341632AA.F11AEBB@poolpros.com>


I have a program called lu that prints out the following in shell.

 0 *                 Meera :     66 :  182 :      0 : 207.79.35.34
 1 *               Boomer :     35 :   32 :      0 : 199.246.132.78
 2 *                   ejana :     -4 :   17 :      0 : 142.58.110.2
 3 *                   Eeze :      3 :   21 :      0 : 194.237.142.4
 4 *                    nats :    -15 :   11 :      0 : 206.206.120.10
 5 *          snowbabie :      0 :   68 :      0 : 208.148.249.138
 6 *                   dean :     14 :    8 :      0 : 205.217.61.200
 7 *                   todd :      0 :   44 :      0 : 24.113.36.176
 8 *                  Anna :    -11 :   64 :      0 : 203.2.75.92
  9                       Me :   2475 :   20 :      0 : 203.14.111.8
10 *         supersonic :     -7 :   66 :      0 : 209.54.96.15


My perl program should just display the Names on all lines containing a
'*'
here's the code.

open (INPUT, "lu|");
while (<INPUT>) {
    $line = <INPUT>;
     chop ($line);
     if ($line =~ /\*/)  {
            $line =~ s/^\ ?\d*\ \*\ +(\w+)\ :.*/\1/;
            print ("User: $line\n");
     }
}

But here's the output.  Look what happens, it skips every other line.
User: Meera
User: ejana
User: nats
User: dean
User: Anna
User: supersonic

I have no idea why it's doing this.  Furthermore, I have done something
as simple as:

open (INPUT, "lu|");
while (<INPUT>) {
    $line = <INPUT>;
    print ("$line");
  }


and this is what I get for output.

 0 *              Meera :    -14 :  188 :      0 : 207.79.35.34
 2 *                ejana :    -16 :   18 :      0 : 142.58.110.2
 4 *                  nats :     26 :   15 :      0 : 206.206.120.10
 6 *                 dean :     24 :   14 :      0 : 205.217.61.200
 8 *                 Anna :      1 :   67 :      0 : 203.2.75.92
10 *        supersonic :    -15 :   71 :      0 : 209.54.96.15

What gives!!?

    Ryan



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

Date: Wed, 10 Sep 1997 02:44:36 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Using Pipes
Message-Id: <comdog-ya02408000R1009970244360001@news.panix.com>


In article <341632AA.F11AEBB@poolpros.com>, ryanr@poolpros.com wrote:

>I have a program called lu that prints out the following in shell.
>
> 0 *                 Meera :     66 :  182 :      0 : 207.79.35.34
> 1 *               Boomer :     35 :   32 :      0 : 199.246.132.78
[snip]

>My perl program should just display the Names on all lines containing a
>'*'
>here's the code.
>
>open (INPUT, "lu|");
>while (<INPUT>) {
>    $line = <INPUT>;
>     chop ($line);
>     if ($line =~ /\*/)  {
>            $line =~ s/^\ ?\d*\ \*\ +(\w+)\ :.*/\1/;
>            print ("User: $line\n");
>     }
>}


>But here's the output.  Look what happens, it skips every other line.
[snip]

well, let's take a closer look at that loop to see what happens.

   * in the while() condition, you read a line of input into $_.

   * the first thing that happens in the loop is that
   the next line of input is read into $line. the line that was 
   read in into $_ in the while() condition is ignored by the line
   immediately following it before your loop has a chance to do 
   anything with it.

so the solution is to get rid of the first expression in the loop and
read into $line inside while():

   while ($line = <INPUT>) 
   {
      chomp ($line);
      if ($line =~ /\*/)  
         {
         $line =~ s/^\ ?\d*\ \*\ +(\w+)\ :.*/\1/;
         print ("User: $line\n");
         }
   }

-- 
brian d foy                                  <comdog@computerdog.com>


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

Date: Wed, 10 Sep 1997 04:17:08 -0300
From: Colin Kilburn <ckilburn@nbnet.nb.ca>
Subject: what/where is dld.h?
Message-Id: <34164974.59249903@nbnet.nb.ca>

When making Config.sh , for compiling 5.004, I get a message stating
that dld.h was not
found. I can't seem to locate it either.

What is this file?
Where does it orginate?
What effect does this have on the Perl build?
Will this cause problems for perl/Tk?

Colin Kilburn



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

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

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