[11812] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5412 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 18 17:07:29 1999

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

Perl-Users Digest           Sun, 18 Apr 1999     Volume: 8 Number: 5412

Today's topics:
    Re: "mixed"-Quantifier available ? <rick.delaney@home.com>
        %hashName and CGI Question <sushant@hindustan.vnet.net>
    Re: Any software convert html code into perl code?? <kb8eht@access.mountain.net>
    Re: attach a subroutine to a filehandle <rereidy@uswest.net>
    Re: Books (Randal L. Schwartz)
    Re: Books <puyrebel@prodigy.net>
    Re: Books (Sean McAfee)
    Re: Books <tchrist@mox.perl.com>
    Re: Books <puyrebel@prodigy.net>
    Re: Books <ffchopin@worldnet.att.net>
    Re: Books <ffchopin@worldnet.att.net>
    Re: Books <ffchopin@worldnet.att.net>
    Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <gs_london@yahoo.com>
    Re: Help with Win32 installation needed! <camerond@mail.uca.edu>
        how to make a directory publicly writable? <leenick@interchange.ubc.ca>
    Re: how to make a directory publicly writable? <tchrist@mox.perl.com>
    Re: LWP Help! (Charles DeRykus)
        Mostly perl, but somewhat CGI  (FirstAGYG)
    Re: Mostly perl, but somewhat CGI  (Matthew Bafford)
        Need example <jim@newglobal.net>
        Numeric String <debot@xs4all.nl>
    Re: Numeric String <tchrist@mox.perl.com>
        Probs traversing a directory tree (Dorthe Luebbert)
        Random Integer creation <kb8eht@access.mountain.net>
    Re: Reading File to a Scalar? <aqumsieh@matrox.com>
    Re: Showing contents of a direcotry <aqumsieh@matrox.com>
    Re: Splitting length instead of delimiting character? <aqumsieh@matrox.com>
    Re: Weird problem with perl 5.003, Solaris 2.6 and VXFS <rstikkers@telis.org>
        What's the best way to implement a web based config pro <nride@uswest.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 18 Apr 1999 19:03:12 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: "mixed"-Quantifier available ?
Message-Id: <371A2E6B.763AEA19@home.com>

[posted & mailed]

Tad McClellan wrote:
> 
> Stefan Pochmann (pochmann@gmx.de) wrote:
> 
> : But the main problem is, if your regex finds a sequence with your first
> : matching, it's over ! As far as I know, perl will stop searching as soon
>                                                          ^^^^^^^^^
> : as it is successfull.
> 
>    You don't mean "searching", as in pattern matching.

Actually, I think he does.  Consider this string which should match but
won't with my code.

    aabc

And you can't just throw a while loop around it and use /g because the
second time through it won't match anything.

Here's an improved version:

    my $match = 0;
    while ( $foo =~ /([abc])(?=([abc]{2}))/g ) {
        if ("$1$2" !~ /([abc]).*\1/) {
            $match++;
            last;
        }
    }
    print "Matched $foo\n" if $match;

[abc] can be replaced with whatever pattern and {2} with however many
tokens are required.

As for Stefan's other point, "What do you do if this needs to be checked
in a bigger regular expression ?", I think it should be manageable with
more lookaheads.

So matching 

   /pqr[abc]{3}xyz/

with the same restrictions becomes

    my $match = 0;
    while ( $foo =~ /pqr([abc])(?=([abc]{2})(?=xyz))/g ) {
        if ("$1$2" !~ /([abc]).*\1/) {
            $match++;
            last;
        }
    }
    print "Matched $foo\n" if $match;

Still not very pretty.  I guess we'll just have to wait for Ilya's
"onion rings" syntax.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sun, 18 Apr 1999 15:31:32 -0400
From: "Sushant Gargya" <sushant@hindustan.vnet.net>
Subject: %hashName and CGI Question
Message-Id: <9iqS2.422$b%1.373371@ralph.vnet.net>

Hi Everyone,

Here's the question:

I have some an array, @anArray
I have a hash called %someHash
Typical values of anArray are: 12345, XY1234...
Typical values of someHash are:
            $someHash{'12345'} = "James",
            $someHash{'XY1234'}= "Sue", ....

Using CGI, I have:
$users = $query->popup_menu(-name=>'merchantID',
                -values=>\@anArray,
                -labels=>\%someHash);

