[16329] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3741 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 19 00:05:42 2000

Date: Tue, 18 Jul 2000 21:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963979509-v9-i3741@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 18 Jul 2000     Volume: 9 Number: 3741

Today's topics:
        cgi help <lihock@pc.jaring.my>
        CGI.pm question joelnet1@my-deja.com
    Re: CGI.pm question (jason)
    Re: Clsid Number Changes <bwalton@rochester.rr.com>
    Re: crypt for Perl 4.0 <bwalton@rochester.rr.com>
    Re: How to create a mandatory lock on a file using perl (Abigail)
    Re: Making a Perl module (Keith Calvert Ivey)
    Re: Modify every file in a directory (jason)
    Re: newbie - like it so far - not so sure I do <bo@bo.com>
    Re: newbie - like it so far - not so sure I do ecco64@chello.nl
    Re: newbie - like it so far - not so sure I do <bo@bo.com>
    Re: Newbie: Reading in file contents <bo@bo.com>
        Online Job Vacancies Management Script Wanted firmsonline@my-deja.com
    Re: Open Source PERL Bulletin Board system <o1technospam@skyenet.nospam.net>
    Re: Perl job offered San Mateo Perm (Pjtg0707)
        Plugins architecture <carvdawg@patriot.net>
        Search & replace String <zonegraphics@earthlink.net>
    Re: Splitting on a number: help please (Abigail)
    Re: Splitting on a number: help please (Clinton A. Pierce)
        Submit form? <chaptera@hotmail.com>
    Re: Submit form? (jason)
    Re: Submit form? <bwalton@rochester.rr.com>
    Re: Suggestion for syntax change (jason)
    Re: Weird behavior when using foreach loop and referenc (Gwyn Judd)
    Re: Yet another string manipulation question - (Keith Calvert Ivey)
    Re: Yet another string manipulation question - (jason)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 19 Jul 2000 12:00:14 +0800
From: "han" <lihock@pc.jaring.my>
Subject: cgi help
Message-Id: <8l394u$3ae$1@news5.jaring.my>

Does perl/cgi has the function "Session" like asp?
if nope
how am i going to carry the variable from one html form to another?







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

Date: Wed, 19 Jul 2000 03:18:13 GMT
From: joelnet1@my-deja.com
Subject: CGI.pm question
Message-Id: <8l36l9$rcs$1@nnrp1.deja.com>



I need to take the variables from a submitted form and create formatted
html output from those vars.

I don't want to have to translate let them like this:
$firstname = param("firstname");

in order to use them because there are over 100 vars on the form I'm
working with.


Take a look at this code and you'll see what I'm trying to do - Is
there a way to do this? Should I be using something other than CGI.pm?

TIA!!
Joel

####CODE STARTS

use CGI qw/:standard :html3/;

$newStyle=<<END;
<!--
    {
font-family: Arial, Helvetica, sans-serif; font-size: small; font-
style: normal
    	}
-->
END
    print header();
    print start_html( -title=>'Form Results',
                      -style=>{-code=>$newStyle}
                     );

$result = qq[

======================= <BR>
First Name: param("firstname") <BR>

];

print $result ;

####CODE ENDS


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 19 Jul 2000 03:42:36 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: CGI.pm question
Message-Id: <MPG.13dfc0fe86ba6f999896f3@news>

joelnet1@my-deja.com wrote ..
>I need to take the variables from a submitted form and create formatted
>html output from those vars.
>
>I don't want to have to translate let them like this:
>$firstname = param("firstname");
>
>in order to use them because there are over 100 vars on the form I'm
>working with.

there are a number of options in CGI to create variables directly from 
the CGI parameters .. check out the CGI documentation .. the easiest is 
probably

  import_names()

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 19 Jul 2000 02:40:40 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Clsid Number Changes
Message-Id: <39751565.A261ADA5@rochester.rr.com>

