[15893] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3306 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 9 18:16:02 2000

Date: Fri, 9 Jun 2000 15:15:36 -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: <960588936-v9-i3306@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 9 Jun 2000     Volume: 9 Number: 3306

Today's topics:
    Re: No offense but Larry Wall should do the maths !! (Brandon Metcalf)
    Re: No offense but Larry Wall should do the maths !! <gellyfish@gellyfish.com>
    Re: No offense but Larry Wall should do the maths !! (Bart Lateur)
    Re: perl cgi problem. thax in advance. (Bart Lateur)
    Re: perl cgi problem. thax in advance. <pradeepr@americasm01.nt.com>
    Re: please help (Craig Berry)
    Re: please help (Craig Berry)
    Re: please help <helza@planet.nl>
        regexp guestions <duane@blur.com>
    Re: regexp guestions <memmett@fraser.sfu.ca>
    Re: regexp guestions (Greg Bacon)
    Re: regexp guestions <duane@blur.com>
    Re: Solution needed for 'simple' task. <ra.jones@NO_UCE*cwcom.net>
    Re: Text Sorting Question <russ_jones@rac.ray.com>
        this is way easy !!! <danielxx@bart.nl>
    Re: this is way easy !!! <sariq@texas.net>
    Re: this is way easy !!! <memmett@fraser.sfu.ca>
        Time-Date Question ?? rrubin@rotor.net
    Re: using hidden fields in a conditionally displayed fo <methos495@earthlink.net>
    Re: using hidden fields in a conditionally displayed fo <ewhite@ssc.wisc.edu>
    Re: using hidden fields in a conditionally displayed fo <care227@attglobal.net>
    Re: using hidden fields in a conditionally displayed fo <care227@attglobal.net>
    Re: using hidden fields in a conditionally displayed fo (Craig Berry)
    Re: Using multiple objects many times <jasonb885@my-deja.com>
    Re: Using multiple objects many times <jasonb885@my-deja.com>
    Re: Wag de Ref (Bart Lateur)
        writing formatted line to MAIL <ultraboy@provision.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 9 Jun 2000 19:10:06 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: No offense but Larry Wall should do the maths !!
Message-Id: <8hrfee$2o8$1@spinner.corpeast.baynetworks.com>

tjla@guvfybir.qlaqaf.bet writes:

 > >"TheEx0rcist" <TheEx0rcist@fanclub.org> writes:
 > >
 > >> Why isn't "print int(rand*3)" the same as "print int(3*rand)" ??? Isn't
 > >> multiplication supposed to be _always_ commutative?
 > >
 > >Apparently, you're new to programming in general.
 > >
 > >	% perl -le 'print int(3*rand)'
 > >	2
 > >	% perl -le 'print int(rand()*3)'
 > >	2
 > 
 > not quite. The original poster wasn't asking about the difference
 > between "3*rand" and "rand()*3". The OP was asking about the difference
 > between "3*rand" and "rand*3". See the difference?

Yes, quite.

The OP thought that rand*3 was multiplication.  Ala is simply pointing
that it is not and providing the correct syntax to do what the OP
thought he was doing.

Brandon


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

Date: 9 Jun 2000 18:00:13 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: No offense but Larry Wall should do the maths !!
Message-Id: <8hr7qt$fpb$1@orpheus.gellyfish.com>

On Fri, 9 Jun 2000 02:02:52 +0200 TheEx0rcist wrote:
> Why isn't "print int(rand*3)" the same as "print int(3*rand)" ??? Isn't
> multiplication supposed to be _always_ commutative?
> 
> I'm using Perl 5.6.0 on Win2k
> 

[gellyfish@orpheus clpmtest]$ perl -MO=Deparse randthing.pl
print int rand *3;
print int 3 * rand;


It is not interpreting the first of them as multiplication.

/J\
-- 
fortune oscar homer


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

Date: Fri, 09 Jun 2000 20:52:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: No offense but Larry Wall should do the maths !!
Message-Id: <394856b4.3677448@news.skynet.be>