I want to be able to SORT the hash with respect to the "Values" of the hash
as oppose to
the keys. In other words, the line above that states: "-labels=>\%someHash"
should have
sorted labels for the popup. I've tried several things, but nothing seems to
work.
I have tried the following:
1)        -labels=>\%someHash = sort values(%someHash)
2)         once the hash has been populated within a subroutine, I do a
            %someHash = sort values(%someHash) before returning the hash.
Both the above things give me the same output (not what I want).
I would appreciate any help. Please direct any responses to
sushant@vnet.net.

Thanks.
-sushant




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

Date: Sun, 18 Apr 1999 14:53:25 -0400
From: Tim Connolly <kb8eht@access.mountain.net>
Subject: Re: Any software convert html code into perl code??
Message-Id: <371A2A25.C4C80608@access.mountain.net>

How about this:
-- START
#!/bin/perl

print <<"HTML";

<INSERT HTML HERE>


HTML

--- END OF FILE

"Kevin !;!;!;!;!;!;!;!;!;!;!;!;!;!;!;!;!;!;!;!;!;" wrote:

> Any software convert html code into perl code??
>
> HE and SHE - %L )M &o  :
> ======================
> http://start.cgirealm.com/heshe1/

-- kb8eht@kb8eht.ampr.org  Tim Connolly
-- kb8eht@kb8eht.#ncwv.wv.usa.noam     Morgantown, WV
-- ICQ# 601237 by request only      aka: tec@mountain.net
-- '94 Suzuki GSX750F-CA "Katana"




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

Date: Sun, 18 Apr 1999 12:25:43 -0600
From: Ron Reidy <rereidy@uswest.net>
Subject: Re: attach a subroutine to a filehandle
Message-Id: <371A23A7.A4901AE9@uswest.net>

This is a multi-part message in MIME format.
--------------5167C6C5D381F9642F7A8E81
Content-Type: multipart/alternative;
 boundary="------------339C285D356DF8F7B11DD33B"


--------------339C285D356DF8F7B11DD33B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I know you probably know this, but ... you should never place the uid/pwd
on the command line.

Why don't you use DBI/DBD?  This would eliminate the creation of another
process (probably a good idea for a heavily hit site).

rr

Corey Saltiel wrote:

