[25351] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7598 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 3 21:53:36 2005

Date: Mon, 3 Jan 2005 15:26:52 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 3 Jan 2005     Volume: 10 Number: 7598

Today's topics:
    Re: Leak in Win32::ChangeNotify? <matthew.garrish@sympatico.ca>
    Re: Line continuation in Perl <abigail@abigail.nl>
        Mail::Thread, From headers incorrect? <frizop-manchu@charter.net>
        Memory leak or expected behavior? syost@quicktopic.com
    Re: multiple packages/classes in one file <toddrw69@excite.com>
        my wife dumped me i need help redsheep_pt@yahoo.com
    Re: need help reading source code: HTML::Parser <Juha.Laiho@iki.fi>
    Re: need help reading source code: HTML::Parser <spamtrap@dot-app.org>
    Re: Newbie question on require and semaphores <gmeazell@swbell.net>
    Re: Newbie question on require and semaphores <matthew.garrish@sympatico.ca>
        Newbie Question <johnsanders@lovinthelord.org>
    Re: Newbie Question <johnsanders@lovinthelord.org>
    Re: Newbie Question <noreply@gunnar.cc>
    Re: Passing value to another CGI. <matthew.garrish@sympatico.ca>
    Re: Passing value to another CGI. ioneabu@yahoo.com
    Re: Passing value to another CGI. <sam.wun@authtec.com>
    Re: Passing value to another CGI. <sam.wun@authtec.com>
    Re: Passing value to another CGI. <postmaster@castleamber.com>
    Re: Passing value to another CGI. <sam.wun@authtec.com>
    Re: Passing value to another CGI. <sam.wun@authtec.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 29 Dec 2004 11:47:31 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Leak in Win32::ChangeNotify?
Message-Id: <BcBAd.29407$Tn1.1142943@news20.bellglobal.com>


"Thomas Kratz" <ThomasKratz@REMOVEwebCAPS.de> wrote in message 
news:41d283b9$0$782$bb690d87@news.main-rheiner.de...
> Matt Garrish wrote:
>>
>> Strange. The first time I ran the script the nonpaged memory slowly grew 
>> (nothing like what you describe, though). I let it run up from ~10100K to 
>> ~11500K before killing script (at which point it dropped right back to 
>> where it started), but on subsequent restarts could not get the script to 
>> leak again (it stayed steady at ~10100 no matter what I did to the file).
>>
>> This was on XP Pro using v5.8.2.
>
> Do you really mean 10100KB. The value should be about 1-2K. 10MB of 
> nonpaged memory is way too much.
>

Yup, but I believe we were looking at different things. I was watching the 
nonpaged kernel memory in the task manager under the Performance tab. It 
generally sits around 10100 - 10300 when the machine is idle.

Matt 




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

Date: 29 Dec 2004 20:36:57 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Line continuation in Perl
Message-Id: <slrnct65b9.an.abigail@alexandra.abigail.nl>

Michele Dondi (bik.mido@tiscalinet.it) wrote on MMMMCXXXVIII September
MCMXCIII in <URL:news:4ug5t0ho9j6sbrnoig7ninvp2f05803os0@4ax.com>:
-:  On 28 Dec 2004 20:29:45 GMT, Abigail <abigail@abigail.nl> wrote:
-:  
-: >No, I'm not exaggerating. I'm talking about a change that will effect
-: >almost *EVERY* line of code I write. And many lines will be effected
-: >multiple times.
-:  
-:  But so will, for example the new semantics of sigils and tons of other
-:  things. OTOH you will be able to modify the grammar the way you like
-:  most, which is not that bad after all. (And I bet you will do, BTW!)