Kenny Lim wrote:
> 
> Hi All,
> 
> My objective here is to be able to perform the following task :
> 
> To only generate the clsid once, and then manually alter the last 4 digits
> of the first batch of the clsid given. (The 4 digits will be incremented
> sequentially)
> [Please see Example below]
> 
> The reason to do this is to help better manage/identify all the clsid id
> given specific to the product versioning.
> 
> Example :
> 
> (a) Given this clsid number generated from GuidGen.exe
> {ADBE2CC0-5CD5-11D4-85DE-00105AE3A355}
> 
> (b) Get the first batch of the clsid which is "ADBE2CC0"
> 
> Problem :
> 
> (c) Manually increment "2CCO" ensuring that there would be no duplication
> occurs during the generation. (ie. loop 10000 time)
> 
> ie. 0001
> ie. 5101 and etc
> 
> I was given this theory to resolve the duplicate problem, but this is not my
> field of expertise
> and I am not sure that I would like to share with you guys.
> 
> if N > 8  then my_increment = -1
> else my_increment = 1
> 
> Please let me know if you need more explicit information. Thanks All.
> 
> Any advise would be greatly appreciated.
> 
> Thanks All in advance.
> 
> Kenny-

Hmmmm...I don't know anything about clsid's, but if all you want to do
is "increment" a 4 character string containing letter and digits, try
something like:

$clsid='ADBE2CC0-5CD5-11D4-85DE-00105AE3A355';
$a=substr $clsid,4,4;
&inc_string(\$a);
substr($clsid,4,4)=$a;
print "$clsid\n";

sub inc_string{ #increment a string ref containing letter and digits,
any mix
	my $ref=shift;
	die "unincrementable string in sub inc_string" 
             unless $$ref; #prevent infinite loop
	$$ref=~s/([a-zA-Z]*[0-9]*)$//; #get ending magical substring
	my $b=$1;
	$b++; #magical increment
	if(length($b)>length($1)){ #carry?
		$b=~s/^.//; #destroy carry digit
		&inc_string($ref); #and increment previous string
	}
	$$ref.=$b; #and tack on the result
}

This works on pathological clsid's like one starting with aaaaz8z9.  I'm
sure this could be golf'ed a bit.
-- 
Bob Walton


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

Date: Wed, 19 Jul 2000 01:29:13 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: crypt for Perl 4.0
Message-Id: <397504A5.16C48DDE@rochester.rr.com>

default wrote:
> 
> Does Perl v4.0.1.8 have a crypt or something that will encrypt text?
 ...
> ...Shawn

At one time, there was a Crypt module, which, if I recall correctly, was
an all-Perl implementation of the crypt function (which function was
missing from some versions of Perl 4 "due to excessive paranoia").  I no
longer have a copy of the Crypt module, and, apparently, neither does
CPAN -- after all, crypt is standard in Perl 5.  But maybe someone else
does?
-- 
Bob Walton


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

Date: 18 Jul 2000 22:07:30 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: How to create a mandatory lock on a file using perl?
Message-Id: <slrn8na4c9.3do.abigail@alexandra.delanet.com>

Chien Yang (csyang@cisco.com) wrote on MMDXIV September MCMXCIII in
<URL:news:3974FDAB.13B6DC00@cisco.com>:
\\ 
\\ I want to create a mandatory lock on a file using perl, so other process
\\ can not modify the file when the script is run.  How can I do that?


First step is to use an operating system that supports mandatory locks.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: Wed, 19 Jul 2000 02:25:22 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Making a Perl module
Message-Id: <39751109.481295@news.newsguy.com>

"Alex T." <samara_biz@hotmail.com> wrote:

>I have my PerlScript:
>
><%
>use strict;
>use vars qw( $Response );
>
>use lib "C:/InetPub/wwwroot";
>
>use Example1;
[snip]

>and I have my module file:
>
>package example1;
[snip]

'Example1' ne 'example1'

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)


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

Date: Wed, 19 Jul 2000 02:22:16 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Modify every file in a directory
Message-Id: <MPG.13dfae2ca08ddfd89896f0@news>

Neil Kandalgaonkar wrote ..
>In article <MPG.13df8b8710f82a759896ed@news>,
>jason <elephant@squirrelgroup.com> wrote:
>>>Assuming your files are whitespace delimited, and that you want to change
>>>every occurence of "foo" in the 6th column to "bar", this one-liner
>>>will suffice:
>>>
>>>$ perl -pli.bak -e '@F=split; $F[5] =~ s/foo/bar/; $_ = join "\t", @F' *
>>>
>>>See man perlrun for an explanation of the switches.
>>
>>also assuming that you have a non-whitespace value in all of the first 6 
>>fields
>
>It wouldn't be whitespace delimited then, would it?

I didn't really make myself clear .. by "value" I meant a non-zero 
length value

