[9889] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3482 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 19 11:07:26 1998

Date: Wed, 19 Aug 98 08:00:34 -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, 19 Aug 1998     Volume: 8 Number: 3482

Today's topics:
    Re: 2 quick questions dave@mag-sol.com
    Re: 2 quick questions dave@mag-sol.com
    Re: 2 quick questions <mivl@inquo.net>
        Bourne shell to Perl translator <ehselch@ehf.ericsson.se>
    Re: Can not create socket ??? <jdf@pobox.com>
        creating a nt service with perl <Brettl@datent.com>
        embedding perl in threaded C or java <hg@apteryx.fr>
    Re: exception handling huntersean@hotmail.com
    Re: exception handling (Greg Bacon)
    Re: filehandle in CGI.pm (I.J. Garlick)
    Re: filehandle in CGI.pm (I.J. Garlick)
    Re: Greedy arrays in list assignments (M.J.T. Guy)
    Re: Greedy arrays in list assignments (Craig Berry)
    Re: here's an implementation of diff in perl (Michael J Gebis)
    Re: here's an implementation of diff in perl (Abigail)
    Re: here's an implementation of diff in perl (Abigail)
    Re: here's an implementation of diff in perl (Tye McQueen)
    Re: hmmm... <jdf@pobox.com>
    Re: hmmm... <posern@Mathematik.Uni-Marburg.de>
    Re: How do I execute perl from html program droby@copyright.com
    Re: How to clear a filehandle? <jdf@pobox.com>
        How to download a binary file to browser? <higary@ms1.hint.net>
        Javascript becoming quite similar to perl <sidi@angband.org>
        New PERL user looking for sites running PERL5 on an NT  <Debra.Ruch@gov.edmonton.ab.ca>
        Performance of OO-Perl ? (Wolfgang Sander-Beuermann)
    Re: Perl in Win 98 dave@mag-sol.com
    Re: Perl Lex ? Perl Yacc ? <r28629@email.sps.mot.com>
    Re: Perl Lex ? Perl Yacc ? <r28629@email.sps.mot.com>
    Re: Perl Lex ? Perl Yacc ? <uwe.honekamp@etas.de>
        printf question - newbie horseyride@hotmail.com
        Procmail - domain forwarding <toni.zeitler@informatik.tu-muenchen.de>
    Re: Procmail - domain forwarding tigger@io.nospaam.com
    Re: request for comments... (Michael J Gebis)
        slow sub, array missing data (Mike Collins)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 19 Aug 1998 13:30:14 GMT
From: dave@mag-sol.com
Subject: Re: 2 quick questions
Message-Id: <6rek19$bo2$1@nnrp1.dejanews.com>

In article <6rdmep$qq$1@quartz.inquo.net>,
  "Kris Davey" <mivl@inquo.net> wrote:
> 1. I think I remeber seeing something a while back about compiling perl
> scripts to an exe. I can't remeber if was a p3exe.bat or an actual compiler.
> I would like to create scripts that I can run on workstations that don't
> have Perl. (These workstations are on an isolated network with no ISAPI web
> server).

An experimental build of the Perl compiler is included with 5.005. It may not
do what you want tho'.

> 2. What would be the best way, if any to create a script that connects from
> the server to the workstation and runs code on the workstation. i.e. copies
> new executables down, kills processes, run uninstall, reruns install,
> restarts processes. I was looking at sockets but i'm not sure that would
> work maybe it's a module that I overlooked. This is between an NT Server and
> NT Workstations.

Have you looked at the module Net::Telnet?

hth,

Dave...

--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 19 Aug 1998 13:30:30 GMT
From: dave@mag-sol.com
Subject: Re: 2 quick questions
Message-Id: <6rek1m$bo5$1@nnrp1.dejanews.com>

In article <6rdmep$qq$1@quartz.inquo.net>,
  "Kris Davey" <mivl@inquo.net> wrote:
> 1. I think I remeber seeing something a while back about compiling perl
> scripts to an exe. I can't remeber if was a p3exe.bat or an actual compiler.
> I would like to create scripts that I can run on workstations that don't
> have Perl. (These workstations are on an isolated network with no ISAPI web
> server).

An experimental build of the Perl compiler is included with 5.005. It may not
do what you want tho'.

> 2. What would be the best way, if any to create a script that connects from
> the server to the workstation and runs code on the workstation. i.e. copies
> new executables down, kills processes, run uninstall, reruns install,
> restarts processes. I was looking at sockets but i'm not sure that would
> work maybe it's a module that I overlooked. This is between an NT Server and
> NT Workstations.

Have you looked at the module Net::Telnet?

hth,

Dave...

--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 19 Aug 1998 07:54:45 -0600
From: "Kris Davey" <mivl@inquo.net>
Subject: Re: 2 quick questions
Message-Id: <6relfc$jit$1@quartz.inquo.net>