Yeah, I've heard that before. And they sound like it's a trivial thing.
I don't buy that. From what I understand, Larry didn't disallow putting
a space between the aggregate and its index (or rather, give specific
meaning to a block that's preceeded by whitespace) just to annoy
me. Instead, it's because of a whole lot of other parsing issues. The
whitespace isn't something that stands alone - otherwise it would still
have been optional. 

Beside that I don't think it's going to be feasable to change such
significant parsing rules, I don't think it's a smart thing to do, even
if it's possible. If every one is going to create his/her language, with
significant different syntax, it's going to be very hard to cooperate.
Would you want to maintain programs where every author used his/her 
language? Would you bother producing patches for CPAN modules if every
author used his/her own language?

It's a lot less painful to just program in C or Java.

-:  Recent developments suggest that most probably another very common
-:  Perl idiom like C<< while (<>) >> will go away, and not to be
-:  substituted by s/while/for/ as we had been thinking for quite a while.

Brilliant! The more common constructs we won't keep, the more people
will be eager to switch. 

What's happened to the "90% of perl5 is still perl6" people said a few
years ago? Or was that just a marketing slogan?

-: >And the problem is, in many cases, putting whitespace there isn't
-: >even a compile error. It just quietly changes the meaning of your
-: >program.
-: >
-: >In Perl6:
-: >
-: >    $var1 = cos (0) * 2;   # Equals 1.
-: >    $var2 = cos(0) * 2;    # Equals 2.
-:  
-:  You know, I'm on p6l (but I'm the last arrived there and I've not even
-:  started becoming confident with Perl6's syntax) but I'm not sure about
-:  this. I know that it would be indeed so for methods, but I'm not sure
-:  about functions/subs.

From Apocalypse A12, last updated December 4, 2004:

    In particular, curlies, brackets, or parens would be interpreted as
    postfix subscripts or argument lists if you leave out the space. In
    other words, Perl 6 distinguishes:

        $obj.method ($x + $y) + $z  # means $obj.method(($x + $y) + $z)

    from

        $obj.method($x + $y) + $z   # means ($obj.method($x + $y)) + $z

    Yes, this is different from Perl 5. And yes, I know certain people
    hate it. They can write their own grammar.


Note that while the example given uses a method (not surprising, since
the apocalypse is about objects), the statement is very general, talking
about subscripts and argument lists.

And yes, I do think Larry is addressing me in those last two sentences.

-:  It's hard to say anything definitive on it, though, since Larry is
-:  still actively changing his mind on rather basilar stuff too.


Unless he's changing his mind on some particular things, I see myself
coding in Python or Java sooner than I will in Perl6.

But then, my retirement will be in less than 25 years. I don't expect
perl6 to ship before that. ;-)


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


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

Date: Mon, 03 Jan 2005 21:20:25 GMT
From: Nathan <frizop-manchu@charter.net>
Subject: Mail::Thread, From headers incorrect?
Message-Id: <Xns95D39D5D8B657frizopatcharterdotco@216.77.188.18>

-----------
the problem
-----------
I believe the "from" headers of today's email are not the same the module 
was originally written for.

the test cases for Mail::Thread show this in the '^From ' field:

----
grep
----
[user@host]$ grep '^From ' file.email
From p5ml@yahoogroups.com  Tue Jan  7 12:09:16 2003
From p5ml@yahoogroups.com  Tue Jan  7 12:57:03 2003
From p5ml@yahoogroups.com  Tue Jan  7 13:27:08 2003
From rt-users-admin@lists.fsck.com  Tue Jan  7 13:52:02 2003
From rt-users-admin@lists.fsck.com  Tue Jan  7 14:57:20 2003
From owner-belfast-pm@pm.org  Tue Jan  7 15:44:22 2003
From owner-belfast-pm@pm.org  Tue Jan  7 16:21:03 2003
From owner-belfast-pm@pm.org  Tue Jan  7 16:38:00 2003
From p5ml@yahoogroups.com  Tue Jan  7 20:34:20 2003
From p5ml@yahoogroups.com  Wed Jan  8 00:19:39 2003

-------------------
todays from headers
-------------------

From: "Nathan" <user@host.com>


----------------------
trying to fix the code
----------------------
I noted that there is the line if(/^From / ...) 
I figured I might be able to change it to fit the newer "From" headers, 
after changing it to if(/^From: / ...) the script fails with the error 
message:

attempt to thread message with no id at 
/usr/lib/perl5/site_perl/5.8.4/Mail/Thread.pm line 46, <FH> line 1061.


I've been working on this for a few days and really don't know whats 
screwing up. Could anybody provide me with some insite on this module, or 
perhaps working examples with a mail from today?

Thanks in Advance,
--Nathan

(Please post replys to this group)

--------
the code
--------
#!/usr/bin/perl -w
use strict;
use warnings;

use Mail::Internet;
package Email::Abstract::Mail;
use base 'Email::Abstract::MailInternet';
package Mail;
use base 'Mail::Internet';

require Mail::Thread;

my $threader = new Mail::Thread( slurp_messages('file.email') );
$threader->thread;

dump_em($_,0) for $threader->rootset;

