[7146] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 771 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 24 13:18:10 1997

Date: Thu, 24 Jul 97 10:00:33 -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           Thu, 24 Jul 1997     Volume: 8 Number: 771

Today's topics:
     Re: Another Newbie question about s/// <rootbeer@teleport.com>
     Re: Another Newbie question about s/// <usenet-tag@qz.little-neck.ny.us>
     Apache:: modules broken (Ken Williams)
     attack of little squares!  Help! <nik@ty.com>
     Re: attack of little squares!  Help! <rootbeer@teleport.com>
     breaking a string into 80 chars (Eric Finley)
     Re: Cant seem to reset $1, $2 $3... (Tad McClellan)
     Re: File access from Perl <chrisl@worktechnology.com>
     Re: File access from Perl <rootbeer@teleport.com>
     flock() function michel@saintrochtree.com
     Head of CGI <rbhattac@jetson.uh.edu>
     Help! Script fails to call another script! <bi@inside.ch>
     Re: How to call a subroutine from a variable? <desilva@netbox.com>
     Re: How to set precision <thuerman@ibr.cs.tu-bs.de>
     Re: Link between two web pages and CGI script (in Perl) <sfairey@adc.metrica.co.uk>
     Re: National Medal of Technology: Let's nominate Larry! <rkd7949@ballard.ca.boeing.com>
     Need help with database <ssheikh@netcomuk.co.uk>
     Newbie:  How do you call gzip from perl? <rika@aloha.net>
     Re: Newbie: Backtracking with regexp <rootbeer@teleport.com>
     Perl for dos in windows 95 <mdudley@execonn.com>
     Perl-CGI and Java (Derek J. Scruggs)
     Re: problem searching w/ string ridden with metachars. <rootbeer@teleport.com>
     problem with require <gharfst@students.uiuc.edu>
     Re: regular expression (M.J.T. Guy)
     Re: Seeking object enlightenment <rootbeer@teleport.com>
     Re: socket help <sfairey@adc.metrica.co.uk>
     Re: socket help <rootbeer@teleport.com>
     Re: Wanted ! <kvan@diku.dk>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 24 Jul 1997 08:19:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Robert John Kindel <kindel@sun-valley.Stanford.EDU>
Subject: Re: Another Newbie question about s///
Message-Id: <Pine.GSO.3.96.970724075944.13627P-100000@kelly.teleport.com>

On Wed, 23 Jul 1997, Robert John Kindel wrote:

> $Changes{'(\w+)->pr[[]([^\]]*)[\]]'} = '\1->El(\2)';
> while(<INFILE>) {
>         foreach $key (keys %Changes) {
>                 print STDOUT "$key $Changes{$key}\n";
>                 s/$key/$Changes{$key}/g;
> #               s/(\w+)->pr[[]([^\]]*)[\]]/\1->El(\2)/g;

First, if you want to refer back to a memory from a previous pattern match
(even in the replacement of s///) you want to use $2 instead of \2 . The
backslash notation is _only_ for use in a regular expression to refer back
to a memory in the _same_ pattern match. (But, for the benefit of folks
who can't remember this rule, Perl lets you do the wrong thing on the
replacement of s///. If you turn on -w warnings, it will remind you that
there's a better way.)

But if you say to replace some matched text with $Changes{$key} then
that's what you'll get: The value of $Changes{$key} . You don't get the
same thing as if the current value of $Changes{$key} were included at that
point in the program text. 

And, besides all of that, if you have many changes to make, you're doing
some pretty enefficient stuff, recompiling all of the regular expressions
again and again every time through the loop! This method would probably be
better.

    # Build the loop 
    $code = 
	"while (<INFILE>) {\n" .
	join("\n", map "  s/$_/$Changes{$_}/g;", keys %Changes) .
	"\n  print OUTFILE;\n" .
	"}\n";
    # Print it for debugging purposes
    print STDERR "About to eval this: \n$code\n";
    eval $code;
    die if $@;		# Complain if that didn't work

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/




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

Date: 24 Jul 1997 15:47:28 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Another Newbie question about s///
Message-Id: <eli$9707241125@qz.little-neck.ny.us>

Posted and mailed.

Robert John Kindel  <kindel@sun-valley.Stanford.EDU> wrote:
> $Changes{'(\w+)->pr[[]([^\]]*)[\]]'} = '\1->El(\2)';

I think you want = '$1->El($2)'; there.

> #               s/(\w+)->pr[[]([^\]]*)[\]]/\1->El(\2)/g;

This may work (when uncommented), but .../$1->El($2)/g is correct.

> does not do the substitution for the \1 and \2.  

\1 et al are only for use in the regexp matching part.

> any guesses as to what is wrong?

Second I don't think the varible is being evaluated at the right
time. Compare:

perl -e '$_="abcdebb";
	 $a=q:(a|de)b+:;
	 $b=q:h$1h:;
	 s/$a/$b/g;
	 print $_,"\n";'
h$1hch$1h

perl -e '$_="abcdebb";
	 $a=q:(a|de)b+:;
	 $b=q:h$1h:;
	 s/$a/eval qq,"$b",/eg;
	 print $_,"\n";'
hahchdeh

Elijah
------
regexp guru



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

Date: Thu, 24 Jul 1997 12:16:03 -0400
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: Apache:: modules broken
Message-Id: <ken-2407971216030001@news.swarthmore.edu>

Hi-

I came back from vacation and found that about half of my perl's Apache::
modules give a segmentation fault when you attempt to load them.  For
example, this shell command gives a seg fault:   perl -MApache::CGI


The following modules work:
 Apache::AccessLimitNum.pm
 Apache::AuthzAge.pm
 Apache::Constants.pm
 Apache::Debug.pm
 Apache::MyConfig.pm
 Apache::Options.pm
 Apache::Status.pm

The following modules fail:
 Apache.pm
 Apache::CGI.pm
 Apache::Include.pm
 Apache::MsqlProxy.pm
 Apache::Registry.pm
 Apache::SSI.pm

I haven't been able to establish any commonality within these groups.

Ostensibly, my sysadmins haven't changed my perl in weeks, and these
modules worked when I left for vacation.  I haven't noticed any problems
with any other modules.  The only thing that might have anything to do
with this is that we rearranged our file structure and partitions, and
moved some C library files around.  But this shouldn't affect perl unless
it's recompiled, right?

Here's my perl -V:

Summary of my perl5 (5.0 patchlevel 4 subversion 1) configuration:
  Platform:
    osname=dec_osf, osvers=4.0, archname=alpha-dec_osf
    uname='osf1 forum.swarthmore.edu v4.0 564 alpha '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio= d_sfio=
  Compiler:
    cc='cc', optimize='-O4', gccversion=
    cppflags='-DSTANDARD_C -I/usr/local/include/db'
    ccflags ='-DSTANDARD_C -I/usr/local/include/db'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=15
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/shlib /shlib /lib /usr/lib /usr/ccs/lib
    libs=-ldb -lm -lc -lbsd -lPW
    libc=/usr/shlib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
    cccdlflags=' ', lddlflags='-shared -expect_unresolved "*" -O4 -msym -s
-L/usr/local/lib'


Characteristics of this binary (from libperl):
  Built under dec_osf
  Compiled at Jun 16 1997 17:15:26
  @INC:
    /usr/local/lib/perl5/alpha-dec_osf/5.00401
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/alpha-dec_osf
    /usr/local/lib/perl5/site_perl
    /usr/local/lib/perl5/alpha-dec_osf
    .


Anyone have any ideas about what might be going wrong?  Do I need to
reinstall the Apache modules?  Thanks for any help you can give.

-Ken Williams
 The Math Forum
 ken@forum.swarthmore.edu


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

Date: Thu, 24 Jul 1997 10:45:45 -0500
From: Nik Trivedi <nik@ty.com>
Subject: attack of little squares!  Help!
Message-Id: <33D778A9.A73199C9@ty.com>

My text data files always manage to insert lines and lines of little
squares causing problems in my scripts - do any of you know where these
squares come from?  I thought it was the RETURN character, but that is
not it.  Any other ideas?



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

Date: Thu, 24 Jul 1997 09:44:23 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nik Trivedi <nik@ty.com>
Subject: Re: attack of little squares!  Help!
Message-Id: <Pine.GSO.3.96.970724094026.13627c-100000@kelly.teleport.com>

On Thu, 24 Jul 1997, Nik Trivedi wrote:

> My text data files always manage to insert lines and lines of little
> squares causing problems in my scripts - do any of you know where these
> squares come from?  I thought it was the RETURN character, but that is
> not it. 

It sounds as if you might be moving files from one kind of machine to
another, such as from a DOS/Windows machine to a Unix-type machine. If
you're doing this via FTP, use a text transfer mode to properly convert
the files.

If that's not it, can you post a short (ten line) program which
demonstrates what's happening? That would help all of us to know what
you're talking about. 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/



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

Date: 24 Jul 1997 16:08:22 GMT
From: ez041407@boris.ucdavis.edu (Eric Finley)
Subject: breaking a string into 80 chars
Message-Id: <5r7ulm$ej9$1@mark.ucdavis.edu>

I have 2 arrays, @IN and @OUT,  and each element is a single word.  I want
to print this out, comma delimited, and with the lines being broken after
a word and less than 80 characters.  Printing it out as one big line is
easy using join ", ", @IN.  I am sure I could figure out some big
complicated algorithm that could do this, but is there an easy way.  I
think using sprintf is a start but then how do I break it after the last
comma before the 80 char. limit.  Any ideas?
Thanks,
Eric Finley


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

Date: Wed, 23 Jul 1997 14:32:54 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Cant seem to reset $1, $2 $3...
Message-Id: <69m5r5.k84.ln@localhost>

Kevin Swope (obsidian@shore.net) wrote:
: what am I doing wrong.

: I need to reset the backreference variables but nothing is happening.

: is reset the wrong function to use.  I know I just cant go $1="";

: here's a test script I'm using, but I took out the reset.

: ----------------------------------------------------------------

: $TheString="abc"; 
: $TheString=~ s/((a)(b)(c))/$1/x; 


How come you are using s///x but not using any of the eXtended features?

$TheString=~ s/((a)(b)(c))/$1/;



: print "\n\n$TheString\n\n"; 
: print "\n\n\$1=$1\n\n";  
: print "\n\n\$2=$2\n\n";  
: print "\n\n\$3=$3\n\n";  
: print "\n\n\$4=$4\n\n";
: print "############################################"; 

: I want to reset here!!!!!!!!!!!!!!!

: $TheString="a---b---c"; 
: $TheString=~ s/((a)(b)(c))/$1/x; 


Are you asking how to get the below $digit vars to be the empty string?

The are reset on each _successful_ match. The match you gave is
not successful, so they remain unchanged.

Replace the line above with:


$TheString=~ m/^/; 


: print "\n\n$TheString\n\n"; 
: print "\n\$1=$1\n\n";
: print "\n\$2=$2\n\n"; 
: print "\n\$3=$3\n\n";
: print "\n\$4=$4\n\n";


If it matters to you whether they got reset or not, then you need
to check the success of the match before using the $digit vars:


if ($TheString=~ s/((a)(b)(c))/$1/) {
   print "\n\n$TheString\n\n"; 
   print "\n\n\$1=$1\n\n";  
   print "\n\n\$2=$2\n\n";  
   print "\n\n\$3=$3\n\n";  
   print "\n\n\$4=$4\n\n";
}



--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 24 Jul 1997 14:56:47 GMT
From: "Chris Lawless" <chrisl@worktechnology.com>
Subject: Re: File access from Perl
Message-Id: <01bc9841$b9924b80$5a605cc3@cml.worktechnology.com>

Thanks Simon, and to others who mailed me. I now have my script splitting
up the variables and writing them to a file, just need to get a Perl book
to decipher how to manipulate strings a little better and I'll be laughing!

thanks, Chris.


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

Date: Thu, 24 Jul 1997 08:32:43 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Lawless <chrisl@worktechnology.com>
Subject: Re: File access from Perl
Message-Id: <Pine.GSO.3.96.970724083209.13627T-100000@kelly.teleport.com>

On 24 Jul 1997, Chris Lawless wrote:

> any issues relating to multiple accesses, ie if two or more users try to
> register at once. 

I think you could use the methods in Randal's fourth Web Techniques
column, which explains how to use flock() to avoid problems when multiple
processes need to modify one file. Hope this helps! 

   http://www.stonehenge.com/merlyn/WebTechniques/

-- 
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/



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

Date: Thu, 24 Jul 1997 15:06:25 GMT
From: michel@saintrochtree.com
Subject: flock() function
Message-Id: <5r7r2q$5qs$1@pluto.interpac.be>

Hi all,

In my PERL 4 manual, I've poor information about the flock() function.
Where can I find more?

Is there another method to whait that a file would be unused to write
it?

Thanks for your reply by E-Mail please.

Michel Lombart
michel@saintrochtree.com





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

Date: Thu, 24 Jul 1997 10:58:55 -0500
From: Rishi Bhattacharya <rbhattac@jetson.uh.edu>
Subject: Head of CGI
Message-Id: <33D77BBF.B25@jetson.uh.edu>

Hello,

I am currently starting a new project and I am looking for someone to
head the cgi section of my site. The project is www.webresource.net. It
will be a site for novice to expert webmasters. Please check out the
layout at:

http://www.webresource.net

My team consists of experienced professionals, ranging from NASA
programmers to Internet consultants. The best candidate will have two
things : 1)a reasonable amount of time per week to work on the project
2)Much experience in desigining Perl (CGI) applications. If you are
interested, please email to rbhattac@jetson.uh.edu. I will not be back
to check this newsgroup for responses, so please email. Thank you for
your time.

Rishi Bhattacharya


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

Date: Thu, 24 Jul 1997 17:02:16 +0200
From: "Balthasar T. Indermuehle" <bi@inside.ch>
Subject: Help! Script fails to call another script!
Message-Id: <33D76E78.6D66C06@inside.ch>

I asked this before, nobody could help me. Now I have abstracted the
problem to a reproducable level, i.e. please try this at home!

I have a cgi perl script (a.cgi) which calls upon another script (b).

If I execute manually (logged in as the same user as httpd is running
as) output is (see below for the script source):
A:
B:
A:
and the temp file containing blabla has been written.

If the httpd executes a.cgi. the result is:
A:
A:
and the temp file has not been written.

Why is the first script not executing the second one? Is that a perl bug
or a security feature? I'm using perl 5.004, linux 2.0.25, apache 1.2.1

Thanks a million for your valued comments!

- Balt

a.cgi:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
open FH, "b |";
while (<FH>) {
    $buf .= $_;
}
close FH;
print "A:\n";
print $buf;
print "A:\n";

b:
#!/usr/bin/perl
print "B:\n";
open FH, ">temp";
print FH "bla bla";
close FH;

-- 
+------------------------------------------------------------------+
| Balthasar T. Indermuehle, CEO INside Systems (Switzerland) GmbH  |
| Gesellschaftsstrasse 73                                          |
| CH-3012 Bern                                                     |
| Switzerland                                                      |
| Phone: +41 (0)31 305 04 04              Fax: +41 (0)31 305 04 05 |
| Email: bi@inside.ch                         http://www.inside.ch |
+------------------------------------------------------------------+


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

Date: Mon, 21 Jul 1997 15:20:33 -0400
From: Rujith de Silva <desilva@netbox.com>
Subject: Re: How to call a subroutine from a variable?
Message-Id: <33D3B681.7294@netbox.com>

> Or more cryptically:
>         &{eval "\\check_$var"} ($arguments);

Oops, that should have been:

	  &{eval "\\&check_$var"} ($arguments);

Later,
Rujith.


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

Date: 24 Jul 1997 17:47:42 +0200
From: Urs Thuermann <thuerman@ibr.cs.tu-bs.de>
Subject: Re: How to set precision
Message-Id: <ysdsox48na9.fsf@tuborg.ibr.cs.tu-bs.de>

Tom Phoenix <rootbeer@teleport.com> writes:

> Perl normally uses your system's default for double-precision floating
> point numbers. If you want something different, you may want to use the
> Math::BigFloat module. Hope this helps!

Is there also a module for 64bit integers or arbitrarily sized ints?

I'd appreciate answers by mail, too.


urs


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

Date: Thu, 24 Jul 1997 16:02:21 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Miran Sepic <miran.sepic4@mss.tel.hr>
Subject: Re: Link between two web pages and CGI script (in Perl)?
Message-Id: <33D76E7D.21CB06B1@adc.metrica.co.uk>

Miran Sepic wrote:

> I have a following problem:
>
> For example, on my web page (that is a result of previous CGI script -
>
> 1.cgi), I have a list of links to the software that can be downloaded
> for
> specific user. Now I want to write (into database)  which software in
> the
> list is downloaded. I want to do it without using log files. I must
> write
> another one CGI script (2.cgi). Everythin of this is possible. But,
> after
> the client cliks on link to the specific software, second CGI script
> (2.cgi) writes the data into database, displays new web page, and asks
> him
> to click again. So he has to click twice to reach something on my ftp
> server.
>
> Is there a possibility:
>
> To write a CGI script (instead of my second one (2.cgi)) that will do
> the
> same - write the data into database, and automatically (without any
> click)
> leads the client to the file for download.
>
> Miran

Not sure, probably, but if you ask in comp.infosystems.www.authoring.cgi
you will almost certainly find out.

Simon



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

Date: Thu, 24 Jul 1997 16:05:04 GMT
From: "Richard K. Downer" <rkd7949@ballard.ca.boeing.com>
Subject: Re: National Medal of Technology: Let's nominate Larry!
Message-Id: <33D77D30.53D8@ballard.ca.boeing.com>

Bob Shair wrote:
> 
> When you look at the nature of the World-Wide Web, and the role
> Perl has played, a National medal does seem parochial.

After reading the referenced web page regarding the National Medal of
Technology, I doubt if Larry Wall qualifies. They're looking for people
who have benefitted USA businesses, and what Larry did 1) benefits
people world-wide, 2) doesn't provide any measureable cash to the USA,
and worst of all 3) is free. They're looking for people who create jobs
in the USA and bring money into the USA. Perl does neither (since
everyone using Perl would use something else if Perl did not exist). At
least, that's how I think the judges will view a Larry Wall nomination,
if past winners are any indication.