if I had a whole bunch of zero-length fields that were tab separated 
then my string would look like

  "\t\t\t\t"

doesn't mean that there aren't fields in there separated by whitespace 
 .. just that the field has no value (ie. is zero-length) .. your 
original would wipe 'em all out

  split /\s/, $_, -1;

will do better

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Tue, 18 Jul 2000 21:23:36 -0400
From: "Bo" <bo@bo.com>
Subject: Re: newbie - like it so far - not so sure I do
Message-Id: <8l2vn5$plk$1@slb7.atl.mindspring.net>

>>   How do I get a sub string ? I want to grab all text between two
known
>>characters
>
>People usually uses regexes for that. For example, if that character
is
>a quote, this will work:
>
> $string = 'He said: "Hello, how are you?"';
> ($quote) = $string =~ /"(.*?)"/;
> print $quote;
>
>The question mark makes the regex non-greedy, so the search stops at
the
>second quote found -- not at the last, which is what you'd get
without
>it.

Please excuse my intrusion, but being a newbie myself, I feel
compelled
to ask the following :

What exactly is "regex" ? I know I could look it up somewhere,
perhaps,
but if I do, I'll probably find a definition that includes half a
dozen other
such undefined words, and so on...

I'm discovering that learning a new language is a frustrating pursuit.
For example, let's take this line given above:

($quote) = $string =~ /"(.*?)"/;

I've looked thru a couple of Perl manuals and I still don't know
the difference between $quote and ($quote). Not only that,
but  ~ /"(.*?)"/ looks like gibberish even after reading some
of the docs. I know that eventually I might figure all of this out,
but I wonder --- Why don't people ever explain these statements ?
Does anyone know a good book on Perl that actually teaches by
the power of example, with proper explanations, instead of merely
(and hastily) throwing code at the reader?

Even the 'clear' texts have the flaw of leaving one feeling like they
understood something, but only for a moment, before running into
=~ /"(.*?)"/; and everything looks murky yet again.

hawk128@hotmail.com

>
>--
> Bart.



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

Date: Wed, 19 Jul 2000 01:24:56 GMT
From: ecco64@chello.nl
Subject: Re: newbie - like it so far - not so sure I do
Message-Id: <39750295.8177961@news.arnhem.chello.nl>

I suggest you read the tutorial at www.useractive.com
I was facing the same problems you have only 3 days ago. I finished
the tutorial in 2 days, and somehow the perl-scripts didn't seem like
a mess anymore...

>What exactly is "regex" ? I know I could look it up somewhere,
>perhaps,
>but if I do, I'll probably find a definition that includes half a
>dozen other
>such undefined words, and so on...
>
>I'm discovering that learning a new language is a frustrating pursuit.
>For example, let's take this line given above:
>
>($quote) = $string =~ /"(.*?)"/;
>
>I've looked thru a couple of Perl manuals and I still don't know
>the difference between $quote and ($quote). Not only that,
>but  ~ /"(.*?)"/ looks like gibberish even after reading some
>of the docs. I know that eventually I might figure all of this out,
>but I wonder --- Why don't people ever explain these statements ?
>Does anyone know a good book on Perl that actually teaches by
>the power of example, with proper explanations, instead of merely
>(and hastily) throwing code at the reader?
>
>Even the 'clear' texts have the flaw of leaving one feeling like they
>understood something, but only for a moment, before running into
>=~ /"(.*?)"/; and everything looks murky yet again.
>
>hawk128@hotmail.com
>
>>
>>--
>> Bart.
>


Kliffoth
~~~~~~~~
while the world keeps spinning
        {
        perl rox!!!
        }


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

Date: Tue, 18 Jul 2000 22:03:03 -0400
From: "Bo" <bo@bo.com>
Subject: Re: newbie - like it so far - not so sure I do
Message-Id: <8l3207$2sv$1@slb3.atl.mindspring.net>

Thank you !