sub dump_em {
    my ($self, $level) = @_;
    #debug (' \\-> ' x $level);
    if ($self->message) {
        print $self->message->head->get("Subject") , "\n";
    } else {
        print "[ Message $self not available ]\n";
    }
    dump_em($self->child, $level+1) if $self->child;
    dump_em($self->next, $level) if $self->next;
}

sub slurp_messages {
    my $mbox = shift;
    open FH, $mbox or return;
    my @messages;
    my @lines;
    while (<FH>) {
        if (/^From / && @lines) {
            my $mail = Mail->new(\@lines);
            push @messages, $mail;
            @lines = ();
        }
        push @lines, $_;
    }
    return @messages, Mail->new(\@lines);
}


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

Date: 29 Dec 2004 22:51:23 -0800
From: syost@quicktopic.com
Subject: Memory leak or expected behavior?
Message-Id: <1104389483.690461.38600@z14g2000cwz.googlegroups.com>

I've always seen my Apache/mod_perl httpds grow surprisingly large in
memory, and I want to fix that. But I'm seeing standalone Perl behavior
that could account for it. It seems that a lexical variable's allocated
memory isn't getting reused at all when it goes out of scope and
returns. I wrote the following code to demonstrate:

#!/usr/bin/perl
use strict;
use BSD::Resource;

foreach my $i (1..5) {
print_rusage("Before scope_it sub ");
scope_it();
print_rusage("After  scope_it sub ");
print "\n";
}

sub scope_it {
print_rusage("Before instantiation");
my $tm = TestMem->new();
$tm->alloc();
print_rusage("After  instantiation");
}

sub print_rusage {
my $message = shift;
my $pid = $$;
my ($usertime, $systemtime,
$maxrss, $ixrss, $idrss, $isrss, $minflt, $majflt, $nswap,
$inblock, $oublock, $msgsnd, $msgrcv,
$nsignals, $nvcsw, $nivcsw) = BSD::Resource::getrusage();
print "$message: ixrss:$ixrss; idrss:$idrss; isrss:$isrss\n"
}

package TestMem;

sub new {
return bless {};
}

sub alloc {
my $me = shift;
my @bigbuf = (1..1000000); # In real life the array is read from a
file
$me->{mem} = \@bigbuf;
}

sub DESTROY {
my $me = shift;
print STDERR "Destroying " . ref($me) . "\n";
}



Running this prints the following, where the idrss (integral or current
unshared data) number grows each time. Any idea what's happening and
how I can change my code to prevent it?

Thanks,
Steve Yost


Before scope_it sub : ixrss:48544; idrss:2058712; isrss:9472
Before instantiation: ixrss:48544; idrss:2058712; isrss:9472
After  instantiation: ixrss:64288; idrss:3318740; isrss:12544
Destroying TestMem
After  scope_it sub : ixrss:68880; idrss:3687388; isrss:13440

Before scope_it sub : ixrss:68880; idrss:3687388; isrss:13440
Before instantiation: ixrss:68880; idrss:3687388; isrss:13440
After  instantiation: ixrss:84624; idrss:4948952; isrss:16512
Destroying TestMem
After  scope_it sub : ixrss:89216; idrss:5318048; isrss:17408

Before scope_it sub : ixrss:89216; idrss:5318048; isrss:17408
Before instantiation: ixrss:89216; idrss:5318048; isrss:17408
After  instantiation: ixrss:104960; idrss:6579612; isrss:20480
Destroying TestMem
After  scope_it sub : ixrss:110208; idrss:7001436; isrss:21504

Before scope_it sub : ixrss:110208; idrss:7001436; isrss:21504
Before instantiation: ixrss:110208; idrss:7001436; isrss:21504
After  instantiation: ixrss:125952; idrss:8263000; isrss:24576
Destroying TestMem
After  scope_it sub : ixrss:130544; idrss:8632096; isrss:25472

Before scope_it sub : ixrss:130544; idrss:8632096; isrss:25472
Before instantiation: ixrss:130544; idrss:8632096; isrss:25472
After  instantiation: ixrss:146288; idrss:9893660; isrss:28544
Destroying TestMem
After  scope_it sub : ixrss:150880; idrss:10262756; isrss:29440



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

Date: Mon, 03 Jan 2005 16:52:27 GMT
From: "Todd W" <toddrw69@excite.com>
Subject: Re: multiple packages/classes in one file
Message-Id: <fLeCd.4037$Vj3.4000@newssvr17.news.prodigy.com>