I assume from conversations with the likes of Randal Schwartz -- I've
never met Mr. Wall -- that he is pleased to earn the praise of his
peers; thus the nomination is still a good idea :-)
-- 
Rick Downer
rkd7949@ballard.ca.boeing.com

These opinions are not mine, they're Boeing's. Boeing paid me while I 
opined them, so Boeing owns them. But Boeing might not agree with them.


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

Date: Mon, 21 Jul 1997 09:52:48 +0100
From: Sanjeel Sheikh <ssheikh@netcomuk.co.uk>
Subject: Need help with database
Message-Id: <33D32360.A6494F18@netcomuk.co.uk>

I would like to develolp an online catalogue. i do have a basic
understanding of perl5 and cgi.
i would like to know how to develop the database, which tools to use and
if their is any software that would develop the datbase its name as
well.
thanx in advance
please post reply to sender





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

Date: Sun, 20 Jul 1997 09:14:30 -1000
From: David Sperling <rika@aloha.net>
Subject: Newbie:  How do you call gzip from perl?
Message-Id: <33D26396.9B4FC8B@aloha.net>

Hi-

I'm running perl from a UNIX shell account.  I can run gzip from the
command line with no problem      i.e.. gzip myfile.txt.

I'd like to know the code needed to run gzip from a perl script.


