[25876] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8106 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 23 18:05:31 2005

Date: Mon, 23 May 2005 15:05:10 -0700 (PDT)
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, 23 May 2005     Volume: 10 Number: 8106

Today's topics:
        Dynamic FORM names <netsajev@yahoo.com>
    Re: Dynamic FORM names <john@castleamber.com>
    Re: Dynamic FORM names <1usa@llenroc.ude.invalid>
    Re: Dynamic FORM names <noreply@gunnar.cc>
    Re: evidence proving john bokma al jazeera programmer? <nomail@hotmail.com>
        FormMail Problem <opearson@citcom.net>
    Re: FormMail Problem <noreply@gunnar.cc>
        how sub can have 2 decimal numbers only? <xman@nospam.tv>
    Re: how sub can have 2 decimal numbers only? <1usa@llenroc.ude.invalid>
    Re: how sub can have 2 decimal numbers only? <tadmc@augustmail.com>
    Re: How to step over a line in the debugger? <Sysadmin_member@newsguy.com>
        PORNO SEX PICS <geile-andrea@freenet.de>
    Re: Replace substring in all values of a hash array? <spam@noreply.org>
    Re: Replace substring in all values of a hash array? <spam@noreply.org>
    Re: Test <abigail@abigail.nl>
        too many open files?  How to know? <derrell.spam.durrett@xilinx.killer.com>
    Re: too many open files?  How to know? <derrell.spam.durrett@xilinx.killer.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 23 May 2005 22:18:35 +0300
From: Juhani =?ISO-8859-15?Q?Elbanvet=E4j=E4?= <netsajev@yahoo.com>
Subject: Dynamic FORM names
Message-Id: <42922c19$0$30949$39db0f71@news.song.fi>

Hey,
I've been wondering for a while if it is possible to have dynamic form
names..
To make it clear, I've used common parse_form subroutines and then read form
querys:
        $form_input = "$FORM{'form_name'}";
Now, when I have manymany checkboxes in my form I need to write every
form_name manually because the code above doesn't quite accept variables as
follows:
        $form_input = "$FORM{$form_name}";
no matter whether I use " '' " or not. 
I would appreciate a solution for this problem. At the moment I'd like to
think that it lies in the parse_form subroutine...?



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

Date: 23 May 2005 19:20:43 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Dynamic FORM names
Message-Id: <Xns965F91ED5A31Acastleamber@130.133.1.4>

Juhani =?ISO-8859-15?Q?Elbanvet=E4j=E4?= wrote:

> Hey,
> I've been wondering for a while if it is possible to have dynamic form
> names..
> To make it clear, I've used common parse_form subroutines

That sounds like horrors from the 90's.

use CGI;

>         $form_input = "$FORM{$form_name}";

my $cgi = new CGI;
$foo = $cgi->param( $bar );

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


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

Date: Mon, 23 May 2005 19:25:07 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Dynamic FORM names
Message-Id: <Xns965F9CA924388asu1cornelledu@127.0.0.1>

Juhani =?ISO-8859-15?Q?Elbanvet=E4j=E4?= <netsajev@yahoo.com> wrote in
news:42922c19$0$30949$39db0f71@news.song.fi: 

> I've been wondering for a while if it is possible to have dynamic form
> names..
> To make it clear, I've used common parse_form subroutines and then
> read form querys:

What is a common parse_form subroutine? The only standard way of parsing 
CGI requests is with CGI.pm. There is no way for us to know what you are 
using to parse CGI requests if you are not using CGI.pm.

>         $form_input = "$FORM{'form_name'}";

See:

perldoc -q always

> Now, when I have manymany checkboxes in my form I need to write every
> form_name manually because the code above doesn't quite accept
> variables as follows:
>         $form_input = "$FORM{$form_name}";
> no matter whether I use " '' " or not. 

Please post a short but complete script illustrating the problem you are 
having. Please do read the posting guidelines for this group to learn 
how to help yourself and help others help you.

> I would appreciate a solution for this problem. At the moment I'd like
> to think that it lies in the parse_form subroutine...?

I do not know as I am not sure what the problem is and what parse_form 
does.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: Mon, 23 May 2005 22:15:54 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Dynamic FORM names
Message-Id: <3fesgpF7g0neU1@individual.net>

Juhani Elbanvetäjä wrote:
> I've been wondering for a while if it is possible to have dynamic form
> names..

Yes, of course.