I want to be able to connect from an NT server to an NT Workstation, I don't
think the Net::Telnet will connect to an NT Workstation. I mean I know that
I cannot telnet to the boxes myself, so i doubt perl will either.

dave@mag-sol.com wrote in message <6rek19$bo2$1@nnrp1.dejanews.com>...
>In article <6rdmep$qq$1@quartz.inquo.net>,
>  "Kris Davey" <mivl@inquo.net> wrote:
>> 1. I think I remeber seeing something a while back about compiling perl
>> scripts to an exe. I can't remeber if was a p3exe.bat or an actual
compiler.
>> I would like to create scripts that I can run on workstations that don't
>> have Perl. (These workstations are on an isolated network with no ISAPI
web
>> server).
>
>An experimental build of the Perl compiler is included with 5.005. It may
not
>do what you want tho'.
>
>> 2. What would be the best way, if any to create a script that connects
from
>> the server to the workstation and runs code on the workstation. i.e.
copies
>> new executables down, kills processes, run uninstall, reruns install,
>> restarts processes. I was looking at sockets but i'm not sure that would
>> work maybe it's a module that I overlooked. This is between an NT Server
and
>> NT Workstations.
>
>Have you looked at the module Net::Telnet?
>
>hth,
>
>Dave...
>
>--
>dave@mag-sol.com
>London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




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

Date: Wed, 19 Aug 1998 16:16:49 +0200
From: Adel Elcheikh <ehselch@ehf.ericsson.se>
Subject: Bourne shell to Perl translator
Message-Id: <35DADE50.370E35DC@ehf.ericsson.se>

Hi everybody ,

Novice Perl question :

Is there any soft that converts Bourne shell scripts to Perl scripts?

Thanks



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

Date: 19 Aug 1998 08:48:52 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: johnvun@asiapac.net
Subject: Re: Can not create socket ???
Message-Id: <7m05m69n.fsf@mailhost.panix.com>

johnvun <johnvun@asiapac.net> writes:

> below is my code, i want to create a socket, but my program stop and say
> No socket ??? Why ???

perl will tell you if you ask it to.  See below.

First: you should be using the -w switch, which will catch many common
errors and complain about them.

> ($var1, $var2, $prototype) = getprotobyname ("tcp");
> ($var1, $var2, $var3, $var4, $server) = gethostbyname ("topgun");

Instead of creating variables that you throw away, you should use a
slice, like so:

   $prototype = (getprotobyname('tcp'))[2];
   $server    = (gethostbyname('topgun'))[4];

> $serveraddress = pack ("Sna4x8", 2, $port, $server);
> print ("$serveraddress\n");

The result of this print statement surprises you because you don't
know what pack() does.  You should read about it in perlfunc.  You'll
need to unpack() the data into human-readable form before you, a
human, can read it!

> socket (issocket, 2, 1, $prototype) || die ("No socket");

The special variable $! contains the last OS error, so use it to
inform yourself about what went wrong:

  socket (issocket, 2, 1, $prototype) || die ("No socket: $!");

Of course, Socket.pm provides cleaner methods and symbolic constants
for all of these things, so maybe you ought to use Socket.

Come to think of it, you *really* should be doing this:
   
   use IO::Socket;
   $sock = IO::Socket::INET->new(PeerAddr => 'topgun',
                                 PeerPort => $port,
                                 Proto    => 'tcp');

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


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

Date: Wed, 19 Aug 1998 15:07:53 +0100
From: "Brett Lawrence" <Brettl@datent.com>
Subject: creating a nt service with perl
Message-Id: <903535551.29596.0.nnrp-06.c3ad0896@news.demon.co.uk>

Hi
Can anybody tell me if you can create a service for nt using perl?
If so could you point me to some information on how to do this.


Thanks Brett





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

Date: Wed, 19 Aug 1998 16:17:20 +0200
From: Herve Guillemet <hg@apteryx.fr>
Subject: embedding perl in threaded C or java
Message-Id: <35DADE70.C8B33BBE@apteryx.fr>

Is it safe (with 5.005 ?) to concurently call several perl =

subroutines of the same libperl from different C or java threads ?

Thank you for your help,
Direct email reply would be appreciated,

=3D=3D Herv=E9 Guillemet
   hg@apteryx.fr


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

Date: Wed, 19 Aug 1998 12:36:21 GMT
From: huntersean@hotmail.com
Subject: Re: exception handling
Message-Id: <6regs5$89l$1@nnrp1.dejanews.com>

In article <6rc216$rfm$10@info.uah.edu>,
  Greg Bacon <gbacon@cs.uah.edu> wrote:
> In article <6rbulm$vme$1@nnrp1.dejanews.com>,
> 	huntersean@hotmail.com writes:
> : You want to look at using eval { } and die to catch and throw exceptions
> : respectively.
>
> This isn't what he wants.  He's after a means of exception handlers
> automatically being invoked.  Perl doesn't (yet) have this capability.
>
> I wonder if you could do it with a $SIG{__DIE__} handler...
>
> Greg

Perhaps it's what he needs, rather than what he wants.	Handling exceptions
globally, rather than locally might be a sign of somewhat confused program
design.  He could always wrap his main subroutine in an eval block, which
would be a global exception handler.

Sean H

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 19 Aug 1998 14:22:08 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: exception handling
Message-Id: <6ren2g$8u8$3@info.uah.edu>

In article <6regs5$89l$1@nnrp1.dejanews.com>,
	huntersean@hotmail.com writes:
: Perhaps it's what he needs, rather than what he wants. Handling
: exceptions globally, rather than locally might be a sign of somewhat
: confused program design.

Not necessarily.  Some languages allow you to declare a subroutine as
a handler for exception X, no matter where it occurs.  I believe Ada
does this (although I'm not sure whether that's evidence for your
point or mine :-).

Greg
-- 
Fenster: Treat me like a criminal, I'll end up a criminal.
Hockney: You are a criminal.
Fenster: Why you gotta go and do that? I'm trying to make a point.


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

Date: Wed, 19 Aug 1998 07:56:24 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: filehandle in CGI.pm
Message-Id: <ExxFE0.K52@csc.liv.ac.uk>

In article <35D9D8CC.EF2977F3@hmsi.com>,
Monika Machado <mmachado@hmsi.com> writes:
> I.J. Garlick wrote:
> 
> I have (still) the same problem, 0 bytes,  in the upload file if  the user
> uploading the file is using a proxy.Look in your proxyes configuration.
> 

It shouldn't really matter if you are using a proxy. If it does then you
probably have something mis-configured somewhere as you suggest. Also this
would point to it not being a Perl problem, like I said the code originally
posted was identical to mine where it mattered.

BTW I changed my proxy settings on the browser and I always get the file
uploaded to where I expect it should be. Addmitedly while I was developing
this I got quite a few zero byte files but that was me and not knowing
Perl well enough to get the logic right.

-- 
--
Ian J. Garlick
ijg@csc.liv.ac.uk

People will accept your ideas much more readily if you tell them that
Benjamin Franklin said it first.


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

Date: Wed, 19 Aug 1998 08:10:15 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: filehandle in CGI.pm
Message-Id: <ExxG13.K5w@csc.liv.ac.uk>

In article <35d9af77.16318823@sky2.sky-comm.net>,
bill@sky-comm.net (Bill Mezian) writes:
> On 14 Aug 1998 15:25:13 GMT, wings <xuchu@iscs.nus.edu.sg> wrote:
> 
>>i'm writing an upload script with CGI. as told in CGI.pm, 
>>$q->param('file') returns both the filename as a string and a handle.
>>so here is part of my codes:
>>
>>	$srcfile = $q->param('file');
>>	# assuming that $srcfile='d:\test\a.html'
>>
>>	open (FP, ">d:\\test\\b.html") || die "cant write";
>>	while (<$srcfile>) {
>>		print FP $_;
>>	}
>>
>>i always get zero bytes in b.html. where am i doing wrong?
> 
> You may want to check the routine in CGI.PM itself.  I believe it
> initially writes the file to a tempfile.  If it can't write the
> tempfile, that may be your problem.  I think the tempfile stuff is
> documented in the code.
> 
> Bill

True, but the only way you could loose that is if they undef $q before
calling $q->param('file'), which would produce a different error so we
can assume this was not done. As far as I can tell the temp file CGI.pm
creates hangs around until you kill the CGI object created or exit the
file. Either will call CGI.pm version of the destroy method which tidies
up after it (or should, and I have seen nothing to contradict this)

tap tap tap click tap tap

Yep just checked it disappears when you exit the script.

However having said all of that it might be worth checking to see if the
tempfile created contains anything, since if you copy a 0 byte file then
you will get a 0 byte file. You will find CGI.pm uses the BasePlus.pm
module somewhere along the way which reports a warning to STDERR that it
is creating a file in the temp directory (/var/tmp here). I just check the
error logs for the virtual server to see the name of the tempfile CGI.pm
used. It should be trivial to write a Perl routine to dump an ls -l list
to a file while your script is running.



-- 
--
Ian J. Garlick
ijg@csc.liv.ac.uk

People will accept your ideas much more readily if you tell them that
Benjamin Franklin said it first.


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

Date: 19 Aug 1998 06:38:59 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Greedy arrays in list assignments
Message-Id: <6rdru3$sef$1@pegasus.csx.cam.ac.uk>