Thanks in advance,

David Sperling


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

Date: Thu, 24 Jul 1997 09:24:42 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Ronald L. Parker" <ron@farmworks.com>
Subject: Re: Newbie: Backtracking with regexp
Message-Id: <Pine.GSO.3.96.970724090556.13627Y-100000@kelly.teleport.com>

On Thu, 24 Jul 1997, Ronald L. Parker wrote:

> I would have sworn that I saw some documentation somewhere (I thought
> it was perlre) that said minimal matching was slower, but I can't find
> it now.  

It depends upon the data and the matching needs. All else being equal, you
want to make the successful match happen soonest. Use a minimal match when
you expect the match soon, and maximal when you exect the match late. 

    $ perl -w
    use Benchmark;
    $text = 'a' . (' ' x 10000) . 'b';
    timethese 1000, {
       maximal => '$text =~ /a.*b/',
       minimal => '$text =~ /a.*?b/',
    };

    $text = 'ab' . (' ' x 10000);
    timethese 1000, {
       maximal => '$text =~ /a.*b/',
       minimal => '$text =~ /a.*?b/',
    };
    <Ctrl-D>
    Benchmark: timing 1000 iterations of maximal, minimal...
       maximal:  4 secs ( 1.91 usr  0.00 sys =  1.91 cpu)
       minimal: 15 secs ( 9.12 usr  0.04 sys =  9.16 cpu)
    Benchmark: timing 1000 iterations of maximal, minimal...
       maximal: 11 secs ( 3.51 usr  0.01 sys =  3.52 cpu)
       minimal:  3 secs ( 0.73 usr  0.00 sys =  0.73 cpu)