Ala Qumsieh wrote:

>> Why isn't "print int(rand*3)" the same as "print int(3*rand)" ??? Isn't
>> multiplication supposed to be _always_ commutative?
>
>Apparently, you're new to programming in general.
>
>	% perl -le 'print int(3*rand)'
>	2
>	% perl -le 'print int(rand()*3)'
>	2

Eh, his question was actually: why is "rand*3" different from
"rand()*3"...

It's so tricky, that the "Perl gods" didn't suspect it even was
different, and as a result, jumped on the wrong train. So no, mr. Monte:

>A
>large percentage of computer programmers and gurus are sorely lacking
>in fundamental knowledge.

IMO, that is an entirely wrong conclusion. Maybe you're lacking in
fundamental knowledge?

-- 
	Bart.


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

Date: Fri, 09 Jun 2000 20:52:00 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: perl cgi problem. thax in advance.
Message-Id: <39465478.3105184@news.skynet.be>

Peng wrote:

>Hi,all. Does anyone know how to let perl cgi achieve the following task?
>When a button is pushed, instead of giving the feedback to the same window,
>the cgi program pops out a new window and display message there.

In the same way as you would do it with an ordinary HTML page. In short:
"It's in the link..."

-- 
	Bart.


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

Date: Fri, 09 Jun 2000 16:39:16 -0500
From: pradeep <pradeepr@americasm01.nt.com>
Subject: Re: perl cgi problem. thax in advance.
Message-Id: <39416404.6C8C94E6@americasm01.nt.com>

U can use 

    print start_form(-target=>'true');

  while intialising the form . 
 
Cheers,
pradeep 


----------------------------------------------
Pradeepa Ramachandra
Email : pradeepr@nortelnetworks.com
ESN : 6-445-5692  Tel : 972-383-5343
----------------------------------------------


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

Date: Fri, 09 Jun 2000 18:27:37 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: please help
Message-Id: <sk2dop5gh519@corp.supernews.com>

Helza (helza@planet.nl) wrote:
: I've asked it already before but most answers I get don't work for some
: reason :( and i'm 100% stuck until i fix this problem :(
: 
: I simply want to ping a ip to see if it responds, if not that it will
: continue with the rest of the program.

And you're not using Net::Ping because...?

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "You live in Los Angeles, and you are going to Reseda; we are
   |   all in some way or another going to Reseda someday, to die."
               - Soul Coughing


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

Date: Fri, 09 Jun 2000 18:46:30 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: please help
Message-Id: <sk2es6v7h5120@corp.supernews.com>

Helza (helza@planet.nl) wrote:
: ohyeah part of code i forgot I tryed the Net::Ping
: 
: ------
: #!/usr/bin/perl
: 
: use Net::Ping;
: 
: $host = "130.89.225.137";
: $p = Net::Ping->new();
: $retval = $p->ping($host,5);
: $p->close();
: 
: print "Content-type: text/html\n\n";
: print "Retval value is: $retval";
: -------
: but everything i wrote below the $p->close();
: doesn't seem to be executed :(

Just ran that very code here (perl 5.005, Solaris 2.6) and all was well
(returned 0, by the way).

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "You live in Los Angeles, and you are going to Reseda; we are
   |   all in some way or another going to Reseda someday, to die."
               - Soul Coughing


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

Date: Fri, 9 Jun 2000 20:42:41 +0200
From: "Helza" <helza@planet.nl>
Subject: Re: please help
Message-Id: <8hre0b$8eg52$1@reader1.wxs.nl>

hi,

Well i just posted a reply to ted marz message here, saying i also tryed
using the net::ping but i also have problems with that, and the socket one i
try fits my needs the best because i need to check if the server is online
at that port, but a ping would also do, but ping/port check would be better
:)

net::ping code i used and didn't get to work:

#!/usr/bin/perl

use Net::Ping;

$host = "130.89.225.137";
$p = Net::Ping->new();
$retval = $p->ping($host,5);
$p->close();