<ioneabu@yahoo.com> wrote in message
news:1104767095.712815.53340@f14g2000cwb.googlegroups.com...
>
> Todd W wrote:
> ...
> > Please remember that your $member vaiable is class data and not
> instance
> > data, So technically, your code is not object oriented at all. note:
> ...
>
> Thanks, I just realized that this morning with a little more
> experimentation.  I thought I had Perl OO figured out and then realized
> that my $member variable could not possibly be unique to individual
> objects the way I did it.


Just remember that your bless()ed refrence is your object and you do have it
figured out.

> So, it looks like all member data must be stored in or referred to by
> the variable (almost always a hash) that is blessed into the class.
> This is somewhat alien to a C++, Java programmer, but not too hard
> understand.

Right. I like it because the syntax makes it easy to determine if you have
an object property or if you are working with some other variable. To do the
same in other languages I have written in, I always explicitly use the
"this" pointer.

> Thanks again!

You bet

>
> wana
>

Todd W.




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

Date: 3 Jan 2005 13:59:35 -0800
From: redsheep_pt@yahoo.com
Subject: my wife dumped me i need help
Message-Id: <1104789575.248456.176770@f14g2000cwb.googlegroups.com>

my dear friends, i found this awesome website in which you can post
screenshots of your computer, everyone's doing it it is awesome!! you
can even find porn in there, free videos and free pictures, no strings
attached c=FCm with me and join this website, you wont regret it!
http://www.desktop2k.tk



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

Date: Sat, 1 Jan 2005 18:18:34 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: need help reading source code: HTML::Parser
Message-Id: <cr6phq$e59$1@ichaos.ichaos-int>

ioneabu@yahoo.com said:
>I have been looking through it for a little while now.  I am trying to
>find where they define SV (typedef or struct?) since it is used
>everywhere.

SV is defined in perl.h (within your perl library directory), though it only
resolves to struct STRUCT_SV, which is defined in sv.h in the same directory.

struct STRUCT_SV {              /* struct sv { */
    void*       sv_any;         /* pointer to something */
    U32         sv_refcnt;      /* how many references to us */
    U32         sv_flags;       /* what we are */
};

 ... and as for documentation, see documents perlguts, perlxstut and perlxs.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Sat, 01 Jan 2005 15:06:09 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: need help reading source code: HTML::Parser
Message-Id: <WJidnU8Zes8vn0rcRVn-3w@adelphia.com>

ioneabu@yahoo.com wrote:

> I have been looking through it for a little while now.  I am trying to
> find where they define SV (typedef or struct?) since it is used
> everywhere.

Have a look at 'perldoc perl' - the section titled "Internals and C 
Language Interface" lists a number of pods that are of interest.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Wed, 29 Dec 2004 22:38:23 GMT
From: Gerald Meazell <gmeazell@swbell.net>
Subject: Re: Newbie question on require and semaphores
Message-Id: <zlGAd.4153$F67.3936@newssvr12.news.prodigy.com>

Matt Garrish wrote:

> 
> require '/path/to/header/file/ipc.ph';
> 
> Whatever compilation problems you're having likely have nothing to do with 
> requiring the ph file, though, and everything to do with the code in that 
> file. Without a specific error message and code, however, it's hard to say 
> anything more useful than that.
> 

Thanks for your help.  Since /path/to/header was already in my @INC, I 
just specified require "file/ipc.ph" and that did the trick - sort of. 
Now it whines that it cannot find "features.ph," mentioned on line 5 of 
ipc.ph.  This file does not exist on my system leading me to believe 
that I must compile or install something in order to create it.  Any 
ideas what that may be?

Thanks,

--
Gerald



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

Date: Wed, 29 Dec 2004 19:43:19 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Newbie question on require and semaphores
Message-Id: <DaIAd.26031$nV.882091@news20.bellglobal.com>


"Gerald Meazell" <gmeazell@swbell.net> wrote in message 
news:zlGAd.4153$F67.3936@newssvr12.news.prodigy.com...
> Matt Garrish wrote:
>
>>
>> require '/path/to/header/file/ipc.ph';
>>
>> Whatever compilation problems you're having likely have nothing to do 
>> with requiring the ph file, though, and everything to do with the code in 
>> that file. Without a specific error message and code, however, it's hard 
>> to say anything more useful than that.
>>
>
> Thanks for your help.  Since /path/to/header was already in my @INC, I 
> just specified require "file/ipc.ph" and that did the trick - sort of. Now 
> it whines that it cannot find "features.ph," mentioned on line 5 of 
> ipc.ph.  This file does not exist on my system leading me to believe that 
> I must compile or install something in order to create it.  Any ideas what 
> that may be?
>