ecco64@chello.nl wrote in message
<39750295.8177961@news.arnhem.chello.nl>...
>I suggest you read the tutorial at www.useractive.com
>I was facing the same problems you have only 3 days ago. I finished
>the tutorial in 2 days, and somehow the perl-scripts didn't seem like
>a mess anymore...
>
>>What exactly is "regex" ? I know I could look it up somewhere,
>>perhaps,
>>but if I do, I'll probably find a definition that includes half a
>>dozen other
>>such undefined words, and so on...
>>
>>I'm discovering that learning a new language is a frustrating
pursuit.
>>For example, let's take this line given above:
>>
>>($quote) = $string =~ /"(.*?)"/;
>>
>>I've looked thru a couple of Perl manuals and I still don't know
>>the difference between $quote and ($quote). Not only that,
>>but  ~ /"(.*?)"/ looks like gibberish even after reading some
>>of the docs. I know that eventually I might figure all of this out,
>>but I wonder --- Why don't people ever explain these statements ?
>>Does anyone know a good book on Perl that actually teaches by
>>the power of example, with proper explanations, instead of merely
>>(and hastily) throwing code at the reader?
>>
>>Even the 'clear' texts have the flaw of leaving one feeling like
they
>>understood something, but only for a moment, before running into
>>=~ /"(.*?)"/; and everything looks murky yet again.
>>
>>hawk128@hotmail.com
>>
>>>
>>>--
>>> Bart.
>>
>
>
>Kliffoth
>~~~~~~~~
>while the world keeps spinning
>        {
>        perl rox!!!
>        }



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

Date: Tue, 18 Jul 2000 22:00:49 -0400
From: "Bo" <bo@bo.com>
Subject: Re: Newbie: Reading in file contents
Message-Id: <8l31su$1h1$1@slb7.atl.mindspring.net>


prakash_ojha@my-deja.com wrote in message
<8knejm$jb2$1@nnrp1.deja.com>...
>try this:
>open (JOBS, "jobs.dat");
>while($line = <JOBS>)
>{ print $line; }


Question : how are you advancing thru this loop?
How is $line "incremented" ?

thanks

>close (JOBS);




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

Date: Wed, 19 Jul 2000 02:07:21 GMT
From: firmsonline@my-deja.com
Subject: Online Job Vacancies Management Script Wanted
Message-Id: <8l32gq$qi4$1@nnrp2.deja.com>

Hi,

Does anyone know where I can get a script for
managing a local community jobs site?

The objective is to allow users to search for a
job and for businesses to be able to post vacancy
details.

Any help will be most appreciated.

Mohan Ali
www.donvalley.org.uk (a community web site with a
jobs section).



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 18 Jul 2000 22:32:50 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: Open Source PERL Bulletin Board system
Message-Id: <tc9d5.319$LZ1.1085@newsfeed.slurp.net>