> Is it possible to open a filehandle as a pipe ( or alias/reference ...
> thingy ) to a subroutine within the same script?
>
> Am I even making any sense?   (c;
>
> I'm passing a select statement into a pipe attached to a sql*plus
> process ( code following ), I want to parse and manipulate
> the returned data and will then output this data into some
> CGI.
>
> I don't want to have to open a tempory file to store the
> returned data from the sql query, and then do all the manipulation
> from that temp file - I would prefer to do this in one direct step
> ... yes, this would definately fall under Laziness.
>
> Something like:
>
> #!/usr/local/bin/perl
>
> sub query {
>
>    open(SQLPLUS, '|sqlplus arc/arc@webdb') or
>       die "Could not open pipe to sql*plus: $!\n";
>
>    print SQLPLUS <<"EOF";
>
> select some_stuff from a_table;
>
> EOF
>
> }
>
> # yeah, this definately does not work -
> # but you get the gist right?
> #
> open(DATA, '|&query');
> while (<DATA>) { #do stuff }
>
> # and is this as lame as I think it is?
> #
> *lame = &query
> while ($$lame) { #do stuff }
>
> print("stuff to STDOUT");
>
> __END__
>
> Or something similar...
>
> Or maybe a pointer to some pre-existing text on the matter...
>
> Or even just a reality check and a clue.
>
> <grin>
>
> Beers,
>
> Corey
> corey@americanrecruitment.com
>
> ---
>
>    "I can say that I don't know what I'm doing,
>     but I can't say I have the time."
>        -- The Slackers

--------------339C285D356DF8F7B11DD33B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I know you probably know this, but ... you <b>should never</b> place the
uid/pwd on the command line.
<p>Why don't you use DBI/DBD?&nbsp; This would eliminate the creation of
another process (probably a good idea for a heavily hit site).
<p>rr
<p>Corey Saltiel wrote:
<blockquote TYPE=CITE>Is it possible to open a filehandle as a pipe ( or
alias/reference ...
<br>thingy ) to a subroutine within the same script?
<p>Am I even making any sense?&nbsp;&nbsp; (c;
<p>I'm passing a select statement into a pipe attached to a sql*plus
<br>process ( code following ), I want to parse and manipulate
<br>the returned data and will then output this data into some
<br>CGI.
<p>I don't want to have to open a tempory file to store the
<br>returned data from the sql query, and then do all the manipulation
<br>from that temp file - I would prefer to do this in one direct step
<br>... yes, this would definately fall under Laziness.
<p>Something like:
<p>#!/usr/local/bin/perl
<p>sub query {
<p>&nbsp;&nbsp; open(SQLPLUS, '|sqlplus arc/arc@webdb') or
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; die "Could not open pipe to sql*plus:
$!\n";
<p>&nbsp;&nbsp; print SQLPLUS &lt;&lt;"EOF";
<p>select some_stuff from a_table;
<p>EOF
<p>}
<p># yeah, this definately does not work -
<br># but you get the gist right?
<br>#
<br>open(DATA, '|&amp;query');
<br>while (&lt;DATA>) { #do stuff }
<p># and is this as lame as I think it is?
<br>#
<br>*lame = &amp;query
<br>while ($$lame) { #do stuff }
<p>print("stuff to STDOUT");
<p>__END__
<p>Or something similar...
<p>Or maybe a pointer to some pre-existing text on the matter...
<p>Or even just a reality check and a clue.
<p>&lt;grin>
<p>Beers,
<p>Corey
<br>corey@americanrecruitment.com
<p>---
<p>&nbsp;&nbsp; "I can say that I don't know what I'm doing,
<br>&nbsp;&nbsp;&nbsp; but I can't say I have the time."
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- The Slackers</blockquote>
</html>

--------------339C285D356DF8F7B11DD33B--

--------------5167C6C5D381F9642F7A8E81
Content-Type: text/x-vcard; charset=us-ascii;
 name="rereidy.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ron Reidy
Content-Disposition: attachment;
 filename="rereidy.vcf"

begin:vcard 
n:Reidy;Ron
x-mozilla-html:FALSE
org:Reidy Consulting, L.L.C.
version:2.1
email;internet:rereidy@uswest.net
title:Owner
x-mozilla-cpt:;0
fn:Ron Reidy
end:vcard

--------------5167C6C5D381F9642F7A8E81--



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

Date: 18 Apr 1999 11:09:01 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Books
Message-Id: <m190bpol6q.fsf@halfdome.holdit.com>

>>>>> "Ken" == Ken Robbins <puyrebel@prodigy.net> writes:

Ken> Programming Perl is the Camel Book as shown at amazon.com. Is it
Ken> Learning Perl or Programming Perl that you are referring to?

If you're getting them from Amazon anyway, please go to my page at
http://www.stonehenge.com/books/ - so that you can just "one-click" to
get there.  Also, I get a bigger kickback that way. :)

Amazon.com is *not* the cheapest online bookstore though.

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Sun, 18 Apr 1999 13:19:20 -0500
From: Ken Robbins <puyrebel@prodigy.net>
Subject: Re: Books
Message-Id: <371A2228.B8786D7A@prodigy.net>

"Randal L. Schwartz" wrote:
> [snip]
> 
> If you're getting them from Amazon anyway, please go to my page at
> http://www.stonehenge.com/books/ - so that you can just "one-click" to
> get there.  Also, I get a bigger kickback that way. :)

No problem. :) I'm always willing to help.

> Amazon.com is *not* the cheapest online bookstore though.

What are some other bookstores that are cheap. I know of
barnesandnoble.com as well as borders.com, but any others?

[snip]

-- 
Ken Robbins
puyrebel <AT> prodigy <DOT> net


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

Date: Sun, 18 Apr 1999 18:28:46 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Books
Message-Id: <yvpS2.1241$hl6.52116@news.itd.umich.edu>

In article <371A2228.B8786D7A@prodigy.net>,
Ken Robbins  <puyrebel@prodigy.net> wrote:
>"Randal L. Schwartz" wrote:
>> Amazon.com is *not* the cheapest online bookstore though.

>What are some other bookstores that are cheap. I know of
>barnesandnoble.com as well as borders.com, but any others?

There's bookpool.com.  Technical books only.  I've only ordered a couple of
books from them, but their discounts seem to regularly be at least twice
those of amazon.com.

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: 18 Apr 1999 12:30:14 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Books
Message-Id: <371a24b6@cs.colorado.edu>

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

In comp.lang.perl.misc, Ken Robbins <puyrebel@prodigy.net> writes:
:Does anyone know of any good books that just show the different Perl
:functions and how they are used? Really, any recommened books at any
:different level would be appreciated.

You probably want to get the Perl Desktop Reference, which was published
with O'Reilly for six bucks or so; you also used to be able to download
it for free.  It contains all the functions and built-ins, but is much
less weighty an investment (both to your pocketbook and shoulders)
than is Programming Perl (the Camel).  If you are a Unixy kind of
scripting guy, you might try Learning Perl (the Llama) or Learning
Perl for Win32 (the Gecko).  You should really look over the virtually
infinite documentation included with all releases of Perl.  If you need
more in the way of examples in context, then here are some tips:

    ftp://ftp.oreilly.com/published/oreilly/perl/cookbook/
    http://language.perl.com/ppt/
    http://www.perl.com/CPAN-local/authors/id/TOMC/scripts/

The Perl Cookbook (the Ram) mentioned in the first URL is also
available from O'Reilly, and contains 750 pages of examples, programs,
and explanation.

Truth in advertising statement: I personally either wrote, co-wrote,
or edited everything I mentioned above.  If you'd prefer something
not from O'Reilly or from the people who brought you Perl, get "Perl:
The Programmer's Companion", which to my mind is the very best book on
beginning perl that's been been written with programmers (as opposed
to tape operators, administrative assistants, or pizza delivery boys)
in mind.

Others books are mentioned at http://perl.oreilly.com/ and also at
http://language.perl.com/critiques/index.html, or you can search
Amazon for Perl titles.  But what I would really do is walk into a
very big technical bookstore and look at a couple dozen perl books to
see which best suit your needs.  

Warning: particularly in the world of books on perl, the more chincy
graphics and kludgy gimmicks you find in a programming book, the less
technically accurate the book tends to be -- and vice versa.  For example,
the manpages have none. :-)

--tom
-- 
"Most Non-Unix managers conclude that VI is either extraterrestrial
in origin or was devised by the original Unix developers as part of a
secret communication s code to reach another dimension."
    --Communications Week - July 26, 1993.


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

Date: Sun, 18 Apr 1999 13:41:20 -0500
From: Ken Robbins <puyrebel@prodigy.net>
Subject: Re: Books
Message-Id: <371A2750.91D5E970@prodigy.net>

Thanks for all of the information. I most of those books at Barnes and
Noble here in town. I'll check through those URL's and see if it changes
my mind.

-- 
Ken Robbins
puyrebel <AT> prodigy <DOT> net

Tom Christiansen wrote:
[snip]


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

Date: Sun, 18 Apr 1999 14:28:03 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Books
Message-Id: <7fd919$7j3$1@bgtnsc02.worldnet.att.net>

> There's bookpool.com.  Technical books only.  I've only ordered a couple
of
> books from them, but their discounts seem to regularly be at least twice
> those of amazon.com.

Yeah, you're right about the nice discounts, but there's only one thing...
It seems other know, too, as when I recently went to purchase four books,
two were out of stock!  So I did some checking, and many popular books are
regularly out of stock, such as Effective Perl Programming and Web Client
Programming to name a couple.  But, if you can find them there, snatch 'em
up.

Jason Simms




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

Date: Sun, 18 Apr 1999 14:34:40 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Books
Message-Id: <7fd9e6$9fs$1@bgtnsc02.worldnet.att.net>

[couttest CC sent to author via email]

> Programming Perl is the Camel Book as shown at amazon.com. Is it
> Learning Perl or Programming Perl that you are referring to?

I was referring to Programming Perl, but my brain was fried (hence the chide
from Randal - NOT what I want to see in my mailbox...) due to tremendous
lack of sleep.  Let me tell you the books I have in my Perl library, and I
am sure some may or may not disagree or have some to add, but these are
fairly common for people to have:

1.  Learning Perl (yes, the llama book!)
2.  Programming Perl (yes, the camel book!)
3.  Effective Perl Programming
4.  Web Client Programming
5.  Advanced Perl Programming
6.  Perl Cookbook
7.  Mastering Regular Expressions
8.  Official Guide to Programming with CGI.pm (if you do CGI)

There are others, I know, but this comprises a good core library and then
some.  Armed with these and the trusty man pages, FAQ's, etc., you will more
than likely be able to figure out much on your own.  Good luck!

Jason Simms




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

Date: Sun, 18 Apr 1999 14:36:30 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Books
Message-Id: <7fd9h6$9rj$1@bgtnsc02.worldnet.att.net>

> [couttest CC sent to author via email]

Nice...  it looks like my brain is STILL fried!  I just invented a new word
for the English language!

Jason Simms




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

Date: Sun, 18 Apr 1999 20:09:08 +0100
From: "ggs" <gs_london@yahoo.com>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <7fdafg$2qf$1@starburst.uk.insnet.net>

and another good win32 editor is {

Programmer's File Editor is available from a wide range of archive sites
throughout the world.
The definitive source of releases and up-to-date information about PFE is
the PFE Home Page on the World Wide Web, which you can find at
http://www.lancs.ac.uk/people/cpaap/pfe/
}


Andrew Perrin wrote in message
<371A0A72.2816420C@mcmahon.qal.berkeley.edu>...
>Just FYI, emacs for Windows can be found at
>http://www.cs.washington.edu/homes/voelker/ntemacs.html
>
>Cheers,
>Andy Perrin
>
>




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

Date: Sun, 18 Apr 1999 15:08:19 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: "Miroslaw J. Wiechowski" <mjw@bahnhof.se>
Subject: Re: Help with Win32 installation needed!
Message-Id: <371A3BB3.4CF73340@mail.uca.edu>

[cc'd to mjw]

"Miroslaw J. Wiechowski" wrote:
> 
> Hi,
> 
> I am unable to install Perl for Windows (ActiveState Build 5.15).
> The installation program will stop at approximately 95% and
> freeze. I had exactly the same problem with the previous builds.
> 
> Is there anybody who could simply pack his/hers Perl directory
> tree with all files into a ZIP-archive and mail it to me? Or,
> perhaps, to place the archive somewhere on the web?

I would go back to ActiveState and get build 509; that is what most of
us on Windows are using. I do not think that 515 is quite that stable
(they're trying to include more stuff and it's really a beta, if I
understand it right). If you are on Win95 (from your question below),
make sure you have installed DCOM for Win95 first, Win98 and WinNT are
all right here.

> 
> What changes does the Perl installation program make in the
> Win95 registry?
> 
> Thank you in advance
> MJ Wiechowk

-- 
Cameron Dorey
camerond@mail.uca.edu


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

Date: Sun, 18 Apr 1999 11:02:26 -0700
From: Nick Lee <leenick@interchange.ubc.ca>
Subject: how to make a directory publicly writable?
Message-Id: <371A1E32.3BFF76D@interchange.ubc.ca>

Hi,

I think the title explains the purpose of this post. Some of my cgi
scripts create new directory and would write some new files to that
newly created directory. But the cgi script can't write to the new dir
unless it's publicly writable (and I want readable and executable for
other purposes). How should I do it?

I've tried the following:

umask 0;
mkdir dir, 777;

the permission of the new dir still isn't "rwxrwxrwx" even if I set
the umask to 0 beforehand.

Any clue?

Thanks very much,
Nick


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

Date: 18 Apr 1999 12:09:52 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: how to make a directory publicly writable?
Message-Id: <371a1ff0@cs.colorado.edu>

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

In comp.lang.perl.misc, Nick Lee <leenick@interchange.ubc.ca> writes:
:umask 0;
:mkdir dir, 777;
:
:the permission of the new dir still isn't "rwxrwxrwx" even if I set
:the umask to 0 beforehand.

Apparently you have confused octal with decimal.  Permissions
are not specified in decimal, yet you have done this.  That's
your bug.

--tom
-- 
"Lazy people never bother to actually read the manual.  Instead they
  (like kids) pick something with big, colorful buttons."
    --Eugene Tyurin <gene@insti.physics.sunysb.edu> 


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

Date: Sun, 18 Apr 1999 19:28:37 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: LWP Help!
Message-Id: <FAEGrp.A7q@news.boeing.com>

In article <7f614j$imj$1@nnrp1.dejanews.com>,  <eis99@my-dejanews.com> wrote:
>Can someone help me. I am fried trying to understand this.
>
>I want to be able to take contents from a form and post them to multiple cgi.
>I understand I must use LWP, useragent but am not sure how. I located this
>but don't understnad it too much: use HTTP::Request::Common qw(POST);  use
>LWP::UserAgent;
>
>    $ua = LWP::UserAgent->new();
>    my $req = POST 'http://www.perl.com/cgi-bin/cpan_mod',
>                   [ module => 'DB_File', readme => 1 ];
>    $content = $ua->request($req)->as_string;
>
>Could someone please help me out here? Thanks a million!
>

There are some wonderful online docs to get you started.
Read the roadmap: 

   perldoc LWP   

Then proceed with LWP::UserAgent and friends mentioned in
the overview.
    

Or, take a look at the indispensable "Perl Cookbook" by Tom 
Christiansen. Your code snippet is actually from Chapter 20  
on "Web Automation".


Cheers,
--
Charles DeRykus


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

Date: 18 Apr 1999 19:31:07 GMT
From: firstagyg@aol.com (FirstAGYG)
Subject: Mostly perl, but somewhat CGI 
Message-Id: <19990418153107.06196.00001957@ng99.aol.com>

Hey everyone, i know you guys dont like cgi questions, but this seems that its
just as much a possibility of a perl problem.

im using a fairly simple guestbook script.

i use a script to add, and also to view. no real html pages are used.

When i go to the "guestadd" script, i fill everything out of course, and then
the actual "guestbook" script itself adds the info to a database...then it's
sopposed to use the "print "Location"" to redirect me to the "guestview"
script. 

Here's where my problem lays. I use a variable in the Location: redirect, in
the guestbook script. 

When i fill everything out on "guestadd", whenever i include a "@" in the email
field, the guestbook script will redirect me fine. But, when i exclude the "@"
in the email field, i get an internal server error. I have worked and worked
with this and have found that it's the redirect "Location:" using a variable
that is causing it. But the funny thing is, it only gives me that error when i
*dont* use a "@" in the email field. Is this strange or what? Any explanations?
It's baffled me. Thanks alot,

John





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

Date: Sun, 18 Apr 1999 20:35:58 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Mostly perl, but somewhat CGI 
Message-Id: <slrn7hkflg.13v.dragons@dragons.duesouth.net>

On 18 Apr 1999 19:31:07 GMT, FirstAGYG <firstagyg@aol.com>
lucked upon a computer, and thus typed in the following:
[snip]
) When i fill everything out on "guestadd", whenever i include a "@" in the email
) field, the guestbook script will redirect me fine. But, when i exclude the "@"
) in the email field, i get an internal server error. I have worked and worked
) with this and have found that it's the redirect "Location:" using a variable
) that is causing it. But the funny thing is, it only gives me that error when i
) *dont* use a "@" in the email field. Is this strange or what? Any explanations?