> To make it clear, I've used common parse_form subroutines and then read form
> querys:
>         $form_input = "$FORM{'form_name'}";
> Now, when I have manymany checkboxes in my form I need to write every
> form_name manually because the code above doesn't quite accept variables as
> follows:
>         $form_input = "$FORM{$form_name}";
> no matter whether I use " '' " or not.

Exactly what do you mean by "doesn't quite accept"? Whatever you mean, I 
find it hard to believe that you can't access a hash value while 
specifying the key as a variable.

     our %FORM = ( somename => 'somevalue' );
     my $form_name = 'somename';
     my $form_input = $FORM{$form_name};
     print "$form_input\n";

Outputs:
somevalue

Accordingly, I'd guess that you are making some other mistake.

Please study the posting guidelines for this group: 
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

Doing so you'll see that in order to increase your chances to get help, 
you are recommended to post a short but complete program that others can 
copy and run and that demonstrates the problem you are having.

> I would appreciate a solution for this problem. At the moment I'd like to
> think that it lies in the parse_form subroutine...?

If that's actually the case, the only solution to your problem you are 
likely to get here is that you'd better start using the more up-to-date 
parsing routine provided by CGI.pm.

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


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

Date: Mon, 23 May 2005 16:35:26 +0200
From: "Sturkie" <nomail@hotmail.com>
Subject: Re: evidence proving john bokma al jazeera programmer?
Message-Id: <4291ea38$0$5859$e4fe514c@news.xs4all.nl>

>    what if dutch messages are most coded and  hardest to break?  there is 
> no
> arab language at babelfish.altavista.com.  dutch is there, and english.

I know this guy who programmed missiles for pakistan.............. through 
nato :D 




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

Date: Mon, 23 May 2005 15:34:58 -0400
From: "Olen R. Pearson" <opearson@citcom.net>
Subject: FormMail Problem
Message-Id: <d6tb94$4g9d$1@news3.infoave.net>

Hi,

I am using FormMail.CGI v. 1.92 (04/21/02) to process s form on a Website.
Though I am not familiar with Perl, I have used this script and its earlier
versions for several years without problems.

Now, the script will process the form for some e-mail addresses but not
others, giving the error message:

Error: Bad/No Recipient
There was no recipient or an invalid recipient specified in the data sent to
FormMail. Please make sure you have filled in the recipient form field with
an e-mail address that has been configured in @recipients.

Here are the pertinent lines from the script:

@referers = ('nursesaregreat.com','fast.net','citcom.net','verizon.net');
@recipients = &fill_recipients(@referers);

and from the form code

<input type=hidden name="recipient" value="louiseandroy@verizon.net">

It seems to work for email addresses at 'nursesaregreat.com', 'fast.net',
and 'citcom.net' but NOT 'veerizon.net'.

Any ideas??

Thanks.c



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

Date: Mon, 23 May 2005 22:28:01 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: FormMail Problem
Message-Id: <3fet7qF7f7ehU1@individual.net>

Olen R. Pearson wrote:
> I am using FormMail.CGI v. 1.92 (04/21/02) to process s form on a Website.
> Though I am not familiar with Perl,

Please note that this group is for discussing Perl programming matters, 
not for providing help to use particular scripts.

> Now, the script will process the form for some e-mail addresses but not
> others, giving the error message:
> 
> Error: Bad/No Recipient
> ...

<snip>

> Any ideas??

Ask the script author for assistance.

If you don't get help that way (you probably don't...), try one of the 
form-to-mail solutions at http://nms-cgi.sourceforge.net/scripts.shtml 
instead.

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


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

Date: Mon, 23 May 2005 21:53:14 +0200
From: "xman" <xman@nospam.tv>
Subject: how sub can have 2 decimal numbers only?
Message-Id: <d6tca3$ce4$1@ss405.t-com.hr>

 my $usdTotal = $Total / 6.2;

when Perl calculate it I hzave result like $usdTotal = 120.2435445466

but I need 120.24 only (2 digits after dot..)

how I can do it? 




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

Date: Mon, 23 May 2005 20:13:03 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: how sub can have 2 decimal numbers only?
Message-Id: <Xns965FA4C7D9659asu1cornelledu@127.0.0.1>

"xman" <xman@nospam.tv> wrote in news:d6tca3$ce4$1@ss405.t-com.hr:

>  my $usdTotal = $Total / 6.2;
> 
> when Perl calculate it I hzave result like $usdTotal = 120.2435445466
> 
> but I need 120.24 only (2 digits after dot..)
> 
> how I can do it? 

perldoc -f sprintf

Please consult the documentation first.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: Mon, 23 May 2005 16:18:51 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: how sub can have 2 decimal numbers only?
Message-Id: <slrnd94i5r.fkc.tadmc@magna.augustmail.com>

xman <xman@nospam.tv> wrote:

> when Perl calculate it I hzave result like $usdTotal = 120.2435445466
> 
> but I need 120.24 only (2 digits after dot..)
> 
> how I can do it? 


   perldoc -q round

       Does Perl have a round() function?  What about ceil() and floor()?
       Trig functions?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 23 May 2005 08:40:01 -0700
From: Sysadmin <Sysadmin_member@newsguy.com>
Subject: Re: How to step over a line in the debugger?
Message-Id: <d6stgh0km7@drn.newsguy.com>

In article <pan.2005.05.23.12.36.11.145081@PSDT.com>, Peter Scott says...
>> Is it possible to step over an arbitrary line of code, without
>> executing it?

> No. The debugger is not directing the execution of your program,
> it is observing it. All you can do is vary the places it stops
> to report what's happening.

:(

>> Let's say I have a script with simple example code like this:
>> print "Line 1.\n";
>> print "Line 2.\n";
>> print "Line 3.\n";

>> What must I do to execute line 1 and 3, but not line 2, inside
>> the debugger?

> If line 2 contained a conditional, e.g.

> print "Line 2.\n" if $foo;

> you could set $foo to false in the debugger before reaching
> the line.
> That's about it.

Amazing, even VB6 can do it, but not perl.
I never thought I'd be lacking a feature in the debugger.

Oh well, thanks for answering!

> http://www.perldebugged.com/

Huh, is that from 2002, how have I managed to miss that title for so long? :)

-- 
Sysadmin



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

Date: Mon, 23 May 2005 22:16:58 +0200
From: "Andrea" <geile-andrea@freenet.de>
Subject: PORNO SEX PICS
Message-Id: <d6td47$9vi$63@pomoranche.gu.net>

Hi,
Here are my daily Porno Pics!
Kostenlose Bilder ohne Ende!
http://sexycorner.biz

Enjoy
Andrea


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

Date: Mon, 23 May 2005 22:43:11 +0000
From: michael <spam@noreply.org>
Subject: Re: Replace substring in all values of a hash array?
Message-Id: <d6tf90$iir$00$1@news.t-online.com>

> Abusing package variables like this is bad.

I had a guilt feeling about it but wasn't able to figure variable scope in
time of getting the script functional.

> substution you need the sustitution operator s/// or you can use substr().

Thanks for these useful tips.

>    s/_green\.gif/_yellow.gif/ for values %flora_and_fauna;

And for this, it got all working as needed.

Michael

-- 
Today's weirdness is tomorrow's reason why.
                -- Hunter S. Thompson



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

Date: Mon, 23 May 2005 22:48:05 +0000
From: michael <spam@noreply.org>
Subject: Re: Replace substring in all values of a hash array?
Message-Id: <d6tfi6$iir$00$2@news.t-online.com>

>     s/green\.gif/yellow.gif/ for
>         @flora_and_fauna{ grep exists $flora_and_fauna{ $_}, @pages};

Thanks fir this info - will test.

Michael

-- 
Q:    What's the difference between Bell Labs and the Boy Scouts of America?
A:    The Boy Scouts have adult supervision.



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

Date: 23 May 2005 21:30:42 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Test
Message-Id: <slrnd94is2.ch.abigail@alexandra.abigail.nl>

test (test@freenet.de) wrote on MMMMCCLXXXIII September MCMXCIII in
<URL:news:d6sdgf$vhf$62@pomoranche.gu.net>:
``  It's only a test.


Consider your test to be succesful. You're in my killfile now.
From which there is no escape.



Abigail
-- 


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

Date: Mon, 23 May 2005 13:33:17 -0600
From: Derrell Durrett <derrell.spam.durrett@xilinx.killer.com>
Subject: too many open files?  How to know?
Message-Id: <d6tb5t$eoi14@xco-news.xilinx.com>

Howdy-

I have a situation in which a program that executes on solaris, a RedHat 
flavor of Linux (32- and 64-bit), and Windows XP (32- and 64-bit) fails 
on 32-bit XP w/the $! value equivalent to the string "Too many open files."