Sorry, I have no idea what ipc.ph is or where you found it. If this is a 
script you downloaded off the web, you should probably start wherever you 
found it.

All I can tell you is that the ph extension is normally only used when 
converting C header files to perl. If you're trying to port a C program you 
probably have to convert features.h as well (see h2ph). If you're using a 
program someone else converted then you'll need to find those missing header 
files wherever you found this one.

Matt 




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

Date: Mon, 03 Jan 2005 15:11:04 -0700
From: "John D. Sanders" <johnsanders@lovinthelord.org>
Subject: Newbie Question
Message-Id: <7qjCd.28$od2.19958@news.uswest.net>

I have an Apache Web Server running and I want to use Perl as my CGI 
language.

I have Matt's FormMail script running properly but when I try to 
implement my own scripts I get an error.

The script I am using for testing:
#! /usr/bin/perl

use warnings;
use strict;

print "content-type: text/html\n\n";
print "<html><head><title> Current Date and Time </title>";
print "</head>\n<body>";
print scalar( localtime() );
print "</body></html>";


The error I get when executing www.lovinthelord.org/cgi-bin/testing.pl:

Internal Server Error

The server encountered an internal error or misconfiguration and was 
unable to complete your request.

Please contact the server administrator, sanders@lovinthelord.org and 
inform them of the time the error occurred, and anything you might have 
done that may have caused the error.

More information about this error may be available in the server error log.

Please any help would be appreciated.

Thanks
John
www.lovinthelord.org


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

Date: Mon, 03 Jan 2005 15:43:48 -0700
From: "John D. Sanders" <johnsanders@lovinthelord.org>
Subject: Re: Newbie Question
Message-Id: <RUjCd.11$N33.31076@news.uswest.net>

ioneabu@yahoo.com wrote:
> I entered your script on my server and it appears to work.  Browser
> output:
> 
> Mon Jan 3 17:41:08 2005
> 
> wana
> 
Do you have any ideas why id does not on mine when other Perl scripts work?


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

Date: Mon, 03 Jan 2005 23:59:23 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Newbie Question
Message-Id: <33u160F42mj89U1@individual.net>

John D. Sanders wrote:
> I have an Apache Web Server running and I want to use Perl as my CGI 
> language.
> 
> I have Matt's FormMail script running

Exchange it for http://nms-cgi.sourceforge.net/scripts.shtml

> properly but when I try to 
> implement my own scripts I get an error.
> 
> The script I am using for testing:
> #! /usr/bin/perl
> 
> use warnings;
> use strict;
> 
> print "content-type: text/html\n\n";
> print "<html><head><title> Current Date and Time </title>";
> print "</head>\n<body>";
> print scalar( localtime() );
> print "</body></html>";
> 
> 
> The error I get when executing www.lovinthelord.org/cgi-bin/testing.pl:
> 
> Internal Server Error

<snip>

- Are you sure that the path to perl is correct?
- Did you upload the script in ASCII mode?
- Did you set the right permissions (probably 755)?

If that doesn't help:
http://faq.perl.org/perlfaq9.html#My_CGI_script_runs_f

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Wed, 29 Dec 2004 12:13:15 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Passing value to another CGI.
Message-Id: <KABAd.29544$Tn1.1147617@news20.bellglobal.com>


"sam" <sam.wun@authtec.com> wrote in message 
news:cqul0g$afo$1@news.hgc.com.hk...
>
> Hi, if I have another text field with the value of "bob" as shown below:
> $query->textfield({name=>'Name', value=>"bob"});
>
> how can I pass its value to another cgi when the button is pressed?
>

use LWP::Simple;

Read lwpcook.