"brian d foy" <brian@smithrenaud.com.bbs@openbazaar.net> wrote in message
> In article <3961e111.5583408@news.mindspring.com>, zawy@yahoo.com (zawy)
posted:
> > They're elitists.  They place barriers
> > up to newcomers. "Programming Perl" is a great example. "Let's block
> > new people (those who haven't hacked Unix for 5 or 10 years) from
> > wanting and being able to learn the language."

> > Perl is like an expensive 10-speed.  High-entry cost,

> i'm not sure which cost you mean.  Perl is free, and even if you
> buy "Learning Perl", which isn't necessary, you are only out
> $US30.

Let me prefece this by saying that I'm not "green behind the ears", as far
as Perl goes, I'm green from head to foot.  But in my limited experience it
seems to me that Perl is as high or low entry as YOU want it to be.

If "Learning Perl" is further out in Perl-Land than you are, "Perl and CGI
for the world wide web" is very simple.  I hadn't programmed in about 8
years, and had forgoten more than I remembered about programming, and had
never touched Perl.  But I sat down, read a few parts of the book, and wrote
(after a bit of struggle, mostly symantic) a very simple Guestbook.
Granted, that's almost as much HTML as Perl, but it made me happy.

In many ways, Perl reminds me of the command line BASIC that I first
learned.  How can anybody call a language in which you can do this:
"
#########################
#!\usr\bin\perl

print "What is your name?\n";
$name=<STDIN>;
print "Hello $name";
#########################
"
difficult?

That seems about a straight forward as you are going to get.  Could someone
show me a language that does this is an easier way?  What is better than a
language that lets you do things the way that YOU want to?

Recursion?  Ok.
No recursion.  Ok.
Hash tables?  Ok.
Multi-dimentional arrays?  Ok.   ( Though I admit, THAT little tidbit took
some digging on my part, I guess that's one of Perl's dirty little secrets.)
Sloppy treatment of variables?  (Like BASIC)  Ok.
Strict treatment of variables?  Ok.
Want to use.... (gag) goto?  All your friends will hate you, but... Ok.

I could go on, an I'm sure that others here could go on much much further.

Buy a book.  Read a FAQ.  Look at some examples ( like maybe the stuff
posted here ).  Or go to the library.  You got a computer, get a library
card.

JMK




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

Date: Wed, 19 Jul 2000 03:39:38 GMT
From: Pjtg0707@Netscape.net (Pjtg0707)
Subject: Re: Perl job offered San Mateo Perm
Message-Id: <sna8nqlv1nk94@corp.supernews.com>

On 18 Jul 2000 21:02:53 GMT, Eric Bohlman <ebohlman@netcom.com> wrote:
>zack3011@my-deja.com wrote:
>: Zack Network is the Internet's leading server-side infomediary. Using its
>: unique ability to sit between users and the Web, the company has introduced a
>: new paradigm of online content or functionality delivery: a next generation
>: enabling technology. Zack's server-side application platform, the Zack
>: Engine, is designed exclusively for Internet Service Providers and content
>: providers. The technology can deliver any type of content or functionality to
>: users in real time anywhere on the Internet.
>

I am pretty slow today, much slower than usual, but can someone translate i
this for me into everyday 
Perl? I could of swear the message went right    over my head.


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

Date: Tue, 18 Jul 2000 22:14:01 -0400
From: H C <carvdawg@patriot.net>
Subject: Plugins architecture
Message-Id: <39750EE9.AE92539C@patriot.net>

I'm working on a small app, trying to develop a suitable plugins
architecture.
Basically, I've tried having a "plugins" subdirectory, and the main code
reads the
contents of the directory and "registers" the available modules...but
doesn't "use" or
"require" the code.  Then, if certain conditions are met, then the
suitable module is
called using "use" or "require", and the new() method is called.

I've tried a couple of my own ideas, but was wondering if someone has
used something
that they'd be willing to share...

Thanks,
Carv



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

Date: Wed, 19 Jul 2000 03:23:11 GMT
From: Mark A. Fernandez <zonegraphics@earthlink.net>
Subject: Search & replace String
Message-Id: <hm7ansk94jc9g9q0g3hv813821p5djcvfc@4ax.com>


I'm trying to write a PERL script that will search and replace all
instances of a text string in all HTML files in my "html_root"
directory and all subdirectories under the "html_root" directory. 

I'm moving my website from one server and domain to another and want a
fast, easy way to change the HREF and SRC links in my HTML files.
I've been working with PERL for about 3 weeks now, so please don't
bust a gut laughing at me newbie-ness.  ;)  Here's the script I
created ... doesn't work, naturally.

Hints, please?

find . -type f -print | xargs perl -pi -e
's/(\b(:?href|src)="olddomain.com")/newdomain.com/gi'

Thanks!


Mark
 . - a PERL newbie and knows it!



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

Date: 18 Jul 2000 21:13:05 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Splitting on a number: help please
Message-Id: <slrn8na168.3do.abigail@alexandra.delanet.com>

Clinton A. Pierce (clintp@geeksalad.org) wrote on MMDXIII September
MCMXCIII in <URL:news:d63d5.42407$fR2.387494@news1.rdc1.mi.home.com>:
@@ [Posted and mailed]
@@ 
@@ In article <MPG.13dec100de7837e5989692@usenet.plus.net>,
@@ 	Rosemary I H Powell <rosie@dozyrosy.plus.com> writes:
@@ > Given that I have (a whole batch of) data containing strings in the form 
@@ > (3 or 4 letter month)(2 digit year) e.g sept99 or may00, is there a 
@@ > neater way to convert it into the form Sept-99, May-00, than my (working) 
@@ > attempt:
@@ > 
@@ > $result = join ("-",(split (/\d/,,ucfirst($month))),(substr($month,-2)));
@@ 
@@ My first crack at it:
@@ 
@@ $a="sept99";
@@ $a=~s/([a-z]+)(\d+)/ucfirst($1)."-".$2/e;
@@ print $a;

There's no need to match the digits as they are unmodified, and there's
no need for /e either, as Perl has those nice interpolation thingies.

       s/[a-z]+/\u$&-/;

should give a decent golf score.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Wed, 19 Jul 2000 02:41:14 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Splitting on a number: help please
Message-Id: <ez8d5.43042$fR2.391929@news1.rdc1.mi.home.com>