> Is there a recommended benchmark for regexp-type things?  I seem to
> recall that the standard benchmark module won't cut it.  I suppose
> it's in Jeffery's book, but...

That's true, and it probably has thrown off my results some. 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/



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

Date: Thu, 24 Jul 1997 12:13:22 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: Perl for dos in windows 95
Message-Id: <33D77F22.1DA6@execonn.com>

I use perl on a remote UNIX system for a web site, but I write and debug
the code on my windows 95 system in a dos window.

This has worked out well until recently.  I am building a hash which
exceeds 64K in size, and when it does it crashes the perl interpreter,
and the dos window, forcing me to close the window or reboot.

I originally built the perl with my Borland C++ compiler, but I suspect
that it has a memory management problem of some type.

Anyway, I need a copy of perl 5 which has been compiled for 32 bit dos
and will run in a dos window of win 95. I suspect that if it were
compiled with a different compiler I would not have this problem, but
Borland C++ is the only C compiler I have.

If anyone could point me to where I might be able to download a copy of
PERL 5 already compiled for 32 bit Windows DOS platform that will not
crash on large hashes, I would appreciate it.

Thanks,

Marshall


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

Date: 21 Jul 1997 16:19:29 GMT
From: dscruggs@interaccess.com (Derek J. Scruggs)
Subject: Perl-CGI and Java
Message-Id: <5r026h$bu4@nntp.interaccess.com>