You really need to take a few steps back and learn a bit more about the 
technologies you're using. Your questions about how to do things in html are 
going to get you killfiled (if they haven't already), as they don't belong 
in this group. And your race to accomplish whatever it is your doing will 
inevitably result in an unmaintainable mess if you try to keep hacking in 
solutions. It's better to do something right once than spend months cleaning 
up your own mistakes.

Matt 




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

Date: 29 Dec 2004 11:17:25 -0800
From: ioneabu@yahoo.com
Subject: Re: Passing value to another CGI.
Message-Id: <1104347845.678623.228710@z14g2000cwz.googlegroups.com>

Here is a little tested sample which uses multiple forms within one
page.  There are some problems with doing it this way.  From CGI home
page:

General note 3. You can put multiple forms on the same page if you
wish. However, be warned that it isn't always easy to preserve state
information for more than one form at a time. See advanced techniques
for some hints.

http://stein.cshl.org/WWW/software/CGI/#advanced

#!/usr/bin/perl

use CGI q(:standard);
use warnings;
use strict;

print header();
print start_html();
print start_form(-action=>'form1.cgi');
print textfield({name=>'Name', value=>"bob"});
print br();
print submit(-name=>'goto form1.cgi');
print end_form();
print start_form(-action=>'form2.cgi');
print submit(-name=>'goto form2.cgi');
print end_form();
print start_form(-action=>'form3.cgi');
print submit(-name=>'goto form3.cgi');
print end_form();
print end_html();


Good Luck!

wana



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

Date: Thu, 30 Dec 2004 10:06:07 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: Passing value to another CGI.
Message-Id: <cqvpc7$rt1$1@news.hgc.com.hk>

Matt Garrish wrote:

> "sam" <sam.wun@authtec.com> wrote in message 
> news:cqul0g$afo$1@news.hgc.com.hk...
> 
>>Hi, if I have another text field with the value of "bob" as shown below:
>>$query->textfield({name=>'Name', value=>"bob"});
>>
>>how can I pass its value to another cgi when the button is pressed?
>>
> 
> 
> use LWP::Simple;
> 
> Read lwpcook.
> 
Thanks for the hints. I will certainly look into it before going further 
  for the development.

Thanks
Sam

> You really need to take a few steps back and learn a bit more about the 
> technologies you're using. Your questions about how to do things in html are 
> going to get you killfiled (if they haven't already), as they don't belong 
> in this group. And your race to accomplish whatever it is your doing will 
> inevitably result in an unmaintainable mess if you try to keep hacking in 
> solutions. It's better to do something right once than spend months cleaning 
> up your own mistakes.
> 
> Matt 
> 
> 


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

Date: Thu, 30 Dec 2004 12:04:21 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: Passing value to another CGI.
Message-Id: <cr009t$v8m$1@news.hgc.com.hk>

ioneabu@yahoo.com wrote:

> Here is a little tested sample which uses multiple forms within one
> page.  There are some problems with doing it this way.  From CGI home
> page:
> 
> General note 3. You can put multiple forms on the same page if you
> wish. However, be warned that it isn't always easy to preserve state
> information for more than one form at a time. See advanced techniques
> for some hints.
> 
> http://stein.cshl.org/WWW/software/CGI/#advanced
> 
> #!/usr/bin/perl
> 
> use CGI q(:standard);
> use warnings;
> use strict;
> 
> print header();
> print start_html();
> print start_form(-action=>'form1.cgi');
> print textfield({name=>'Name', value=>"bob"});
> print br();
> print end_html();
> 
> 
Do you know how to pass the variable name "Name" and its value "bob" to 
form1.cgi?

Thanks
Sam

> Good Luck!
> 
> wana
> 


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

Date: 30 Dec 2004 04:59:18 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Passing value to another CGI.
Message-Id: <Xns95CEE9D943304castleamber@130.133.1.4>

sam wrote:

> ioneabu@yahoo.com wrote:
> 
>> Here is a little tested sample which uses multiple forms within one
>> page.  There are some problems with doing it this way.  From CGI home
>> page:
>> 
>> General note 3. You can put multiple forms on the same page if you
>> wish. However, be warned that it isn't always easy to preserve state
>> information for more than one form at a time. See advanced techniques
>> for some hints.
>> 
>> http://stein.cshl.org/WWW/software/CGI/#advanced
>> 
>> #!/usr/bin/perl
>> 
>> use CGI q(:standard);
>> use warnings;
>> use strict;
>> 
>> print header();
>> print start_html();
>> print start_form(-action=>'form1.cgi');
>> print textfield({name=>'Name', value=>"bob"});
>> print br();
>> print end_html();
>> 
>> 
> Do you know how to pass the variable name "Name" and its value "bob"
> to form1.cgi?

That already happens (unless someone changes the value ;-) ).

Also, note that the print part above can be simplified as follows:

print header(),
    	start_html(),
    	:
    	end_html();

(ie, just one print). And I guess you can drop the () too :-D.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Thu, 30 Dec 2004 13:24:45 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: Passing value to another CGI.
Message-Id: <cr050m$11sb$1@news.hgc.com.hk>

John Bokma wrote:
> sam wrote:
> 
> 
>>ioneabu@yahoo.com wrote:
>>
>
>>>
>>>http://stein.cshl.org/WWW/software/CGI/#advanced
>>>
>>>#!/usr/bin/perl
>>>
>>>use CGI q(:standard);
>>>use warnings;
>>>use strict;
>>>
>>>print header();
>>>print start_html();
>>>print start_form(-action=>'form1.cgi');
>>>print textfield({name=>'Name', value=>"bob"});
>>>print br();
>>>print end_html();
>>>
>>>
>>
>>Do you know how to pass the variable name "Name" and its value "bob"
>>to form1.cgi?
> 
> 
> That already happens (unless someone changes the value ;-) ).
> 
> Also, note that the print part above can be simplified as follows:
> 
> print header(),
>     	start_html(),
>     	:
>     	end_html();
> 
> (ie, just one print). And I guess you can drop the () too :-D.
> 

