[9621] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3215 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 21 12:17:13 1998

Date: Tue, 21 Jul 98 09:00:25 -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           Tue, 21 Jul 1998     Volume: 8 Number: 3215

Today's topics:
        ? about binmode() behavior <REPLY_TO_damonbrent@earthlink.net>
    Re: Best perl book for web programming <joneil@cks.ssd.k12.wa.us>
    Re: Bug in regex quantifiers? (Bryan Miller)
    Re: Bug in regex quantifiers? (Bryan Miller)
    Re: Bug in regex quantifiers? <quednauf@nortel.co.uk>
    Re: comp.lang.perl.announce redux #3 (Alan Schwartz)
    Re: copying data (Mark-Jason Dominus)
    Re: Fun with large hashes (Mark-Jason Dominus)
        Getting it working on NT/95 <JLEHMANN@dsccc.com>
    Re: Getting it working on NT/95 <quednauf@nortel.co.uk>
    Re: how to pass by reference (Greg Bacon)
    Re: how to pass by reference (Greg Bacon)
    Re: log file hell (Neil Neely)
    Re: mail bomber source code for perl. <nonspammers.cut.after.the.period.hot_redox@hotmail.com>
    Re: mod_perl on RedHat 5.1 <yong@shell.com>
    Re: need expert opinions <khaines@oshconsulting.com>
    Re: need expert opinions (Neil Neely)
    Re: Need help with POST <REPLY_TO_damonbrent@earthlink.net>
    Re: open (IN, "foo.txt") works, open (IN, "$foo") does  (J|rgen P|nter)
        Perl & the AS/400!! (Bleddyn Williams)
    Re: Perl Beautifier Home Page <tchrist@mox.perl.com>
    Re: Perl CGI's under Windows NT (mikep)
    Re: Perl CGI's under Windows NT (mikep)
    Re: Perl for kids (Steve Linberg)
        Perl script run in process space of another?!??? <rhakim@cyberus.ca>
    Re: print<<"xxx" vs. print <tchrist@mox.perl.com>
        Problems with decimals in perl <webmaster@acidhouse.com>
    Re: Problems with decimals in perl <tchrist@mox.perl.com>
    Re: Problems with decimals in perl <quednauf@nortel.co.uk>
    Re: regexp question (Tad McClellan)
    Re: string manipulation, newbie question <r.goeggel@atos-group.de>
    Re: use strict <joneil@cks.ssd.k12.wa.us>
    Re: What's wrong? <yong@shell.com>
    Re: wordwrap code snippet <jdf@pobox.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 21 Jul 1998 10:50:52 -0400
From: "Brent Verner" <REPLY_TO_damonbrent@earthlink.net>
Subject: ? about binmode() behavior
Message-Id: <6p29pq$g3e$1@oak.prod.itd.earthlink.net>

does binmode() only work when using

    while(<STDIN>)
    {
        print <SOMEFILE> "$_";
    }

or 'should' it also work using

    read STDIN,$buffer,$length,$offset;
    print <SOMEFILE> "$buffer";

? ? ?

i'm using the latter, and i don't see that it is having any effect.  of
course binmode(STDIN); binmode(STDOUT); binmode(SOMEFILE) is called before
I/O.  i'm confused . . . any comments, suggestions, sources of more info
about binmode()'s behavior would be greatly appreciated.

thanks,

brent



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

Date: Tue, 21 Jul 1998 07:56:16 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: John <cbob@isource.net>
Subject: Re: Best perl book for web programming
Message-Id: <35B4AC0F.346E2B4B@cks.ssd.k12.wa.us>

John wrote:
> 
> Programming Perl is the only book that I've looked at, and it seems ok.
> How does it compare to the other books on the market.  If all I'm going
> to be doing is web programming, should I spend my money on this book or
> on a different "aftermarket" book more tailored to the internet?

There is no fundamental difference between "Web Programming" with perl
and "Some Other Kind Of Programming" with perl.  Perl, by any other
name, is still Perl.  "Programming Perl" is your best reference,
regardless of the task.  If you are looking for something web specific,
pick up a copy of Marty Halls "Core Web Programming."  No perl, but an
excellent tome none the less.

Jerome


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