I am running an external program whose output to stderr I want to 
capture, in case it's interesting.  The algorithm is (as suggested in 
recipe 7.20 in the Perl Cookbook):

dup STDERR (open using ">&" ) to new filehandle.
create new filehandle, to temporary file (using IO::File->new_tmpfile)
take file-descriptor of new filehandle (using fileno())
alias STDERR to new filehandle (open STDERR using ">&=$fileno" )

I then run my external program, and close the filehandles, undef the 
temporary variable attached to the temporary file, and reopen stderr to 
point back to the original.

In opening STDERR to alias it to the temporary file's descriptor, the 
program fails.

I've done this in the debugger, and when I look at the symbol table for 
either main, or the package in which the filehandles are being created, 
and I don't see anything unusual (only STDOUT, STDIN, STDERR, and the 
duplicate ).  I did this using the 'x \%main::' and 
'x\%<package_name>::' commands at the debugger command line.

Is there a better way to see what files are open?  Is this likely a red 
herring?

Thanks,

Derrell

-- 
Derrell Durrett
Xilinx, Inc. / Software Productivity Tools
Longmont, Colorado / 720.652.3843
***remove bits about .processed meats and .death from e-mail to reply


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

Date: Mon, 23 May 2005 15:24:24 -0600
From: Derrell Durrett <derrell.spam.durrett@xilinx.killer.com>
Subject: Re: too many open files?  How to know?
Message-Id: <d6thm8$cku9@xco-news.xilinx.com>

Derrell Durrett wrote:

> I have a situation in which a program that executes on solaris, a 
> RedHat flavor of Linux (32- and 64-bit), and Windows XP (32- and 
> 64-bit) fails on 32-bit XP w/the $! value equivalent to the string 
> "Too many open files."

I can duplicate the problem using the following code:

use strict;
use warnings;
use English;
use IO::File;

my $count = 0;
while (1) {

   my @output;
   $count++;
   runCmd( 'ls', \@output );
}

sub runCmd {

   my ( $cmd, $container ) = @ARG;

   # The following code mimics recipe 7.20 from the Perl Cookbook and is
   # necessary because the commands being run may output to STDERR and we
   # want to capture that.
   unless( open( ORIGINAL_STDERR, ">&STDERR" ) ) {

      die( "Could not redirect STDERR" );
   }

   my $error_fh;
   unless( $error_fh = IO::File->new_tmpfile ) {

      die( "Could not open temporary file for STDERR: $OS_ERROR" );
   }
   my $error_fd = $error_fh->fileno();
   unless( open( STDERR, ">&=$error_fd" ) ) {

      die( "Iteration: $count\nCould not duplicate temporary filehandle 
for ",
            "STDERR: ",$OS_ERROR );
   }
   STDERR->autoflush( 1 );

   @{ $container } = (`$cmd`);

   # Close the temporary filehandle.
   close $error_fh
       or die( "Couldn't close temporary STDERR.  ", $OS_ERROR );

   # Close redirected handle
   close STDERR
       or die( "Could not close redirected STDERR" );

   # Clean up after ourselves
   undef $error_fh;

   # Restore STDERR
   open( STDERR, ">&ORIGINAL_STDERR" )
       or die( "Could not restore STDERR" );

   # Close copy to prevent leaks
   close ORIGINAL_STDERR
       or die( "Could not close copied STDERR" );
}

This gives varying numbers of iterations, depending on whether I'm 
executing the program locally, or via rsh, but the error is the same:

"Could not duplicate temporary filehandle for STDERR: Too many open 
files at test_opens.plx line 34"

>
> I've done this in the debugger, and when I look at the symbol table 
> for either main, or the package in which the filehandles are being 
> created, and I don't see anything unusual (only STDOUT, STDIN, STDERR, 
> and the duplicate ).  I did this using the 'x \%main::' and 
> 'x\%<package_name>::' commands at the debugger command line.
>
> Is there a better way to see what files are open?  Is this likely a 
> red herring?

Since I can create it w/out the original program, it's clearly this bit 
of code that matters.  What am I missing?  I've tried to be scrupulous 
about closing all opened file handles, but seem to have a leak nevertheless.

Anything helps,

Derrell

-- 
Derrell Durrett
Xilinx, Inc. / Software Productivity Tools
Longmont, Colorado / 720.652.3843
***remove bits about .processed meats and .death from e-mail to reply


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

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


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