Kevin Reid <kpreid@ibm.net> wrote:
>Ken Pizzini <ken@halcyon.com> wrote:
>
>> On Wed, 12 Aug 1998 15:51:59 GMT, Dave Lorand <davel@spc.uchicago.edu>
>> wrote:
>> >  ($temp, @arr, $temp) = split //, 'abcde';
>> 
>> That won't do what you meant it to: the @arr assignment is greedy...
>
>Is there any reason why Perl (c|sh)ouldn't be changed so it isn't
>greedy?

The rather obvious one of compatibility.


Mike Guy


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

Date: 19 Aug 1998 05:46:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Greedy arrays in list assignments
Message-Id: <6rdorb$vi$1@marina.cinenet.net>

0c$2@client3.news.psi.net> <6qr68u$jts$1@nnrp1.dejanews.com> <davel-1208981051590001@honeybee.spc.uchicago.edu> <slrn6t7plr.ggu.ken@pulsar.halcyon.com> <1ddrbcq.yp9jsj19h5mf4N@slip-32-100-246-136.ny.us.ibm.net>
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]

Kevin Reid (kpreid@ibm.net) wrote:
: Ken Pizzini <ken@halcyon.com> wrote:
: > On Wed, 12 Aug 1998 15:51:59 GMT, Dave Lorand <davel@spc.uchicago.edu>
: > wrote:
: > >Or else:
: > >
: > >  ($temp, @arr, $temp) = split //, 'abcde';
: > 
: > That won't do what you meant it to: the @arr assignment is greedy...
: 
: Is there any reason why Perl (c|sh)ouldn't be changed so it isn't
: greedy?

Can't imagine how it could be in a consistent way.  After all, how would
one handle

  (@foo, $bar, @baz) = split //, 'abcde';

in any such general scheme?  I suppose you could limit it to cases with
at most one array in the list, count scalars following the array, and work
backward...but that seems horribly awkward.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 19 Aug 1998 04:34:03 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: here's an implementation of diff in perl
Message-Id: <6rdkjr$kb8@mozo.cc.purdue.edu>

ljz@asfast.com (Lloyd Zusman) writes:

}In the case I mention in the paragraph you quoted, the probability is
}high that the determination of matching/non-matching would occur after
}the first character of the line is tested, irrespective of the
}line-length value N.  This is sublinear w/r/t N, so I suppose this
}would be still be considered O(N) by the definition you supplied ...
}right?

If getting fast line v. line comparisions is your goal, it might be
worth doing the O(length_of_file) hashing for each line, which then
lets you do comparisons in O(1).  (Of course, now we need to talk
about memory efficiency...:)

I still suspect that even the worst line comparison algorithm is
fast enough, and this is all academic.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 19 Aug 1998 14:44:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: here's an implementation of diff in perl
Message-Id: <6reod0$2bg$1@client3.news.psi.net>

M.J.T. Guy (mjtg@cus.cam.ac.uk) wrote on MDCCCXIV September MCMXCIII in
<URL: news:6ree9d$bir$1@pegasus.csx.cam.ac.uk>:
++ 
++ Why not?    Big-O notation merely describes the form of dependence on
++ some parameter.    It can be applied to any quantity.  So:
++ 
++ quicksort takes average time O(n*log n) and worst-case time O(n**2).


"Average"? As prof. Overmars says: "Never use the term `average' when
discussing complexities - be more specific". You probably mean "expected"
here (or maybe "randomized", but certainly not "amortized"), for certain
distributions of the input.

Quicksort has an expected running time of O (n log n) if every permutation
of the input is equally possible. Randomized quicksort has an expected
randomized running time of O (n log n), without making any assumptions on
the distribution of the input. But both of them have an quadratic worst
case running time.


Abigail
-- 
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'


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

Date: 19 Aug 1998 14:56:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: here's an implementation of diff in perl
Message-Id: <6rep3c$2g4$1@client3.news.psi.net>

Michael J Gebis (gebis@fee.ecn.purdue.edu) wrote on MDCCCXIV September
MCMXCIII in <URL: news:6rdkjr$kb8@mozo.cc.purdue.edu>:
++ ljz@asfast.com (Lloyd Zusman) writes:
++ 
++ }In the case I mention in the paragraph you quoted, the probability is
++ }high that the determination of matching/non-matching would occur after
++ }the first character of the line is tested, irrespective of the
++ }line-length value N.  This is sublinear w/r/t N, so I suppose this
++ }would be still be considered O(N) by the definition you supplied ...
++ }right?
++ 
++ If getting fast line v. line comparisions is your goal, it might be
++ worth doing the O(length_of_file) hashing for each line, which then
++ lets you do comparisons in O(1).  (Of course, now we need to talk
++ about memory efficiency...:)