Date: 21 Jul 1998 15:03:03 GMT
From: millerb@millerb.fc.hp.com (Bryan Miller)
Subject: Re: Bug in regex quantifiers?
Message-Id: <6p2aj7$kns@fcnews.fc.hp.com>

Apologies to all who have read this thread, all who may read it
in the future and all who may be born under it's shadow.  I own
and have read both editions of "Learning Perl" and "Programming
Perl, Friedl's "Mastering Regular Expressions" and Srinivasm's
"Advanced Perl Programming".

I didn't mean to turn a bad Monday at the tube into a regex
free-for-all.  Matt Prior was correct in my lack of anchors
which I somehow overlooked.  My expression now looks like

$patch_num !~ /^PH(KL|NE|CO|SS)_[0-9]{3,5}$/

Thanks to everyone else for the recommendations to purchase the
canonical Perl Documentation Suite (as mentioned above).  I certainly
didn't get this much response when posing more difficult questions
such as why waitpid(3) is still broken under Digital Unix :-O
Ah...  Life on c.l.p.m...

Bryan


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

Date: 21 Jul 1998 14:42:45 GMT
From: millerb@millerb.fc.hp.com (Bryan Miller)
Subject: Re: Bug in regex quantifiers?
Message-Id: <6p29d5$kns@fcnews.fc.hp.com>

Larry Rosler (lr@hpl.hp.com) wrote:

: Ugh.  An HP guy who hasn't grokked perlre yet.

Ugh.  An(other) HP guy who hasn't grokked social skills yet...

: The '1234' part of '123456789' matches your regex, doesn't it?  If you 
: want this not to match, you have to tell it that the next thing (if 
: any) is not a digit:

: if ($patch_num !~ /^\d{3,4}(?!\d)/) {

Actually in the intended application the regex is much more complex
so it's not just a matter of adding anchors.  The number is embedded
in a much longer expression.

: I've also added a front anchor, just in case, and replaced your digit 
: ranges by the more shapely '\d'.  Actually the number is hex but I
used [0-9] to keep it simple.  The mechanics remain the same.

: Invest in 'Programming Perl', read the docs, and help improve our profit-
: sharing!

Actually I own both additions and have read them from cover to cover.
I don't ever remember having this problem before so I am going to chalk
it up to Monday and having to mentor two college hires concurrently...

Bryan (hoping _his_ social skills pass muster) Miller


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

Date: Tue, 21 Jul 1998 16:07:09 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Bug in regex quantifiers?
Message-Id: <35B4AE9D.DEEBC432@nortel.co.uk>

Bryan Miller wrote:
> 
> Larry Rosler (lr@hpl.hp.com) wrote:
> 
> : Ugh.  An HP guy who hasn't grokked perlre yet.
> 
> Ugh.  An(other) HP guy who hasn't grokked social skills yet...
> 

Don't make me sell my printer...by the way, it's making strange noises
lately...


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 21 Jul 1998 14:20:00 GMT
From: alansz@araw.mede.uic.edu (Alan Schwartz)
Subject: Re: comp.lang.perl.announce redux #3
Message-Id: <6p282g$2ee0$1@piglet.cc.uic.edu>

Nathan Torkington  <gnat@frii.com> writes:
>So, the vocal comp.lang.perl.misc folks seem to have several
>attributes:
> - want commercial vs non-commercial tagged
> - want productivity vs misc. application tagged
> - don't want to see CGI programs
>
>Bear in mind that tagging really only works on *either* productivity
>*or* commercial.  If you can suggest a way for both to be tagged,
>without massively long subject lines, please do.

Let the tag for commercial products be "COM". Let the tag
for applications that happen to use perl (as opposed to postings
of stuff that's *for* using/programming perl) be "APP". 

A non-commercial, programming tool:
Subject: Footool!

A commercial programming tool:
Subject: COM: Footool!

A non-commercial application
Subject: APP: Frozbase with built-in perl

A commercial application:
Subject: COM APP: Frozbase with built-in perl

Further, assume that other than the tags, subject lines may not be
in all upper-case. Killfiles that are case-sensitive should then
work nicely. Killfiles that aren't case sensitive (and presumably
don't do regexp matching but only simple string stuff) could use 
patterns like "COM ", "COM:", and "APP:"

I'm for something like this, and a CGI script written in perl 
IMHO isn't an APP (unless it lets you remotely write perl code or
beautify uploaded perl files or whatever - in those cases, simply
being a CGI script shouldn't disqualify it from being announced.)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                       Alan Schwartz <alansz@uic.edu>
Asst. Prof. of Clinical Decision Making | University of Illinois at Chicago
Adj. Asst. Prof. of Psychology          | Department of Medical Education
   "Life is what happens to you while you're busy making other plans"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: 21 Jul 1998 11:47:19 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: copying data
Message-Id: <6p2d67$14t$1@monet.op.net>

In article <vu90ln6euu.fsf@otis.arraycomm.com>,
Farhad Farzaneh  <ff@otis.arraycomm.com> wrote:
>What's a good way to do multi-dimensional array copies?  

Use a recursive function.  I posted one here some time in the last few
months, but it's not hard to duplicate.  It looks like

	sub deepcopy {
	  my $arg = shift;
	  my $type;
	  return $arg unless $type = ref $arg;
	  if ($type eq ARRAY) {
	    return [map {deepcopy($_)} @$arg];
	  } elsif ($type eq HASH) { 
	    ... duplicate hash items ... 
	  } elsif ...
	  }
	}
	  

If you are copying a two-dimensional array, you can use

	@copy = map {[@$_]} @orig;



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

Date: 21 Jul 1998 11:37:09 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Fun with large hashes
Message-Id: <6p2cj5$13s$1@monet.op.net>

In article <6p1cge$h58$1@pegasus.csx.cam.ac.uk>,
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>And what causes that, you probably need a DB_File expert to answer.

A simple answer might be `try upgrading to Berkeley DB version 2 and
the latest version of DB_File'.


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

Date: Tue, 21 Jul 1998 09:09:35 -0500
From: JLEHMANN <JLEHMANN@dsccc.com>
Subject: Getting it working on NT/95
Message-Id: <35B4A11E.DB19CB45@dsccc.com>

On NT: Is it necessary to use batch files?  I've seen one person do
something like "perl script.pl < %2 > %3" in their batch file.  Because
the problem I'm having is in the "get" parameter passing style necessary
for a self-referential script.  If batch files aren't necessary, what
steps must be taken? - simply registering the .pl extention?

Really dumb question:  Can you do the same on 95, and run perl scripts
through netscape locally, without using server software?


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

Date: Tue, 21 Jul 1998 15:40:52 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Getting it working on NT/95
Message-Id: <35B4A874.1061ABF4@nortel.co.uk>

JLEHMANN wrote:
> 
> On NT: Is it necessary to use batch files? 

No, but it could be useful for running perl with different parameters.
Then again, you might as well leave that.

> I've seen one person do
> something like "perl script.pl < %2 > %3" in their batch file.  Because
> the problem I'm having is in the "get" parameter passing style necessary
> for a self-referential script.  If batch files aren't necessary, what
> steps must be taken? - simply registering the .pl extention? 

Yes, associate it with your Perl interpreter. Another step is to have
the path to the Perl interpreter in your path variable. In tha way you
can always call perl itself through the command line.

> Really dumb question:  Can you do the same on 95, and run perl scripts
> through netscape locally, without using server software?

These are two questions. Same what on 95 ? If it's teh stuff beforehand,
yes. If its your second question, no. For CGI, you'll need a server.
It's not too hard though. Check my webpage for a howto on setting it up.

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 21 Jul 1998 15:07:46 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: how to pass by reference
Message-Id: <6p2as2$s34$4@info.uah.edu>

In article <35B3FCFC.775B5BB7@erols.com>,
	"Matthew O. Persico" <mpersico@erols.com> writes:
: M.J.T. Guy wrote:
: > 
: > [snip]
: > Shhh!  Don't tell anyone, but the secrets of the Temple Lore have been
: > revealed in perlsub:
: > 
: >      [snip]
: >      The array @_ is a local array, but its elements are aliases for
: >      the actual SCALAR (emphasis Matthew O. Persico) parameters.
: 
: Which does SQUAT if you want to pass an array or hash. Then, you need to
: pass and explicit reference. Otherwise, the array or hash will be
: flattened out.

Like I said, you can play symbol table games, but that only works for
variables that live in the symbol table. :-)

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 21 Jul 1998 15:09:11 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: how to pass by reference
Message-Id: <6p2aun$s34$5@info.uah.edu>

In article <35B39B1B.75E293E8@wanadoo.com>,
	Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com> writes:
: Sabre Taylor wrote:
: > I'd like to alter subroutine parameters without using the return function.
: > I've tried the relevent resources, but haven't understood a simple way to
: > do this.
: 
: I can't believe you didn't try 'perldoc perlref'. Even 'perldoc perl'
: (or 'man perl' on Unix) contains the word 'reference'.

Pass-by-reference is not the same as passing a reference by value.

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 21 Jul 1998 15:34:26 GMT
From: neil@elara.frii.com (Neil Neely)
Subject: Re: log file hell
Message-Id: <6p2ce2$m7a$1@europa.frii.com>

j (jjones@nospam.elementdesign.com) wrote:

: open(LOG, "access.log") or die "cannot open access.log: $!";
: 	while (<LOG>) {
: 	}
: close(LOG);
: How could I make this more efficient?  Any help appreciated.

Most directly look really closely at what you are doing in the 'while' loop.  
What are you keeping?  If your keeping every value of the log file in some 
field, than yes it is going to take a large amount of resources.
Discard information that is irrelevant to you as quickly as possible.

If you need all fields of this datafile in memory at once, you can read the 
whole file in faster using:
@DATA = <LOG>;
but my guess is you only need a couple relevant fields, so I'd do the following:
if your log entry looked like the following:
useless www.domain.com useless useless useless 12

while (<LOG>) {
    next unless (/^\w+\s([a-zA-Z\.]+)\s\w+\s\w+\s\w+\s(\d+)$/);
    $locationhash{$1} += $2;
}
(It's always a good idea to anchor your regex's on both ends if possible it speeds 
up the comparisons, and the next is just in there to skip entries you don't want to 
look for on this pass, you may not want it present)
this could be used to say total the number of bytes transfered from your site to 
or count number of hits, or something like that.

Regards,

Neil


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

Date: 21 Jul 1998 14:04:22 GMT
From: "My Name" <nonspammers.cut.after.the.period.hot_redox@hotmail.com>
Subject: Re: mail bomber source code for perl.
Message-Id: <01bdb4b0$71b25bc0$c1620c8a@lnxcompaq.lexis-nexis.com>

> >>Matthew Flinchbaugh <matthew@nofear.hjsoft.com> wrote:
> >>-> hey does any one have the perl source code for a mail bomber?

> yeah, 
> 
> #!/bin/sh
> cd /
> rm -r
> 
> This simple, two line code, run on any linux machine as root will
> connect to a special port on the sendmail server. Run this shell
> script and you will get a series of prompts, asking things like
> "target server or email address", number of messages to send,
> duration, etc.

Actually I think:
#!/bin/sh
cd /
rm -rf

would be more helpful for our friend



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

Date: Tue, 21 Jul 1998 10:29:35 -0500
From: Yong Huang <yong@shell.com>
To: Leslie Mikesell <les@MCS.COM>
Subject: Re: mod_perl on RedHat 5.1
Message-Id: <35B4B3DF.A500D128@shell.com>

Mine gives its signature at SERVER_SOFTWARE not GATEWAY_INTERFACE:

SERVER_SOFTWARE = Apache/1.3.0 (Unix) mod_perl/1.13

Leslie Mikesell wrote:

> If you have the 'printenv' script that is distributed with apache or
> some similar script that displays environment variables,
> you will see:
> GATEWAY_INTERFACE = CGI/1.1       if you are running normal CGI and:
> GATEWAY_INTERFACE = CGI-Perl/1.1  under mod_perl.
>
>  Les Mikesell
>   les@mcs.com





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

Date: Tue, 21 Jul 1998 08:44:48 -0600
From: "Kirk D. Haines" <khaines@oshconsulting.com>
To: Zheng Yuan <zyuan@hercules.acsu.buffalo.edu>
Subject: Re: need expert opinions
Message-Id: <6p29aq$ol5$1@news-2.news.gte.net>

Zheng Yuan wrote:
> 
> I have a very large database which people access via a perl script. The
> problem is that when there are 25 people accessing this database at the
> same time the server chokes: If accessed by one person the system is very
> quick at retrieving the results, but when more try searching, it seems
> there are so many processes going on, the server slows to almost a stand
> still.
> 
> Right now when searching in the database I am doing this:
> 
> open(LINK, "<myfile.dat");
>         while ($item = <LINK>) {
>                 #search for a specific string
>         }
> close LINK;
> 
> Because my database is over 150000 records and 50 megs, this process can
> take a very long time which I wish I could speed up as well. I can't
> simply read all this into an array as it would eat up all memory.
> 
> Any suggestions?

If you provide us with an idea of what the content is, you may get
better answers.

-If the order of content doesn't matter, sort it and then do a binary
search on it.

-If it's an option, maybe look at using an actual database like MySQL
(www.tsx.se)
to hold your data.

-Use a DBM to store the data.

-Break the data into multiple smaller files organized alphabetically,
and add some intelligence to your program to select the correct smaller
file to search.

-Set the $/ variable (the input record seperator) to what you are
searching for.  Read the first two 'lines' from the file.  Return $/ to
it's original value.  Use a couple regexps something like:

$line1 =~ /^(.*)\Z/m;
$interesting_line = $1;
$line2 =~ /\A(.*)$/m;
$interesting_line .= $1;

$line will now contain the line of your file that has the text you were
searching for.
This is quite fast, even on very large files.


Kirk Haines


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

Date: 21 Jul 1998 15:46:27 GMT
From: neil@elara.frii.com (Neil Neely)
Subject: Re: need expert opinions
Message-Id: <6p2d4j$m7a$2@europa.frii.com>

Zheng Yuan (zyuan@hercules.acsu.buffalo.edu) wrote:
: Right now when searching in the database I am doing this:
: open(LINK, "<myfile.dat");
: 	while ($item = <LINK>) {
: close LINK;
: Because my database is over 150000 records and 50 megs, this process can

This depends a bit on the kind of database you have and how many relevant 
parts of it you wish someone to be able to search.  The tie funtion is probably
what your looking for.  More or less your database just becomes one big
hash that is really stored in disk space not in RAM.  The only difficulty with
this is determining unique 'keys' for the hash so values are never lost.  Just
look at your data and decide if you can do this approach.  

Also if you want several different fields able to be searched you can 
create secondary DB files, it increases the disk space, but its pretty much the 
cheapest resource.

Tip: 
Don't succumb to this problem:
'foreach $key (keys %values) {
     next unless /$match/;
 }
'
it's much better if your keys are the words they are searching for i.e.
print "$datahash{$match}\n";

no looping (if possible, it might not be.)

Regards,

Neil


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

Date: Tue, 21 Jul 1998 10:40:06 -0400
From: "Brent Verner" <REPLY_TO_damonbrent@earthlink.net>
Subject: Re: Need help with POST
Message-Id: <6p295k$feb$1@oak.prod.itd.earthlink.net>


file <file@job.to> wrote in message 6p23ti$e06$1@usenet51.supernews.com...
>no... I  didn't make myself clear ...
>
>what i am looking for is a way to post something very quickly and with as
>little traffic as possible to another script... this has nothing to do with
>sending mail with a script... from a form...
>
>There is no code... but lets say I wanted to post to
>www.abc.com/script.cgi the following varialbes name with the value "file" -
>email with the value "something@else" etc... and then the same fashion for
>other scripts as well... i basically want to simulate the pressing of a
>submit-button...

www.abc.com/script.cgi?name=value&name1=value1&name2=value2....

will set $ENV{'QUERY_STRING'} which nets similar effect as a POSTed <FORM>.
*NOTE*  spaces ' ' should be replaced with '%20' or  '+'. there are other
characters that need to be escaped also. check around.

hope this helps.

brent



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

Date: 21 Jul 1998 11:54:42 GMT
From: Juergen.Puenter@materna.de (J|rgen P|nter)
Subject: Re: open (IN, "foo.txt") works, open (IN, "$foo") does not???
Message-Id: <6p1vi2$ks2$1@penthesilea.Materna.DE>

In article <6p1amq$40p$1@penthesilea.Materna.DE>, Juergen.Puenter@materna.de 
says...

Thanks to everybody who helped me solving this problem.

It turned out to be totally unrelated to Perl after all.

Consider this problem solved.

Thanks again
	Juergen Puenter



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

Date: Tue, 21 Jul 1998 15:33:35 GMT
From: bleddyn@ignite400.org (Bleddyn Williams)
Subject: Perl & the AS/400!!
Message-Id: <35b4b437.26824674@news.demon.co.uk>

Hi I know AS/400 may a swear word in this group but we are looking for
help in getting Perl to run it. I have so far been unable to find
anyone within the AS/400 groups which I use if you can be of any help
then get in touch.

Thanks Bleddyn

http://wwww.ignite400.org makeing the AS/400 into a machine for
eBusiness. 
Thanks Bleddyn



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

Date: 21 Jul 1998 14:54:05 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Beautifier Home Page
Message-Id: <6p2a2d$sqo$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    jdporter@min.net writes:
:Oh, man, don't get into that.  Claiming that
:	BuildImpersonateExplicitAccessWithName  // Thank you, M$
:ought to be
:	build_impersonate_explicit_access_with_name
:just gives 'em more ammo.

Of course it ought to be.  The time it takes you to make out the former
rendition is significantly delayed with respect to the time to make out
the latter one.  And that counts.  Nobody wants to read phrases without
separators.

--tom
-- 
 agoraphobia (n) - fear of implementing or of being trapped in open systems


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

Date: 21 Jul 1998 13:35:27 GMT
From: mikep@rt66.com (mikep)
Subject: Re: Perl CGI's under Windows NT
Message-Id: <6p25ev$loc$1@news.rt66.com>

In article <35b48ad6.0@news.new-era.net>
scott@softbase.com writes:

> With both IIS and PWS: *DO* *NOT* *USE* *PERL.EXE* !!!!!!!
> 
> It won't work. I've never gotten it to work. It's hopeless. Cut
> your losses and get out while you can. Typical losses include:

I've never had a problem with this. ISAPI is what you have to use yes.
But ISAPI is a DLL that _requires_ PERL.EXE to be installed beforehand.
The DLL simply points to the executable (or at least that's what I
understand).

Now I haven't been able to make server side executables work perse
using IIS. (e.g. <!--#exec cmd="..."--> so anything you can tell me
there will be much appreciated. That will make our onsite browsing
experience much more fruitful and rich.

MTIA

===========================
Mike Powell
mikep@rt66.com
http://www.rt66.com/~mikep/


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

Date: 21 Jul 1998 13:43:23 GMT
From: mikep@rt66.com (mikep)
Subject: Re: Perl CGI's under Windows NT
Message-Id: <6p25tr$m2f$1@news.rt66.com>

In article <35b48ad6.0@news.new-era.net>
scott@softbase.com writes:

> With both IIS and PWS: *DO* *NOT* *USE* *PERL.EXE* !!!!!!!
> 
> It won't work. I've never gotten it to work. It's hopeless. Cut
> your losses and get out while you can. Typical losses include:

I've never had a problem with this. ISAPI is what you have to use yes.
But ISAPI is a DLL that _requires_ PERL.EXE to be installed beforehand.
The DLL simply points to the executable (or at least that's what I
understand).

>    1. Just downloading the Perl file -- this happens because the
>    registry isn't configured to run a .pl file as a CGI program.
>    It thinks you're downloading a ZIP file or something.

This sounds like a browser problem at first. But with a closer
inspection of the problem it's actually the server ignoring the perl
script and allowing the browser to see it (and react to ) in the first
place.

>    2. Running a .pl program successfully, but having it hang and
>    freeze. This happens if you get perl.exe to somehow run. The
>    file handles for perl.exe are screwed up, as far as I can tell,
>    and it hangs waiting to read or write. That's my guess, and
>    only a guess since there's no way to debug the problem.

Actually the PERL ISAPI docs are clear (though you have to dig a little
for it) that you have to manually hack the registry yourself in order
for .pl extension files to be properly handled by the ISAPI PERL DLL.
Something like including a registry key named ".pl" or whatever you're
calling the extension(s) (no quotes) and then including a value for the
DLL I believe (or the EXE, I don't recall off the top of my head). But
the docs are clear on what needs to happen.

Now I haven't been able to make server side executables work perse
using IIS. (e.g. <!--#exec cmd="..."--> so anything you can tell me
there will be much appreciated. That will make our onsite browsing
experience much more fruitful and rich.

MTIA

===========================
Mike Powell
mikep@rt66.com
http://www.rt66.com/~mikep/


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

Date: Tue, 21 Jul 1998 11:20:42 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl for kids
Message-Id: <linberg-2107981120420001@projdirc.literacy.upenn.edu>

In article <35B42545.509ACE1A@steelplan.com.au>, ryan@steelplan.com.au wrote:

> Steve Linberg wrote:
> 
> > I love Perl -- it *is* the game --, but I'm glad I didn't start with it.
> > Plain vanilla C taught me more about programming than anything else,
> > because you can't write C without understanding memory, data types, and
> > data structures.  Once you know C, you can really appreciate everything
> > Perl does for you.  It certainly isn't the easiest place to start, though.
> 
> At the wee age of 20, I find it easier to learn Perl than it is to learn C...
> Don't ask why.

That's what I meant - that C isn't the easiest place to start.  I've heard
it said of the guitar that it is the easiest instrument to learn and the
hardest to master.  I think Perl is kind of like that. :)
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Tue, 21 Jul 1998 15:39:23 GMT
From: Richard Hakim <rhakim@cyberus.ca>
Subject: Perl script run in process space of another?!???
Message-Id: <35B4B69C.994F3287@cyberus.ca>

Hi -

I'm hoping someone here can help me.  I have a first perl script (say,
script1) that calls another (script2), currently via the `` operator.
Now, though, that first script has a variable (a database handle) that I
want the second script to have access to.  Is there a way to do this
without having the db handle go out of scope and disappear?!?  Is there
a way of making a variable global/public/whatever and not having it
disappear between programs?

Thanks for any help,

Richard Hakim
richard.hakim@entrust.com



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

Date: 21 Jul 1998 14:55:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: print<<"xxx" vs. print
Message-Id: <6p2a5u$sqo$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    fred@no.spam.leeds.ac.uk writes:
:Is there any possibility of a Perl changing its interpretation of here
:documents to ignore the last newline? Or can I do an explicit chomp
:somewhere?

print <<EOF =~ /(.*)\n$/s;
    stuff here;
EOF
-- 
"Incrementing C by 1 is not enough to make a good object-oriented language."
(M. Sakkinen, in "On the Darker Side of C++", ECOOP'88)


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

Date: Tue, 21 Jul 1998 16:48:25 +0200
From: Nico van Leeuwen <webmaster@acidhouse.com>
Subject: Problems with decimals in perl
Message-Id: <35B4AA38.A0937A2D@acidhouse.com>

Hi,

I have been working on a program that is meant to show some accounting
information. One of the operations involves the calculation of a tax
which amounts to 12.5% of the total. Offcourse that was easy to do
however I end up with way to many numbers after the decimal point. I
would like there to be only 2 numbers after the decimal point, so I
tried the following:

 $rawgst = int $gstraw*100;
 $gst = $rawgst/100;

to get the decimal out, for some reason it won't do what I want. Is
there maybe a specific function in perl for this kind of operation?

Greetz,

Nico.



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

Date: 21 Jul 1998 14:57:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Problems with decimals in perl
Message-Id: <6p2a8q$sqo$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, webmaster@acidhouse.com writes:
: $rawgst = int $gstraw*100;
: $gst = $rawgst/100;
:
:to get the decimal out, for some reason it won't do what I want. Is
:there maybe a specific function in perl for this kind of operation?

You mean like the one discussed in your fine perlfaq4 manpage,
not to mention your fine perlfunc manpage?

--tom
-- 
	    "Perl is to sed as C is to assembly language."  -me


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

Date: Tue, 21 Jul 1998 16:04:56 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Problems with decimals in perl
Message-Id: <35B4AE18.752A8F7@nortel.co.uk>

Nico van Leeuwen wrote:
> 
> Hi,
> 
> I have been working on a program that is meant to show some accounting
> information. One of the operations involves the calculation of a tax
> which amounts to 12.5% of the total. Offcourse that was easy to do
> however I end up with way to many numbers after the decimal point. I
> would like there to be only 2 numbers after the decimal point, so I
> tried the following:
> 
>  $rawgst = int $gstraw*100;
>  $gst = $rawgst/100;
> 

Nice try, but int simply takes the integer part of the numer, so 3.99
becomes 3.

You could use printf("%.2f",$number);

Or, with your way $new = (int $gstraw*100+0.5)/100;


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Tue, 21 Jul 1998 09:46:48 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: regexp question
Message-Id: <ok92p6.t62.ln@localhost>

Tim Gray (tim@hcirisc.cs.binghamton.edu) wrote:

: I am trying to come up with a regexp that will match the size
: attribure in an HTML <FONT> tag and am failing miserably.

: Why doesn't this expression
: m/<font.*?\s(SIZE=.*?)[>\s]/

: match this string?
: <font COLOR="#006600" SIZE="+1">


   Ahh, but it *does* match:


---------------------
#!/usr/bin/perl -w

$_ = '<font COLOR="#006600" SIZE="+1">';

if ( m/<font.*?\s(SIZE=.*?)[>\s]/)
   {print "matched '$1'\n"}
else
   {print "NOT matched\n"}
---------------------

outputs: 
matched 'SIZE="+1"'




: Any help is appreciated.

   You don't have a problem  ;-)


[ posting a complete (and short) code snippet that exhibits your
  problem is an effective way to get your question answered.

  posting code with no problems is less effective  ;-)
]


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 21 Jul 1998 15:07:54 +0200
From: "Ronald Gvggel" <r.goeggel@atos-group.de>
Subject: Re: string manipulation, newbie question
Message-Id: <6p23st$2iu$1@news.pop-stuttgart.de>


Rick Harrison schrieb in Nachricht ...
>I have a bilingual dictionary file that is formatted like this...
>
>vial : hettuglas
>vibration : titringur
>victim : tj&oacute;n&thorn;oli
>
>What's the most efficient way to get a string from any line of this
>file that consists only of the part before the colon?

efficient?
- in disc space:  $line =~ /:/; print $`;
- in time: maybe via index()
- ...


>but suddenly I need to do it in Perl, which I am just learning.
>

good idea.

>Also, is it better (with regard to conservation of web server
resources)
>to suck the whole file into an array before combing through it to
>find pattern matches, or better to pull one line at a time from the
>disk file?

I prefer reading line by line. This is my kind of programming, - and
the temporary variables don't grow up to the sky.

But reading with <> and doing a grep is elegant, too.

Ronald




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

Date: Tue, 21 Jul 1998 08:20:26 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: Gil Brown <gil_brown@hp.com>
Subject: Re: use strict
Message-Id: <35B4B1BA.688135DE@cks.ssd.k12.wa.us>

Gil Brown wrote:
> #! /usr/bin/perl -w
> #use strict;
> $line = <$fh>;
> 
> # ./test
> Global symbol "line" requires explicit package name at ./test line 10.
> Execution of ./test aborted due to compilation errors.

The answer is in the error message.  $line has not been scoped, and an
explicit package name has not been named - required when using strict.

Try

my $line = <$fh>; 

And see if it works.

Good Luck!

Jerome O'Neil
Seattle Public Schools
Information Services


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

Date: Tue, 21 Jul 1998 10:19:25 -0500
From: Yong Huang <yong@shell.com>
To: Wilson Henriquez <henrwi00@usfca.edu>
Subject: Re: What's wrong?
Message-Id: <35B4B17D.E425421F@shell.com>

Because you have a space between #! and /.

Yong

Wilson Henriquez wrote:

>     I'm starting to learn perl from Learning Perl(O'reilly), and I am
> having trouble.  I'm running Linux and use joe to create a text file
> named ex.  In ex I put the following code,
> #! /usr/bin/perl
> print ("Hello, world!\n");
> Then I save the file and do, chmod +x ex.  Next I try to run the
> exeecutable file I get the message "print not found".  What am I doing
> wrong?





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

Date: 21 Jul 1998 10:00:50 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "T. Youderian" <tyoud@u.washington.edu>
Subject: Re: wordwrap code snippet
Message-Id: <7m17qme5.fsf@mailhost.panix.com>

"T. Youderian" <tyoud@u.washington.edu> writes:

> Here's the function... it has a bug though :)

Indeed. The bug is that part where you didn't use the Text::Wrap
module, which is waiting for you at the CPAN.
 
  http://www.perl.com/CPAN-local/CPAN.html

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


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

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

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