Hello guys,


I am developing a server in java that queries the database upon request from
a stubClient program.  The request is  performed over the socket connection.
After the stubClient program gets the query results from the server gives them
to a perl script which diplays them on the web, as the perl programmer wishes.
I am having difficulties to make the Perl Script work with stubClient.
It works perfectly from the command line, but when is called from the web it hangs.

The perl test code that I use is very simple, as follows:

open(RUN,"|java StubClient") 
|| print "<h3>Error: Can't run runWeb program</h3>";

if(RUN)
{
	print (RUN $number);
	print (RUN $time);
	print (RUN $close);
	close(RUN);
}

Looks like no input can be piped to the java process, or I am doing
something wrong with the perl script.
 
Any answer will be very appreciated.

Thanks,
Derek.


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

Date: Thu, 24 Jul 1997 07:51:06 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: dcd@k12-dev.arc.nasa.gov
Subject: Re: problem searching w/ string ridden with metachars.
Message-Id: <Pine.GSO.3.96.970724074407.13627K-100000@kelly.teleport.com>

On Wed, 23 Jul 1997 dcd@k12-dev.arc.nasa.gov wrote:

> $search_string =~ s/\s/\\s+/g;             #collapse white space.

That doesn't collapse it, it expands it! :-)  You want this.

    $search_string =~ s/\s+/\\s+/g;             #collapse white space.