That's not a speed up in an asymptotic sense, for two reasons:
  - Creating the hash value takes Theta (length-of-line) for each
    line - as obviously each character is involved in creating the
    hash value.
  - The fact that 2 different hash values imply the lines are different
    does not mean that 2 equal hash values imply the lines are the same.
    If the hash values are the same, you still need to make an character
    to character comparison for at least N - c characters, where c is 
    fixed and depending on your hash function.


It might be worthwhile in certain cases, but probably not for both
extreme ends of the spectrum. If the files are randomly generated, it is
to be expected most lines are different, and that that can be determined
very rapidly (line lengths, short common prefixes). On the other hand,
if the files are the same, all the hash values are the same, and you've
to do the full line scan to be sure.


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 19 Aug 1998 09:47:27 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: here's an implementation of diff in perl
Message-Id: <6reohv$s5r@fumnix.metronet.com>

Tushar Samant <scribble@pobox.com> writes:
) My "idea" was, if you knew that
) e.g. you had changed a file only on sparse isolated lines, you
) should be able to say "use this much faster diff instead". But
) how slow IS diff?

Standard diff and GNU diff offer "-h" (for half-hearted AFAIK)
which for GNU can also be written "--speed-large-files" which
doesn't find optimal diffs and runs much faster on very large
files.

So you could read the source for GNU diff and figure out what
they are doing there.

Here is my idea for a "quality" setting.  Modify the LCS (Longest
Common Subsequence) algorithm to track a "cost".  When you find two
subsequences that start with the same line, reset the cost to zero.
When the subsequences don't start with the same line, you increment
the cost.  In this last case [S1=(l1 T1), S2=(l2 T2), l1!=l2], if
the cost is above the selected "quality setting", then you assume
neither l1 nor l2 are in the common subsequence, reset the cost to
zero, and compute LCS(T1,T2).

To make this efficient you'd have to modify Memoize to not memoize
the cost parameter [and if you already computed LCS(S1,S2) when
the cost was low, you won't want to skip computing it just because
the cost is high this time].  So the stock Memoize module won't
work here [I assume] or you'd have to wrap a memoized LCS(S1,S2)
inside a non-memoized cLCS(S1,S2,cost) [or make cost a global with
its own stack...].

Anyway, the basic effect of this is to not find identical lines
that are very far apart.  So inserting two blocks of 100 lines
each and then doing diff with a maximum of cost 95 would [I think]
result in those two blocks and all lines between the two insertion
points in both files being considered different [since we check
both starting and ending lines of subsequences].

To get even more sophisticated, you can add a minimum confidence
parameter.  Here, when two subsequences start with the same line,
you increment the confidence parameter.  When confidence gets
high enough, you then reset the cost to zero.  I think standard
diff has this.

This is a nice touch even if you don't track cost because you can
use it to prevent one line in the middle of an insertion from
matching the line after the insertions.  This is particularly
annoying when this line is empty or very short.

Which leads to something I've long wished for...  Allow the
confidence value to be computed based on line length.  So instead
of adding one to it, you add the length of the line that just
matched [including the newline].  Then you could set the
confidence to 90 and two sequences of 90 consecutive blanks
lines would match but you'd only need two lines of more than 44
characters each to match.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: 19 Aug 1998 08:53:02 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "K.Posern" <posern@informatik.uni-marburg.de>
Subject: Re: hmmm...
Message-Id: <4sv9m62p.fsf@mailhost.panix.com>

"K.Posern" <posern@informatik.uni-marburg.de> writes:

> <<<<<<<<<<<<CODE-START (with linenumbers)<
                          ^^^^ ^^^^^^^^^^^
Please don't do that; it makes it very hard to read the program.

>  3:sub foo {
>  4:    @Res = (4);
>  5:    return $Res;
>  5:}

You've never defined the scalar $Res, so you're returning the
undefined value.  What did you mean to return?

> Knuth.

Hmm.  How's volume 4 coming along?

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


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

Date: 19 Aug 1998 13:03:10 GMT
From: Knuth Posern <posern@Mathematik.Uni-Marburg.de>
To: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: hmmm...
Message-Id: <Pine.GSO.4.02A.9808191500140.1833-100000@hadar>

On 19 Aug 1998, Jonathan Feinberg wrote:

> The following message is a courtesy copy of an article
> that has been posted as well.
> 
> "K.Posern" <posern@informatik.uni-marburg.de> writes:
> 
> > <<<<<<<<<<<<CODE-START (with linenumbers)<
>                           ^^^^ ^^^^^^^^^^^
> Please don't do that; it makes it very hard to read the program.

Oh I did it ONLY because I printed some OUTPUT with references to the
line-numbers!

> 
> >  3:sub foo {
> >  4:    @Res = (4);
> >  5:    return $Res;
> >  5:}
> 
> You've never defined the scalar $Res, so you're returning the
> undefined value.  What did you mean to return?


I think you should READ the messages till the END!

thanks.

bye.

Knuth.




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