In article <slrn8na168.3do.abigail@alexandra.delanet.com>,
	abigail@delanet.com (Abigail) writes:
> Clinton A. Pierce (clintp@geeksalad.org) wrote on MMDXIII September
> @@ $a="sept99";
> @@ $a=~s/([a-z]+)(\d+)/ucfirst($1)."-".$2/e;
> @@ print $a;
> 
> There's no need to match the digits as they are unmodified, 

Got me there!  :)

> and there's no need for /e either, as Perl has those nice interpolation thingies.
> 
>        s/[a-z]+/\u$&-/;
> 
> should give a decent golf score.

But I wasn't golfing! 

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Wed, 19 Jul 2000 09:44:16 +0800
From: Tom <chaptera@hotmail.com>
Subject: Submit form?
Message-Id: <397507EF.32858663@hotmail.com>

Dear all,

I have prepare a form like this.

</HEAD><BODY>
<FORM METHOD="get" ACTION="cap.pl"
ENCTYPE="application/x-www-form-urlencoded" NAME="disbur">
<P>
<INPUT TYPE="checkbox" NAME="passage" VALUE="NO"
ONCLICK="chked(2)">Passage Allowance (Note 2)
<P>
<INPUT TYPE="button" NAME="confirm" VALUE="Submit"
ONCLICK="valid()"><INPUT TYPE="reset" VALUE=" Clear ">
</FORM><HR></BODY></HTML>

After I click the submit button

http://server/user/cgi-bin/cap.pl?

why the "passage=NO" is missing?

Am I writing wrong?



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

Date: Wed, 19 Jul 2000 02:27:58 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Submit form?
Message-Id: <MPG.13dfaf7cdf46729d9896f1@news>

Tom wrote ..
></HEAD><BODY>
><FORM METHOD="get" ACTION="cap.pl"
>ENCTYPE="application/x-www-form-urlencoded" NAME="disbur">
><P>
><INPUT TYPE="checkbox" NAME="passage" VALUE="NO"
>ONCLICK="chked(2)">Passage Allowance (Note 2)
><P>
><INPUT TYPE="button" NAME="confirm" VALUE="Submit"
>ONCLICK="valid()"><INPUT TYPE="reset" VALUE=" Clear ">
></FORM><HR></BODY></HTML>
>
>After I click the submit button
>
>http://server/user/cgi-bin/cap.pl?
>
>why the "passage=NO" is missing?

this has nothing to do with Perl .. it should be asked in the 
appropriate group

  comp.infosystems.www.authoring.cgi

[ followups set ]

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 19 Jul 2000 02:47:39 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Submit form?
Message-Id: <39751709.59A8C92E@rochester.rr.com>

Tom wrote:
> 
> Dear all,
> 
> I have prepare a form like this.
> 
> </HEAD><BODY>
> <FORM METHOD="get" ACTION="cap.pl"
> ENCTYPE="application/x-www-form-urlencoded" NAME="disbur">
> <P>
> <INPUT TYPE="checkbox" NAME="passage" VALUE="NO"
> ONCLICK="chked(2)">Passage Allowance (Note 2)
> <P>
> <INPUT TYPE="button" NAME="confirm" VALUE="Submit"
> ONCLICK="valid()"><INPUT TYPE="reset" VALUE=" Clear ">
> </FORM><HR></BODY></HTML>
> 
> After I click the submit button
> 
> http://server/user/cgi-bin/cap.pl?
> 
> why the "passage=NO" is missing?
> 
> Am I writing wrong?

This has nothing to do with Perl, but:  did you check the checkbox?  The
parameter will only appear if the checkbox has been checked.
-- 
Bob Walton


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

Date: Wed, 19 Jul 2000 02:06:34 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Suggestion for syntax change
Message-Id: <MPG.13dfaa804ca941209896ef@news>

Bart Lateur wrote ..
>jason wrote:
>
>>if you really 
>>want to index elements from the end of the list then it's easy enough to 
>>do using $#list
>
>Won't do if you don't know beforehand how many items there are, for
>example, if you're talking about an actual list, not an array.

yes .. good point .. I hadn't thought of that (and none of the examples 
had been that)

  ..thinking quickly..

(not to Bart in particular) but in that situation (where you don't know 
beforehand how many items there are) .. would there be many (any?) 
situations where you'd be interested in going from index (x) to index 
(Z-y) (where Z represents the length of the unknown LIST) ??