> $search_string =~ s/\\(?!s\+)/\\\\/g;      #quote non-used backslashes
> $search_string =~ s/([^\\\w])/\\$1/g;      #quote non-'/' metachars

You really want to do your transforms in order, since otherwise you'll
find yourself unable to distinguish between backslashes you've put in and
ones that the user entered. A good sequence would be the one I sent you
two days ago, re-entered here for your convenience.

    $search_string =~ s/([^\w\s])/\\$1/g;        # Fix metachars
    $search_string =~ s/\s+/\\s+/g;              # whitespace to \s+
    $search_string =~ s/^(\w)/\\b$1/;            # \b at beginning
    $search_string =~ s/(\w)$/$1\\b/;            # \b at end

If you go through this with the debugger, you'll see what's going on. 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/



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

Date: Thu, 24 Jul 1997 11:06:00 -0500
From: Greg Harfst <gharfst@students.uiuc.edu>
Subject: problem with require
Message-Id: <Pine.SOL.3.91.970724110032.10687A-100000@ux4.cso.uiuc.edu>

Hello,

	I am trying to use the Comm.pl from CPAN.  I put the 
require 'Comm.pl'; line in my code, but when I try to access one of it's 
functions (specifically open_proc), it says :

Undefined subroutine &main::open_proc called at ./testio2.pl line 4.

Here is my code:
#!/usr/local/perl5/bin/perl
require '/home/html/shamrm/public_html/PerlLib/Comm.pl';

$ph = open_proc('cat -n');
for (1..10) {
        print $ph "a line=n";
        print "got back ", scalar <$ph>;
}

exit();

	Can anybody tell me why I am getting this error and what I can do 
to fix it?
	Thanks.

Greg Harfst
gharfst@uiuc.edu
http://www.students.uiuc.edu


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

Date: 21 Jul 1997 18:06:34 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: regular expression
Message-Id: <5r08fa$iec@lyra.csx.cam.ac.uk>

Jim Shi  <jims@ss5mth44.franklin.com> wrote:
>why the two following program prints diiferent results:
>
>A.
>	$line = "ababc";
>	$line =~ /a|ab/;
>	print $&;
>
>	=> "a"
>
>B.
>	$line = "ababc";
>	$line =~ /ab?/;
>	print $&;
>
>	=> "ab"

Because that's what they're defined to do.   You ought really to have
included the complete set:

 C.
        $line = "ababc";
        $line =~ /ab|a/;
        print $&;
 
        => "ab"
 
 D.
        $line = "ababc";
        $line =~ /ab??/;
        print $&;

        => "a"

Perl regular expressions define an ordering on possible matches, and
Perl will choose the first available match in that order.   For
alternation "|", the order is that in which the alternatives are written.
So that explains the behaviour of A and C.   For a normal option x?
Perl tries the longest first ("greedy"); for a non-greedy option x??
Perl tries the shortest first.   That explains B and D.