Date: Wed, 19 Aug 1998 14:39:32 GMT
From: droby@copyright.com
Subject: Re: How do I execute perl from html program
Message-Id: <6reo34$h3n$1@nnrp1.dejanews.com>

In article <35D9E1CE.A51FE7E8@viper.net>,
  Todd Smith <tbsmith@viper.net> wrote:
> where you want the script's output, put
>
> <!--exec cmd="script.pl" -->
>
> guys- just answer the question!
>
> Jon Bell wrote:
>
> > In article <35D8FF58.A7BCE400@home.net>, Alan Melton  <arm@home.net> wrote:
> > >I have a perl program example.pl
> > [snip]
> > >How can I run the program from the web?
> > >either straight or as an html?
> >
> > The same way you run a program written in any other language (in other
> > words, this isn't a Perl question).  You need to learn about CGI, for
> > which the appropriate newsgroup is comp.infosystems.www.authoring.cgi
> > (make sure you read the FAQs before you post!)
> >
> > --
> > Jon Bell <jtbell@presby.edu>
>
> --

Just answer the question, indeed!

Jon did answer the question, and correctly.  Your answer is quite incomplete
and for the specific questioner, likely useless.

In html as in Perl, there's more than one way to do it.  But which of them
(if any) will actually work is highly dependent on the server.	Many
webservers are not configured to allow server-side-includes at all, and many
are configured to disallow the exec command specifically.  Many servers are
configured to disallow CGI, and others require that CGI scripts be put in
specific locations (/cgi-bin or whatever).  And then there are active server
pages...

It's not a Perl question, and Jon's redirect to a more appropriate forum was
much better than an answer in SSI syntax that might or might not work on his
server.

A redirect to the server administrator might also be helpful.

--
Don Roby
<droby@copyright.com>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 19 Aug 1998 08:35:12 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: h.benne@library.uu.nl (Hugo Benne)
Subject: Re: How to clear a filehandle?
Message-Id: <af51m6wf.fsf@mailhost.panix.com>

h.benne@library.uu.nl (Hugo Benne) writes:

> Can anybody explain how to open a file, make a backup of it and clear the 
> original file before closing it?

You might want to

  open the file for read/write
  get an exclusive lock on the file
  use File::Copy::copy() to create the backup
  seek the beginning of the file
  truncate the file
  close the file

All of these techniques are explained in perlfunc, perlfaq5, and
File::Copy.  HTH.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


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

Date: 19 Aug 1998 14:44:58 GMT
From: "Gary" <higary@ms1.hint.net>
Subject: How to download a binary file to browser?
Message-Id: <01bdcb80$5b7b46a0$5d7a5fa8@www.aleading.com>

Can anyone please show me how I can download a binary file to browser in
perl script?

All help greatly appreciated.



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

Date: 19 Aug 1998 13:19:06 GMT
From: Chris Sidi <sidi@angband.org>
Subject: Javascript becoming quite similar to perl
Message-Id: <6rejca$qnh$1@news-int.gatech.edu>

Anyone notice how similar to perl javascript is becoming?
Specifically methods like:

Strings
* match(regexp)
* replace(regexp, newSubStr)
* split(separator, limit) 
  (separator can now be regex)

Arrays
* pop
* shift
* push(elt1, ..., eltN)
* unshift(elt1,..., eltN)
* reverse
* sort(compareFunction)
* join(separator)

Stuff besides methods:
* taint(dataElementName)
* untaint(dataElementName)
* for (i in fooObj) {}

See http://developer.netscape.com/docs/manuals/communicator/jsref/index.htm

-Sidi



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

Date: Wed, 19 Aug 1998 08:20:21 -0600
From: "Debra Ruch" <Debra.Ruch@gov.edmonton.ab.ca>
Subject: New PERL user looking for sites running PERL5 on an NT server with oracle DB
Message-Id: <35da7b7e.0@champ>

Hi,

We have just started working with PERL and are having problems getting
started.

I have reviewed a few FAQ's but there is so much information, I'm not able
to find exactly what it is I'm looking for.  We have also reviewed sample
code which was supplied along with the PERL install.  I'm trying to get
pingecho to work, but I'm getting a parsing error.

Firstly, is it possible to run PERL5 on an NT server connecting to an oracle
dB (v7.2 and v7.3).  Our clients are running both windows 95 and NT.

Secondly, does PERL require its own listener on the server...do you use
tcp-srv ?

Any help will be greatly appreciated.

thanks,

dcr




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

Date: 19 Aug 1998 12:38:05 GMT
From: wsb@rrzn-nis.uni-hannover.de (Wolfgang Sander-Beuermann)
Subject: Performance of OO-Perl ?
Message-Id: <6regvd$m8b$1@newsserver.rrzn.uni-hannover.de>

Hi!

Does someone have experiences in comparing the performance of OO-Perl
to "conventional" Perl?

The background of this question is:
We are running high load meta-searchengines, mainly programmed in Perl.
Up to now we have not used OO-Perl and tried to optimize every byte to
keep the software fast. This is a must, otherwise we can not keep up
with the load.

Now we think of doing some parts (or all) in OO-Perl, BUT we do not know
how this would impact on the performance. There must be some overhead
within Perl for the management of all that OO stuff. Are there any
experiences how much that might cost in runtime speed?


Now the second question:
We tried to set up a little benchmark for that comparison to have an
estimate about the worst which could happen, this benchmark is:

--------------------------------------------------------------
package main;
 my $i; my $zeit1; my $zeit2; my $counter; my $max=1000000;
 # OO-Version:
 $zeit1=time;
 my $var=Test->new();
 for($i=0;$i<$max;$i++){ $var->einefunktion(); }
 $zeit2=time;  my $dif=$zeit2-$zeit1;  print "$dif\n";

 # "conventional"-Version:
 $zeit1=time;
 for($i=0;$i<$max;$i++){ einefunktion();  }
 $zeit2=time;  $dif=$zeit2-$zeit1; print "$dif\n";

sub einefunktion{
# $counter++;            #1
  $x{'counter'}++;       #2
}

package Test;
sub new{
   my $class=shift;
   my $self={};
   $self->{'counter'}=0;
   bless($self, $class);
}

sub einefunktion{ my $self=shift;  $self->{'counter'}++; }

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

If Line #1 is in effect, we have a ration of 27 : 12
If Line #2 is in effect, we have a ration of 27 : 17

That means, the OO-Version is 1.6 to 2.25 times slower,
then the "conventional"-Version.

So the second question in detail:
What do the experts think about this comparision?

BTW: we are using Perl-5.005, mostly on Solaris 2.5

Thanx for your time!

Wolfgang
--
Wolfgang Sander-Beuermann          Tel.: use email            wsb@uni.de
http://i.am/wsb
--> deutschsprachige Meta-Suchmaschine: http://meta.rrzn.uni-hannover.de/
--> Meta-Email-Search-Agent, MESA:      http://mesa.rrzn.uni-hannover.de/


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

Date: Wed, 19 Aug 1998 13:39:57 GMT
From: dave@mag-sol.com
Subject: Re: Perl in Win 98
Message-Id: <6rekjd$cb7$1@nnrp1.dejanews.com>

[This is more appropriate in comp.lang.perl.misc, crossposted and follow-ups
set]

Go to <http://www.activestate.com> and download the latest version of
ActivePerl (which is build from the same source as Perl 5.005.

Dave...

In article <35da491a.0@news.eatel.net>,
  "Jonathan Tapp" <jt@eatel.net> wrote:
> How can I get Perl to run in Win 98?

--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 19 Aug 1998 08:49:24 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Perl Lex ? Perl Yacc ?
Message-Id: <35DAD7E4.5179D49A@email.sps.mot.com>

I have used both modules for some of my work. Both modules seemed to run
pretty slow, even with relatively simple Lex specification or Yacc
grammer. Perhaps it's due to my less-optimised rule and spec design. May
be you can tell me more.

-TK


Uwe Honekamp wrote:
> 
> elouan <elouan@usa.net> wrote in <01bdca35$b462e760$d2dafcc1@none.wonadoo.fr>...
> > Is there any Perl Lex and Perl Yacc ??
> 
> Have a look at the modules Parse::Lex and Parse::RecDescent which
> can be found on any CPAN Server.
> 
> Regards
> 
> Uwe
> 
> --
> 
> Uwe Honekamp * ETAS GmbH * Borsigstr. 10 * D-70469 Stuttgart
> uwe.honekamp@etas.de * voice: ++49/(0)711/89661-143 * fax: -107


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

Date: Wed, 19 Aug 1998 08:56:19 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Perl Lex ? Perl Yacc ?
Message-Id: <35DAD983.2999FFEE@email.sps.mot.com>

Watch out! Although Parse::RecDescent does offer some very nice
features, it does NOT supported 'left-recursive' rules, which could mean
redesigning your yacc grammer. However, it could be due to fact that I
am kinda new to compiler design. May be you can tell me more later.

-TK


Uwe Honekamp wrote:
> 
> elouan <elouan@usa.net> wrote in <01bdca35$b462e760$d2dafcc1@none.wonadoo.fr>...
> > Is there any Perl Lex and Perl Yacc ??
> 
> Have a look at the modules Parse::Lex and Parse::RecDescent which
> can be found on any CPAN Server.
> 
> Regards
> 
> Uwe
> 
> --
> 
> Uwe Honekamp * ETAS GmbH * Borsigstr. 10 * D-70469 Stuttgart
> uwe.honekamp@etas.de * voice: ++49/(0)711/89661-143 * fax: -107


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

Date: 19 Aug 1998 14:25:04 GMT
From: "Uwe Honekamp" <uwe.honekamp@etas.de>
Subject: Re: Perl Lex ? Perl Yacc ?
Message-Id: <01bdcb7d$25cf1200$931a0180@fe13803>

Tk Soh <r28629@email.sps.mot.com> wrote =
<35DAD7E4.5179D49A@email.sps.mot.com>...
> I have used both modules for some of my work. Both modules seemed to =
run
> pretty slow, even with relatively simple Lex specification or Yacc
> grammer. Perhaps it's due to my less-optimised rule and spec design. =
May
> be you can tell me more.

Yes, my experience is basically the same.=20

However, I don't know other modules for this purpose and I'm therefore
more or less happy with them although they're not the fastest.
Especially Parse::RecDescent is sometimes a bit hard to work with but
after a while you get a feeling for the traps ...

Regards

Uwe

--

Uwe Honekamp * ETAS GmbH * Borsigstr. 10 * D-70469 Stuttgart =20
uwe.honekamp@etas.de * voice: ++49/(0)711/89661-143 * fax: -107



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

Date: Wed, 19 Aug 1998 14:37:47 GMT
From: horseyride@hotmail.com
Subject: printf question - newbie
Message-Id: <6renvr$h2q$1@nnrp1.dejanews.com>

Whats the proper way to replace the leading spaces from the %10s with leading
zeroes?

printf log2 "%10s","$count";

I read the FAQ. I read the FM. Maybe I'm just dumb.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 19 Aug 1998 15:12:32 +0200
From: Toni Zeitler <toni.zeitler@informatik.tu-muenchen.de>
Subject: Procmail - domain forwarding
Message-Id: <35DACF40.A3D411A2@informatik.tu-muenchen.de>

Hi!

i've tried to create a procmailrc file that does what i want - that is
quite heavy. here is my problem.

i get FORWARDED mails addressed to domain1.com (To: xyz@domain1.com) at
a mail account at domain2.com (eg. toni@domain2.com). domain2.com is the

server to which i have access.
xyz are about 200 recipients and all mail for them should only be
forwarded again to mail accounts anywhere in the world.
so i thought about using procmail in .forward, simply replacing
"@domain1.com" with "@domain2.com" and forward all mails (=> to
"xyz@domain2.com"). then in .redirect all forwarders are defined...

i did not get this shit working yet! please help! :-)

one more problem i have: i'm mainly a windows user and don't have much
unix experience...

Thanks!
Toni


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

Date: 19 Aug 1998 13:51:53 GMT
From: tigger@io.nospaam.com
Subject: Re: Procmail - domain forwarding
Message-Id: <6rel9p$p8b$1@hiram.io.com>

Toni Zeitler <toni.zeitler@informatik.tu-muenchen.de> spewed forth with:

> i've tried to create a procmailrc file that does what i want - that is
> quite heavy. here is my problem.
[problem snipped]
> i did not get this shit working yet! please help! :-)