OK, this is perfectly fine.
But whatif I put another paire of "embedded" start_form and end_form 
within one start_form and end_form, something like the following coding:

print $query->start_form(-action=>'Main.cgi');
print $query->textfield({name=>'Name', value=>"bob"});
print $query->br();

print $query->start_form(-action=>'form5.cgi');
print $query->submit(-name=>'goto form5.cgi');
print $query->end_form();

print $query->submit(-name=>'goto Main.cgi');
print $query->end_form();

When press the form5 button, it will certainly go to Main.cgi instead of 
form5.cgi.
Is there a way fix this error?
I was thinking use javascript to construct the part of "action 
form5.cgi" and its submit button (form5). What do you think this idea?

I have a looked at LWP before, but there is no instruction/example about 
how to deal with this situiation.

Thanks
Sam


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

Date: Thu, 30 Dec 2004 13:43:34 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: Passing value to another CGI.
Message-Id: <cr063v$127e$1@news.hgc.com.hk>

sam wrote:

> John Bokma wrote:
> 
>> sam wrote:
>>
>>
>>> ioneabu@yahoo.com wrote:
>>>
>>
>>>>
>>>> http://stein.cshl.org/WWW/software/CGI/#advanced
>>>>
>>>> #!/usr/bin/perl
>>>>
>>>> use CGI q(:standard);
>>>> use warnings;
>>>> use strict;
>>>>
>>>> print header();
>>>> print start_html();
>>>> print start_form(-action=>'form1.cgi');
>>>> print textfield({name=>'Name', value=>"bob"});
>>>> print br();
>>>> print end_html();
>>>>
>>>>
>>>
>>> Do you know how to pass the variable name "Name" and its value "bob"
>>> to form1.cgi?
>>
>>
>>
>> That already happens (unless someone changes the value ;-) ).
>>
>> Also, note that the print part above can be simplified as follows:
>>
>> print header(),
>>         start_html(),
>>         :
>>         end_html();
>>
>> (ie, just one print). And I guess you can drop the () too :-D.
>>
> 
> OK, this is perfectly fine.
> But whatif I put another paire of "embedded" start_form and end_form 
> within one start_form and end_form, something like the following coding:
> 
> print $query->start_form(-action=>'Main.cgi');
> print $query->textfield({name=>'Name', value=>"bob"});
> print $query->br();
> 
> print $query->start_form(-action=>'form5.cgi');
> print $query->submit(-name=>'goto form5.cgi');
> print $query->end_form();
> 
> print $query->submit(-name=>'goto Main.cgi');
> print $query->end_form();
> 
> When press the form5 button, it will certainly go to Main.cgi instead of 
> form5.cgi.
> Is there a way fix this error?
> I was thinking use javascript to construct the part of "action 
> form5.cgi" and its submit button (form5). What do you think this idea?
> 
> I have a looked at LWP before, but there is no instruction/example about 
> how to deal with this situiation.
> 
I think use html frame would do that trick? One frame contains a form of 
Main.cgi-Main button, another frame contains a form of form5.cgi-form5 
button.

Sam.

> Thanks
> Sam


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 7598
***************************************


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