ok .. now I have a question .. is the proposed special meaning for '..' 
when used in list index context JUST when the right hand operand is 
negative ? .. or is it anytime the LH operator is greater than the RH 
operator ??

ie. does (localtime)[2..0] produce (hour, mday, mon, year, wday, yday, 
isdst, sec) ?? .. or does it produce (hour, min, sec) ??

because the former is counterintuitive .. so I'm guessing the latter is 
the intention

so .. what I'm imagining you have in mind is that when in a list index 
context if either of '..'s arguments are negative then they're replaced 
with LIST length + the negative value .. then '..' is evaluated

I think that the complications added by the special-context outweigh the 
number uses of index (x) to index (Z-y) for a LIST .. ESPECIALLY when 
there's already a defined behaviour for (LIST)[1,0,-1] and you've got 
this operator where 1..-1 means (1,0,-1) outside of list index context

keep in mind that the "y from the end of the list" can always be done 
with an ARRAY assignment and the $#var .. does it happen often enough to 
create this special context ?

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 19 Jul 2000 01:35:30 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Weird behavior when using foreach loop and references
Message-Id: <slrn8na1er.69v.tjla@thislove.dyndns.org>

I was shocked! How could Hervé Masson <herve-news@mindstep.com.bbs@openbazaar.net>
say such a terrible thing:
>Hi,
>
>(Perl version: 5.005_03, reproduced as well on  v5.6.0)
>
>I experienced really strange behavior when using a foreach loop,
>going through a list, known by its reference. When I change
>the loop-variable value inside the loop, it also change the item
>inside the list ! That's not what I expected at all, because I
>thought I was the only "owner" of my local variable '$item',
>and I can safety put any value I want without affecting external
>data, even if my variable used to refer them via a foreach loop.

This is normal behaviour for a for loop. 'for' gives you an alias to the
thing you are indexing so that you can easily change the loop. This
makes it easy to modify all the items in a list without needing to know
where in the list you are. This is a good thing (tm). If you want you
can do something like this:

for (@list)
{
  $item = $_;

  # and now you can safely modify $item
}

Hope that helped.

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Assuming that either the left wing or the right wing gained
control of the country, it would probably fly around in circles.
		-- Pat Paulsen


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

Date: Wed, 19 Jul 2000 02:47:27 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Yet another string manipulation question -
Message-Id: <397615b5.1677417@news.newsguy.com>

elephant@squirrelgroup.com (jason) wrote:

>change your code to this for flawless operation (thanks to Keith)
>
>  my %rules = ( a => 'be', c => 'd', e => 'kl', v => 'a' );
>  my $char = 'X';
>
>  for my $key (keys %rules)
>  {
>    $String1 =~ s/$key(?=[^$rules{$key}])/$key$char/g;
>  }

Actually, there's one more problem.  What about the end of the
string?  I assume 'acdea' should become 'aXcdeXaX', but this
code gives 'aXcdeXa'.  Change the substitution to use a negative
look-ahead:

     $String1 =~ s/$key(?![$rules{$key}])/$key$char/g;

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)


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

Date: Wed, 19 Jul 2000 03:38:56 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Yet another string manipulation question -
Message-Id: <MPG.13dfc024536c1c9e9896f2@news>

Keith Calvert Ivey wrote ..
>elephant@squirrelgroup.com (jason) wrote:
>
>>change your code to this for flawless operation (thanks to Keith)
>>
>>  my %rules = ( a => 'be', c => 'd', e => 'kl', v => 'a' );
>>  my $char = 'X';
>>
>>  for my $key (keys %rules)
>>  {
>>    $String1 =~ s/$key(?=[^$rules{$key}])/$key$char/g;
>>  }
>
>Actually, there's one more problem.  What about the end of the
>string?  I assume 'acdea' should become 'aXcdeXaX', but this
>code gives 'aXcdeXa'.  Change the substitution to use a negative
>look-ahead:
>
>     $String1 =~ s/$key(?![$rules{$key}])/$key$char/g;

nup .. the original spec gave an example of one of those .. and no X was 
added when it ended the string .. this was actually the reason why I 
abandoned the lookahead in the first place .. I was negative-looking at 
first and realised that it added to the end of the string - so I went 
for the negative character class and straight capturing

here's Vinod's words ..
>and if the input string is aece, the string should be made aeXcXe

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3741
**************************************


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