> one more problem i have: i'm mainly a windows user and don't have much
> unix experience...

Well, I'll say this hopefully before someone more acrid beats me to it:
Why are you asking this question in a newsgroup that has nothing to do
with procmail? That's your real problem...
BTW, besides checking newsgroups that do have something to do with
procmail, try 'man procmail'.

Paul Archer

-- 
     ___________________________________________________________
     * Tech Support: "I need you to boot the computer."
     * Customer: (THUMP! Pause.) "No, that didn't help."
     __________(http://www.rinkworks.com/stupid)________________


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

Date: 19 Aug 1998 04:44:05 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: request for comments...
Message-Id: <6rdl6l$kd2@mozo.cc.purdue.edu>

"Bill Jones, FCCJ Webmaster" <webmaster@fccjmail.fccj.cc.fl.us> writes:

}A random password genrator...
}# Program control...
}while(1) {
}  $first  = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));
}  $second = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));

The logic here seems dubious.  As somebody else already pointed out,
"rand(time)?!"  I don't think that makes sense.

Second, you really need to seed with something much more random than
the default that comes with srand().  For different values of "too
easily," the random seed is too easily guessed.  Read perlfunc for 
more details on this.


-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: Wed, 19 Aug 1998 13:19:28 GMT
From: mike@w3z.com (Mike Collins)
Subject: slow sub, array missing data
Message-Id: <35dacc07.409989321@news.110.net>

get_data();                         # This seems to work.
open RECORDS,"$cgi_path/words.txt"; # All lines in words.txt
chomp(@found = <RECORDS>);          # Missing lines @found, ???
close RECORDS;

I'm guessing the diamond operator finishes before the subroutine,
because @found is missing the last line or two. 

Sub get_data() reads through two files, seems to work ok because
words.txt has the data. How do I get it all into @found?


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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