Mike Guy


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

Date: Thu, 24 Jul 1997 08:25:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Neil Kandalgaonkar <neil@domingo.concordia.ca>
Subject: Re: Seeking object enlightenment
Message-Id: <Pine.GSO.3.96.970724082340.13627S-100000@kelly.teleport.com>

On 24 Jul 1997, Neil Kandalgaonkar wrote:

> I'm a reasonably smart person, and have programmed perl for $, but I
> am having difficulty understanding objects.

Have you seen perltoot(1), which comes with 5.004?

> I own Programming Perl 2nd edition.  Would Learning Perl be any use to
> me?

Probably not. It's a good introductory book, but objects aren't an
introductory topic. 

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/



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

Date: Thu, 24 Jul 1997 16:05:57 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Ryan <rmcguigan@ramresearch.com>
Subject: Re: socket help
Message-Id: <33D76F55.D3E56C0D@adc.metrica.co.uk>

Ryan wrote:

> Hi, I'm planning on writing a script that will search through all the
> files
> in a website and check for broken links.  All it will do is connect to
> the
> server and try to retrieve each file.  I've done this with telnet and
> I've
> figured out basically how to do it, but the only problem I have is,
> I've
> never done any socket programming in perl, and I cannot find any
> documentation that explains how to do it.  I have a perl book, but it
> doesn't even mention socket programming.  If it comes down to it, I
> can
> write an external program to communicate with the servers, but I'd
> rather
> not.  Thanks for any help I get.
>
> Ryan
> RMcGuigan@RAMResearch.com

I believe there are already scripts for doing this, try looking at the
CGI FAQ's at www.perl.com and also the FAQ for the
comp.infosystems.www.authoring.cgi newsgroup.

Hope you find what you need, it'll probably save you the effort of
writing it.

Simon



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

Date: Thu, 24 Jul 1997 09:30:28 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ryan <rmcguigan@ramresearch.com>
Subject: Re: socket help
Message-Id: <Pine.GSO.3.96.970724092703.13627Z-100000@kelly.teleport.com>

On 24 Jul 1997, Ryan wrote:

> I'm planning on writing a script that will search through all the files
> in a website and check for broken links. 

Another one? It's been done before... :-)

I think you could use Randal's fourteenth Web Techniques column, which
implements a good broken link checker with cross-referencing. Hope this
helps! 

   http://www.stonehenge.com/merlyn/WebTechniques/

-- 
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/



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

Date: Mon, 21 Jul 1997 22:51:58 +0200
From: Kvan <kvan@diku.dk>
Subject: Re: Wanted !
Message-Id: <Pine.HPP.3.95.970721223756.11834A-100000@dvalin.diku.dk>

On Mon, 21 Jul 1997, Bruce Davidson wrote:

> Any kind perly show me a script for "copy filename1 filename2"

Well, something like

`cp filename1 filename2`;   #or copy instead of cp if using inferior shell

springs to mind. Perhaps even

system "cp filename1 filename2";

could be useful.

If you're into modules, you might want to try

use File::Copy;
copy ("filename1","filename2");

Finalle, if you really NEED to do it the hard way, try something like:

# First you might want to check whether "filename2" already exists, and
# ask the user whether to overwrite or not.

open (SOURCE,"filename1");
open (DESTINATION, ">filename2");
while (<SOURCE>) {
	print DESTINATION $_;
	}
close (SOURCE);
close (DESTINATION);

I can heartily recommend the Camel book from O'Reilly (aka Programming
Perl). They've even been so kind as to make it available on the WWW for a
limited time, check out

http://www.ora.com

Regards,
Kvan.

-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
---------<kvan@diku.dk>--------- |  unattempted is impossible.'
'kvan' on pbmserv@eiss.erols.com |   
http://www.diku.dk/students/kvan |        - Lord Mhoram, Son of Variol.      



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

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

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