I'd say it's a problem in line 42.

Maybe if you showed it to us we might be able to help you.

) It's baffled me. Thanks alot,

HTH,

) John

--Matthew


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

Date: Sun, 18 Apr 1999 20:20:11 GMT
From: Jim <jim@newglobal.net>
Subject: Need example
Message-Id: <3719F865.49135334@newglobal.net>

Hi,

I've been searching for an example of how to pass  the contents of one
form to another.
What I want to achieve is a form that when a user chooses option(1) then
the user will be served another script, and another form. Same for
option(2), etc....

If there's a howto someone could direct me  to I'd be very grateful,

thanks in advance,

Jim



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

Date: Sun, 18 Apr 1999 20:22:24 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Numeric String
Message-Id: <371A22E0.94EDD2C7@xs4all.nl>

How can I detect whether a string is numeric or not. I know it's some
where in the faq's but I couldn't find it anymore.
Please reply by email. Due to serverproblems I can't read most of the
messages.
Thanks


--
                          \\\|///
                        \\  - -  //
                         (  @ @  )
/----------------------oOOo-(_)-oOOo--------------------\
|                                                       |
|                                                       |
| My Email:  debot@xs4all.nl                            |
| Homepages: http://www.searchy.net/                    |
|            http://www.debot.nl/ppi/                   |
|                                                       |
|                                                       |
\-------------------------------Oooo--------------------/
                        oooO    (   )
                       (   )    ) /
                       \ (     (_/
                        \_)




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

Date: 18 Apr 1999 12:40:25 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Numeric String
Message-Id: <371a2719@cs.colorado.edu>

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

In comp.lang.perl.misc, 
    Frank de Bot <debot@xs4all.nl> writes:
:How can I detect whether a string is numeric or not. I know it's some
:where in the faq's but I couldn't find it anymore.

YOU CAN'T FIND THE FAQS?  HOW CAN THIS BE?  THEY COME WITH PERL.

    man perldata
    man perlfaq4
    man perlre
    man perlop

And figure out what you mean by "numeric".  Consider:

    234
    -23
    127.0.0.1
    +8
    .2
    4.
    0377
    0xDEADBEEF
    6.02e23
    sqrt(-1)
    twenty-three

--tom
-- 
     There is always a better way.
                     -- Thomas Edison


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

Date: Sun, 18 Apr 1999 20:25:04 GMT
From: dorthe.luebbert@XREMOVEMEX.ruhr-uni-bochum.de (Dorthe Luebbert)
Subject: Probs traversing a directory tree
Message-Id: <371a3d4a.5550530@news.rz.ruhr-uni-bochum.de>

Hi experts,

I want to traverse a (local) directory. The script should create an
index.htm-file in each directory and write the names of all files that
are stored into the current into this index.htm. And it should also
write the sub-directory names into the index.htm...

I found the following perl script, changed it a bit, but somehow there
is an logical error:  The problem is the root directory. No index-file
is created for the root-directory.  Files that are stored in the root
directory are written into the last traversed directory. 

Any idea, how to change the script?

Dorthe

-----snip---------------------------
#!/usr/local/bin/perl
$startdir='d:\dokus';
&traverse($startdir);

sub traverse {
    local($dir) = shift;
    local($path);
    unless (opendir(DIR, $dir)) {
	warn "Can't open $dir\n";
	closedir(DIR);
	return;
    }
    foreach (readdir(DIR)) {
	next if $_ eq '.' || $_ eq '..';
	$path = "$dir/$_";
     if (-d $path) {		# a directory
	    open (INDEX, ">$path/index.htm");
	    print INDEX "Found Directory: $path\n ";
	    &traverse($path);
	} elsif (-f _) {	# a plain file
		print INDEX "Found file: $path\n";
	}
    }
    closedir(DIR);
}



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

Date: Sun, 18 Apr 1999 14:51:46 -0400
From: Tim Connolly <kb8eht@access.mountain.net>
Subject: Random Integer creation
Message-Id: <371A29C2.74E253F9@access.mountain.net>

    I'm trying to create a random integer value using perl. I am
currently using /dev/random but I'm not having much lunch getting only
the integers from the output, any suggestions ?



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

Date: Sun, 18 Apr 1999 14:53:22 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Reading File to a Scalar?
Message-Id: <x3y1zhhiwv1.fsf@tigre.matrox.com>


"Ray A. Lopez" <rdsys@inficad.com> writes:

> I wanted to know if there were any other (or better) ways of reading
> file data into a scalar?  Below is one implementation I came up with.
> Any other ways????

Here's one:

	my $slurp;
	{ local $/; local @ARGV = ('file'); $slurp = <> }

But, I would recommend using:

	my $slurp;
	open F, 'file' or die "Couldn't open file: $!\n";
	{ local $/; $slurp = <F> }
	close F or warn "Unable to close file: $!\n";

which is a bit clearer. Read perlvar for more info on $/ et al.

HTH,
Ala



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

Date: Sun, 18 Apr 1999 15:00:16 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Showing contents of a direcotry
Message-Id: <x3yzp45hhz3.fsf@tigre.matrox.com>


"R!k" <rusenet@bigfoot.com> writes:

> I need to create an .pl that does the following for me
> 
> first it of course creates an heather like
> 
> <html>
> <head>
> </head>
> <body bla bla>
> <img src=ba bla>
> <b>These are the contents blabla....</B>

Ok .. that's straight forward. Did you have any problems with this part?

> and then it must write all the files in a directory, in a alphabetical order
> (standard i'd say), in a table. i think i'll have to do something like
> 
> print "<table blabla>\n";
> print "<tr><td>"+

Maybe .. depends on how you want it to look like. In any case, you'll
need to have a look at the opendir() and readdir() functions in
perlfunc.

> anyway it sould do a while or for..to (etc) to print all the files...
> And then of course a footer..

Ok .. again this is straightforward. Where exactly do you find the
difficulty? Could you show us the code?



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

Date: Sun, 18 Apr 1999 15:03:24 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
To: Mats Pettersson <mats.pettersson@falukuriren.se>
Subject: Re: Splitting length instead of delimiting character?
Message-Id: <x3yyajphhtv.fsf@tigre.matrox.com>


Mats Pettersson <mats.pettersson@falukuriren.se> writes:

> Is there som sort of '@fields = split_size /7,4,4,4.../' command in
> perl?
> 
> I've searched for examples and such, but don't seem to find any.

Perhaps if you look in perlfaq5, you'll find the answer:

     How can I manipulate fixed-record-length files?
 
     The most efficient way is using pack() and unpack().  This
     is faster than using substr().  Here is a sample chunk of
     code to break up and put back together again some fixed-
     format input lines, in this case from the output of a
     normal, Berkeley-style ps:

         # sample input line:
         #   15158 p5  T      0:00 perl /home/tchrist/scripts/now-what
         $PS_T = 'A6 A4 A7 A5 A*';
         open(PS, "ps|");
         $_ = <PS>; print;
         while (<PS>) {
             ($pid, $tt, $stat, $time, $command) = unpack($PS_T, $_);
             for $var (qw!pid tt stat time command!) {
                 print "$var: <$$var>\n";
             }
             print 'line=', pack($PS_T, $pid, $tt, $stat, $time, $command),
                     "\n";
         }

HTH,
Ala



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

Date: Sun, 18 Apr 1999 12:59:21 -0700
From: "Rick Stikkers" <rstikkers@telis.org>
Subject: Re: Weird problem with perl 5.003, Solaris 2.6 and VXFS
Message-Id: <7fddq1$5n4$1@mentor.telis.org>


Rolf Petter Halle wrote in message ...
>Hi!
>
>We're experiencing some strange problems with perl 5.003 on a
>multi processor sparc running Solaris 2.6 with VXFS.
>
>A perl script which usually finishes after about 5 user seconds, takes
>15 seconds when the perl binary is some hours or days older. The
>script regains speed if the binary is copied, before loosing speed
>after a few more hours or days.
>
>A slow run is like this:
>
># time -p ./perl script
>print dill:500000500002, delta: 15
>
>real 15.67
>user 14.08
>sys 0.00
>
>which can be speeded up by copying
>
># cp ./perl ./perl.copy
># time -p ./perl.copy script
>print dill:500000500002, delta: 4
>
>real 4.42
>user 4.20
>sys 0.02
>
>The perl binary is located on a VXFS filesystem. An identical copy on
>a UFS filesystem never appears to be slow.
>
>Both perl 5.004 and 5.005 seems to run all right, but I'm not sure if
>the problem is only related to 5.003, thus I'd be grateful for any
>tips or hints about what could be wrong.
>
>A truss/strace does not indicate any differences between the two runs,
>except the time.
>
>Details about the system, perl and script are below.
>
>Thanks.
>
>Rolf Halle <rph@nextel.no>


It could just be that after the program is copied, it is still in the disk
cache, so the computer does not have to go get the program over the network.
Try running cat on the script to get it into the disk cache, then run the
program again to see if that speeds it up.

    Rick




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

Date: Sun, 18 Apr 1999 14:05:00 -0600
From: Just this guy you know <nride@uswest.net>
Subject: What's the best way to implement a web based config program?
Message-Id: <371A3AEC.30B5BCC5@uswest.net>

Hello,

I have a C program that reads a complex file and spits out XML. I found
that an extremely elegant way to manipulate the XML file at that point
is to read it in to XML::DOM and let that do all the various dirty work
associated with shuffling data qaround and redisplaying it as HTML.

I'd like to take this all and turn it into a web based config program,
but am at a loss as to the best way to do this. Using a standard CGI
script and mod_perl introduces a lot of problems -- XML::DOM is slow
enough that I don't want to re-read my XML every time I get a
connection, but mod_perl tells me that it's a bad idea to keep files in
memory and I could connect to a different server which would not
remember my previous states anyway. I'd like to avoid the complexity of
a database if at all possible, though I could use something like
berkeley DB if necessary. I definitely want to avoid an SQL database.

I was pondering coding up a HTTP server in perl to pull this off, but
that's rather more programming than I really want to put into it. I'm
trying to keep the complexity of this beast at a minimum.

Anyone have any pointers on the best way to manage a project like this,
or should I just stick with my original C program and use curses to give
the user a terminal based config program?

--
Bruce Ide               nride@uswest.net


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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