print "Content-type: text/html\n\n";
print "Retval value is: $retval";
-------
but everything i wrote below the $p->close();
doesn't seem to be executed :(

both the print commands you see are never executed :(

Greetings Helza




Craig Berry <cberry@cinenet.net> wrote in message
news:sk2dop5gh519@corp.supernews.com...
> Helza (helza@planet.nl) wrote:
> : I've asked it already before but most answers I get don't work for some
> : reason :( and i'm 100% stuck until i fix this problem :(
> :
> : I simply want to ping a ip to see if it responds, if not that it will
> : continue with the rest of the program.
>
> And you're not using Net::Ping because...?
>
> --
>    |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
>  --*--  "You live in Los Angeles, and you are going to Reseda; we are
>    |   all in some way or another going to Reseda someday, to die."
>                - Soul Coughing




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

Date: Fri, 09 Jun 2000 13:53:19 -0700
From: duane powell <duane@blur.com>
Subject: regexp guestions
Message-Id: <3941593F.8DD41DE7@blur.com>

This code crashes with the message:
/\\computer\share\1\fileName.txt/: reference to nonexistent group at
testoo.pl line 12.

This code, run under version 5.005_02 built for MSWin32-x86-object,
raises the following questions.

Why don't the indentical strings $str1 and $str2 match?
Why does perl treat \\1 as a back reference?

use strict;
my $str1 	= "\\\\computer\\share\\a1\\fileName.txt";
my $str2	= $str1;
my $crashStr	= "\\\\computer\\share\\1\\fileName.txt";

if ( $str1 =~ m/$str2/ ) {
	print "strings match.\n";
} else {
	print "indentical strings dont match.\n";
}
if ( $str1 =~ m/$crashStr/ ) {
	#crash
}


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

Date: 09 Jun 2000 14:10:36 -0700
From: Matt Emmett <memmett@fraser.sfu.ca>
Subject: Re: regexp guestions
Message-Id: <yvw98zwemugj.fsf@fraser.sfu.ca>

duane powell <duane@blur.com> writes:

> This code crashes with the message:
> /\\computer\share\1\fileName.txt/: reference to nonexistent group at
> testoo.pl line 12.
> 
> This code, run under version 5.005_02 built for MSWin32-x86-object,
> raises the following questions.
> 
> Why don't the indentical strings $str1 and $str2 match?
> Why does perl treat \\1 as a back reference?
> 
> use strict;
> my $str1 	= "\\\\computer\\share\\a1\\fileName.txt";
> my $str2	= $str1;
> my $crashStr	= "\\\\computer\\share\\1\\fileName.txt";
> 
> if ( $str1 =~ m/$str2/ ) {
> 	print "strings match.\n";

The confusion is that the statement:

$str = "\\\\computer\\share\\a1\\fileName.txt";

assigns the string "\\computer\share\a1\fileName.txt" to $str.  Then
perl uses that as the regex, not
"\\\\computer\\share\\a1\\fileName.txt".

So, your first if statement is just like

if( $str1 =~ m/\\computer\share\a1\fileName.txt/; ) {

where \s means "a space", \a is ??? (I don't know off hand!), \f is a
formfeed etc etc...  so $str one would have to be 
"\computer harea1...".

That explains why "\\1" is a back reference as well.

Matt




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

Date: Fri, 09 Jun 2000 21:24:42 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: regexp guestions
Message-Id: <sk2o4qi0h5198@corp.supernews.com>

In article <3941593F.8DD41DE7@blur.com>,
    duane powell  <duane@blur.com> wrote:

: This code crashes with the message:
: /\\computer\share\1\fileName.txt/: reference to nonexistent group at
: testoo.pl line 12.

The regular expression parser thinks that \1 is a backreference.  For
example, you can match repeated digits with /(\d)\1/g.

: Why don't the indentical strings $str1 and $str2 match?

If you want to compare strings, then compare strings.  One way to
compare strings is to use Perl's eq operator (see man perlop).  You're
treating the string as a regular expression.  The doubled backslashes
represent a single backslash, so it's as if you'd written

    if ($str1 =~ /\\computer\share\a1\fileName.txt/) { ... }

That regular expression would match a backslash, followed by the string
"computer", followed by a whitespace character, followed by the string
"hare", followed by a BEL, followed by the string "1", followed by a
formfeed, followed by the string "ileName", followed by any character
other than newline, followed by the string "txt".  Clearly, $str1
doesn't match that pattern. :-)  However, examine the output of

    $_ = "Duzit ... \\computer hare\cG1\filename*txt ... urdoanit?"
    print "yup\n" if /\\computer\share\a1\filename.txt/

: Why does perl treat \\1 as a back reference?

It doesn't.  \1 is a backreference (see the perlre manpage), and \1 is
what the regular expression parser sees.

Greg
-- 
If a group of N persons implements a COBOL compiler, there will be N-1
passes.  Someone in the group has to be the manager.
    -- T. Cheatham


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

Date: Fri, 09 Jun 2000 14:50:31 -0700
From: duane powell <duane@blur.com>
Subject: Re: regexp guestions
Message-Id: <394166A7.3C652D05@blur.com>

Thanks you both, Matt and Greg, for your speedy and clear answers.

Duane


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

Date: Fri, 9 Jun 2000 21:39:58 +0100
From: jones <ra.jones@NO_UCE*cwcom.net>
Subject: Re: Solution needed for 'simple' task.
Message-Id: <ryqrYLAeYVQ5EwLK@cwc.com>

On Fri, 9 Jun 2000 at 00:30:16, Abe Timmerman <abe@ztreet.demon.nl> 
wrote:
>On Thu, 08 Jun 2000 14:47:40 GMT, Ala Qumsieh <aqumsieh@hyperchip.co
>m>
>wrote:
>
>...
>> My first thought came in two lines:
>>
>>      @x = qw/a b c d/;
>>
>>      print shift @x;
>>      print @x ? ", $_" : " and $_" while defined($_=shift @x);
>
>and it destroys @x :-(
>
>>
>> But here's a one-liner (provided you didn't play with $[):
>>
>>      print @x == 1 ? $x[0] : join (' and ' =>
>>                              join (', '    => @x[0 .. $#x-1]),
>>                              $x[-1]);
>>
>> Golf, anyone?
>
>       print do{(local $_ = join(', ', @x)) =~ s/(.*), /$1 and /; $_};
>
>Does that qualify?
>
Cerainly does - that one works as well. Many thanks Abe.
-- 
rajones (at) mail.com
or remove NO_UCE* from 'reply-to' address


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

Date: Fri, 09 Jun 2000 13:45:26 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Text Sorting Question
Message-Id: <39413B46.4E0ECE39@rac.ray.com>

Brad Baxter wrote:
> 
> >   JZ> So the whole thing is obviously just a troll from our favorite GURL.
> >   JZ> *ducking very very low*
> >
> > I am sentencing you all to be locked in a closet with moronzilla for a
> > period of no less than 3 days.
> >
> >       Judge Thomas Penfield Jackson
> 
> I'd settle.

I'd chew off my own foot!

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

When cryptography is outlawed, only outlaws will
A2bgg c4dc8 aji0i knS4E 7eFj8 22Rl1
ZdGg3 gu8i6 lu12N s6NoG gn3g3 q835n


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

Date: Fri, 09 Jun 2000 20:21:05 GMT
From: "Daniel van den Oord" <danielxx@bart.nl>
Subject: this is way easy !!!
Message-Id: <Rkc05.685$%h3.13237@Typhoon.bART.nl>

Use a program like sendmail on a 'Unix' server
and let don't post the email but instead use things like id=1 id=2
further in the perl file you can give it another value (the real email) and
send it.. this way they will never know
Which email it is send to ! and no way to recover I did it to !!!

Daniel van den Oord      ( Daniel304 RTCL )

It's nice to be important, but it's more important to be nice
See there be good bye bye

Daniel304rt ResearchTriangle Community Leader
http://www.geocities.com/ResearchTriangle/Forum/5577




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

Date: Fri, 09 Jun 2000 16:06:28 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: this is way easy !!!
Message-Id: <39415C54.692A2B2@texas.net>

Daniel van den Oord wrote:
> 
> Use a program like sendmail on a 'Unix' server
> and let don't post the email but instead use things like id=1 id=2
> further in the perl file you can give it another value (the real email) and
> send it.. this way they will never know
> Which email it is send to ! and no way to recover I did it to !!!

Huh?  Is this some sort of mangled advice for spammers?

> It's nice to be important, but it's more important to be nice

It's nice to be nice, but it's more important to be coherent.

- Tom


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

Date: 09 Jun 2000 14:15:25 -0700
From: Matt Emmett <memmett@fraser.sfu.ca>
Subject: Re: this is way easy !!!
Message-Id: <yvw9wvjyd09e.fsf@fraser.sfu.ca>

Tom Briles <sariq@texas.net> writes:

> Daniel van den Oord wrote:
> > 
> > Use a program like sendmail on a 'Unix' server
> > and let don't post the email but instead use things like id=1 id=2
> > further in the perl file you can give it another value (the real email) and
> > send it.. this way they will never know
> > Which email it is send to ! and no way to recover I did it to !!!
> 
> Huh?  Is this some sort of mangled advice for spammers?
> 
> > It's nice to be important, but it's more important to be nice
> 
> It's nice to be nice, but it's more important to be coherent.

Haha, my gut hurts from laughing!

> 
> - Tom


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

Date: Fri, 09 Jun 2000 21:19:55 GMT
From: rrubin@rotor.net
Subject: Time-Date Question ??
Message-Id: <8hrn18$j5a$1@nnrp1.deja.com>

Hello,

I have a timestamp of the following value 0006091338

I would like to convert that to ... June 09, 2000 13:38

What is the best way to perform this and which package should I
use?

Thanks in advance.

R.Rubin
rrubin@rotor.net


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


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

Date: Fri, 09 Jun 2000 18:21:19 GMT
From: methos <methos495@earthlink.net>
Subject: Re: using hidden fields in a conditionally displayed form
Message-Id: <39413683.589515EA@earthlink.net>

Well It was only a suggestion to use server-side cookies...

These usually aren't doing anything on the client machine.
So there is no need to protect them by firewall.
The cookies are handled by the web server, not the client browser.

Usually when a person comes into a web page, a server session is
started.
That's the session I'm talking about.

This might be something worth looking into.
It gets around the whole <hidden> field problem you're having.

--
- Methos -
"Blaming the Internet for societies problems is like blaming paper for
bad poetry"
      - anonymous -


Drew Simonis wrote:

> methos wrote:
> >
> > Try Cookies...
> > This would save data over multiple pages for that session.
>
> There is no session, and cookies aren't universally compatible.
> Many people turn them off, or use browsers that can or won't read
> cookies, and often they are blocked by firewalls.






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

Date: Fri, 09 Jun 2000 13:37:20 -0500
From: Eric White <ewhite@ssc.wisc.edu>
Subject: Re: using hidden fields in a conditionally displayed form
Message-Id: <39413960.12DE915F@ssc.wisc.edu>



Drew Simonis wrote:

> Eric White wrote:
>
> > When I do this the value for 'color' is passed in the hidden field,
> > but 'flavors' and 'favsoda' are not.  Can I not use hidden fields for
> > the conditionally displayed forms?
> >
> > Thanks a lot,
> >
> > Eric
>
> You kept starting and ending forms, I got confused.  This is a little
> cleaner:  (I monkeyed with indenting to keep it narrow enough)
>
>  sub print_form3 {
>          print header,
>                  start_html('more about snacks'),
>
>          print start_form,
>          "More questions about the snacks you like."
>
>
>                 #if likes ice cream
>                 if (param ('ice_cream') eq '1')
>                 {
>
>                         h3("ICE CREAM"),
>                         p,
>                         "<BLOCKQUOTE>",
>                         "What's your favorite flavor?",
>                         p,
>                         radio_group(
>                         -name=>'flavors',
>                         -linebreak=>1,
>                         -values=>['1', '2'],
>                         -labels=>{'1'=>'chocolate', '2'=>'vanilla'}
>                         ),
>
>                  }
>
>                 #if likes soda
>                 if (param ('soda') eq '1')
>                 {
>                         h3("SODA"),
>                         p,
>                         "<BLOCKQUOTE>",
>                         "What's your favorite sodar?",
>                         p,
>                         radio_group(
>                         -name=>'favsoda',
>                         -linebreak=>1,
>                         -values=>['1', '2'],
>                         -labels=>{'1'=>'jolt', '2'=>'sprite'}
>                         ),
>                  }
>
>
>         #this is always displayed
>         "What's your favorite color?",
>         p,
>         radio_group(
>                         -name=>'color',
>                         -linebreak=>1,
>                         -values=>['1',' 2'],
>                         -labels=>{'1'=>'blue', '2'=>'green'}
>         ),
>         p,
>
>         hidden(-name=>'flavors'),
>         hidden(-name=>'favsoda'),
>         hidden(-name=>'color'),
>
>         submit(-name=>'move', -value=>'page 4'),
>         end_form;
>
> }
>
> But im still unsure of the question.  Or maybe the problem.
> You are passing hidden tags with names but no value option.
> Is this what you are intending?  It is customary to have
> a value associated with a name so that you can test against
> it.  As it is now, you will _never_ not have these 3 names
> available, making any logic test flawed.

My apologies for not cutting the stuff above, but I think it's useful to
keep
in there. I don't think the code above will compile.  I believe perl will
barf
on the first "{" after "print start_form".

Here's code that will compile and illustrates my problem.  In this script,
why
don't 'flavors' and 'flavsoda' have values carried over to the 2nd page?

Thanks very much!

And without further ado, the script:

#!c:\perl\bin\perl.exe -w
# Script: p9258.pl
use CGI ':standard';
use warnings;
use CGI::pretty;
#use strict;
use CGI::Carp qw(fatalsToBrowser);

$action=param('action');
$ice_cream=1;
$soda=1;

#print the right page
if ($action eq "To page 1") {
        print_form1();

} else {
        print_forma();
}


sub print_forma {
        print header,
        start_html('test page 1'),
        h1('test to see which vars are carried over as hidden');

        if ($ice_cream == 1) {

        print start_form,

        h3("ICE CREAM"),
        p,
        "What's your favorite flavor?",
        p,
        radio_group(-name=>'flavors', -linebreak=>1,
        -values=>['1', '2'],
        -labels=>{'1'=>'chocolate', '2'=>'vanilla'}),

        end_form;
        }

        #if likes soda
        if ($soda == 1) {

        print start_form,

        h3("SODA"),
        p,
        "What's your favorite soda?",
        p,
        radio_group(
        -name=>'favsoda',
        -linebreak=>1,
        -values=>['1', '2'],
        -labels=>{'1'=>'jolt', '2'=>'sprite'}),

        end_form;
        }


        #this is always displayed
        print start_form,

        h3("COLOR"),
        "What's your favorite color?",
        p,
        radio_group(
        -name=>'color',
        -linebreak=>1,
        -values=>['1', '2'],
        -labels=>{'1'=>'blue', '2'=>'green'}),
        p,

        hidden(-name=>'flavors'),
        hidden(-name=>'favsoda'),
        hidden(-name=>'color'),

        submit(-name=>'action', -value=>'To page 1'),
        end_form;
}



sub print_form1 {
        print header,
        start_html('test page to display hidden vars'),
        h1('the hidden vars are: ');

        foreach $name ( param() ) {
        $value = param($name);
        print "The value of $name is $value";
        print "<p>";
        }


}






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

Date: Fri, 09 Jun 2000 14:45:40 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: using hidden fields in a conditionally displayed form
Message-Id: <39413B54.2F74014C@attglobal.net>

methos wrote:
> 
> Well It was only a suggestion to use server-side cookies...

No such thing. Check the spec for cookies.

> 
> Usually when a person comes into a web page, a server session is
> started.
> That's the session I'm talking about.

Each page load is a different connection to the server, thus,
no session.  As far as the hidden field thing, I've sent the 
OP a working model of his script.


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

Date: Fri, 09 Jun 2000 14:54:02 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: using hidden fields in a conditionally displayed form
Message-Id: <39413D4A.208926BE@attglobal.net>

Eric White wrote:

Hmmm... I emailed this to you this morning:


#!c:\perl\bin\perl.exe -w
# Script: p9258.pl
use CGI ':standard';
#use strict;
use CGI::Carp qw(fatalsToBrowser);
                              
$action=param('action');             
$ice_cream=1;
$soda=1;

#print the right page
if ($action eq "To page 1") 
{   
        print_form1();
} 
else 
{
        print_forma();
}               


sub print_forma 
{
        print header,
	start_html('test page 1'),
        h1('test to see which vars are carried over as hidden'),
        start_form;
                
        if ($ice_cream == 1) 
	{
		print h3("ICE CREAM"),
                p("What's your favorite flavor?"),
        	radio_group(
			-name=>'flavors', -linebreak=>1,
		        -values=>['1', '2'], 
        		-labels=>{'1'=>'chocolate', '2'=>'vanilla'}
		);
	}
        
        #if likes soda
        if ($soda == 1) 
	{
		print h3("SODA"),
        	p("What's your favorite soda?"),
		radio_group(
		        -name=>'favsoda', 
	        	-linebreak=>1,
		        -values=>['1', '2'], 
		        -labels=>{'1'=>'jolt', '2'=>'sprite'}
		);
        }
        
        
        #this is always displayed
	print h3("COLOR"),        
        p("What's your favorite color?"),
	radio_group(
        	-name=>'color', 
	        -linebreak=>1, 
	        -values=>['1', '2'], 
	        -labels=>{'1'=>'blue', '2'=>'green'}
	),
        p,    
        hidden(-name=>'flavors'),
        hidden(-name=>'favsoda'),
        hidden(-name=>'color'),                         

        submit(-name=>'action', -value=>'To page 1'),
        end_form;                             
}      



sub print_form1 
{
        print header,
        start_html('test page to display hidden vars'),
        h1('the hidden vars are: ');

	@names = param;
        for(@names)
        {
                $value = param("$_");
                print p("The value of $_ is $value");
        }
}      

        
This works for me.


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

Date: Fri, 09 Jun 2000 20:06:25 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: using hidden fields in a conditionally displayed form
Message-Id: <sk2ji17dh51163@corp.supernews.com>

Drew Simonis (care227@attglobal.net) wrote:
: > Usually when a person comes into a web page, a server session is
: > started.  That's the session I'm talking about.
: 
: Each page load is a different connection to the server, thus,
: no session.

I see more and more of this misconception, probably because a lot of these
young whippersnappers have never coded outside ASP, which automagically
manages sessions via cookies.  HTTP is a stateless protocol, but you can
build stateful protocols on top of it, and that's precisely what the
various 'web session' tools (ASP, JSP, CF, etc.) do for you. 

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "You live in Los Angeles, and you are going to Reseda; we are
   |   all in some way or another going to Reseda someday, to die."
               - Soul Coughing


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

Date: Fri, 09 Jun 2000 18:51:52 GMT
From: |Odo| <jasonb885@my-deja.com>
Subject: Re: Using multiple objects many times
Message-Id: <8hrec0$c42$1@nnrp1.deja.com>

In article <8hq6to$6jp$1@porthos.nl.uu.net>,
  "Michael Schlueter" <michael.schlueter@philips.com> wrote:
> |Odo|,
> You raise an interesting question which I can not answer. However, I
would
> use, e.g.
>
>     my $auth = EdcomLib::Auth->new();
>
> instead of
>
>     my $auth = new EdcomLib::Auth;
>
> The reason has been explained in one of perltoot or perlobj, if I
remember
> it correctly. If that has any effect on memory consumption I do not
know.

Thanks for the tip.  I'm going to go look that up and find out the
reason -- I'm curious now.

> How do you determine memory consumption? Do you use the top command
from
> Unix?
>

I've been using top (ktop, actually) with a sleep command in my script.
I've been using the total memory size in KB for my rough estimates.

--
Sincerely,
Jason Boxman

http://edseek.com/ -
     New Literature Message Boards!


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


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

Date: Fri, 09 Jun 2000 19:14:42 GMT
From: |Odo| <jasonb885@my-deja.com>
Subject: Re: Using multiple objects many times
Message-Id: <8hrfmh$d47$1@nnrp1.deja.com>

In article <Xt605.107100$hT2.427521@news1.rdc1.ct.home.com>,
  Dan Sugalski <dan@tuatha.sidhe.org> wrote:
<snip>
>
> Well the obvious thing I can think of is that the new method for one
of
> your three modules chews down a lot of memory. One trick you can use
to
> see what's going on is to insert this line:
>
>   system("ps -lp $$");
>
> in your code before and after every statement that you think might
suck
> down a lot of memory. (Assuming a SysV ps, at least)

I guess what I'm really trying to understand is how much memory compiled
Perl code in a module should consume when I 'use' it in a script, before
calling 'new' (in the case of a module with a class).

When I run my test script, it utilizes some of my modules, which in turn
utilize DBI and a few other modules.

When I subract out my estimated memory consmuption for the external
modules, I'm left with about 800K.  I'm trying to understand if that's
typical or not.  None of my modules exceed 2.5K in size.  I'm having
trouble believing that 800K is typical, but I need to know for sure
before I start exploring other ways of reducing memory overhead.


> My bet would be that you're getting bitten by the SQL module, since
> database connections traditionally suck down great gobs of memory, but
its
> always possible there's a whoops somewhere else, too.

It certainly does use a lot of memory.  I subtracted it from my estimate
though, as indicated above.

It could most definately be a programming error on my part, but what
exactly takes place during the 'use'ing of a module that makes it take
up so much memory?  I don't have any large structures defined in arrays
or hashes with static values in any of my modules, so it can't be that.

I think my problem is I'm not asking the right question.  Or I'm not
asking it in the right way...

> 					Dan
>

--
Sincerely,
Jason Boxman

http://edseek.com/ -
     New Literature Message Boards!


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


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

Date: Fri, 09 Jun 2000 19:46:25 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Wag de Ref
Message-Id: <39414917.192676@news.skynet.be>

The WebDragon wrote:

>[quoting MJD:]
>"and that's just what a hash is: A portable namespace."
>
>I like the idea of the 'portable namespace' and frankly I think I'll be 
>mentally referring to hashes that way from now on. :-)

There are languages which give hashes the appropriate name:
"dictionaries". I just forgot whether it was Python, or PostScript.
Maybe both.

-- 
	Bart.


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

Date: Fri, 9 Jun 2000 16:25:51 -0300
From: "Kevin Jones" <ultraboy@provision.net>
Subject: writing formatted line to MAIL
Message-Id: <yAb05.1410$227.34544@nnrp1.uunet.ca>

is THIS possible?

format INFOLINE =
@<<<<< @<<<<< @<<<<<<<<<<
$var1,    $var2,    $var3.
$var1=this
$var2=that
$var3=the other thing
$~='INFOLINE'

*goto psuedo code*
write 'INFOLINE' to email assuming the $to $from and $mailprog is already
set

Kevin Jones
Systems Administrator
Shaw Cable Systems GP
Dartmouth, NS
(902)469-9540 Ext 194
-----------------------------------------------------------------
                    Your mouse has moved!
Windows has to reboot for changes to take effect.
                                  [ OK ]

-----------------------------------------------------------------
                    "Let me get this straight.
            You DON'T want me to tell anyone?"

 - grinning bewildered man to his new lady friend.




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

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


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