Re: using variable in param

2006-02-21 Thread David Dorward
On Tue, Feb 21, 2006 at 12:22:39PM +0100, Adriano Allora wrote:
> opendir(QUERY, 
> "/Users/adrianoallora/Sites/corpora/VALICO/indici_testa/") or $errtex = 
> $!;

So you set a variable if the directory couldn't be opened ...

> @interrogabili = readdir(QUERY);

... but then carry on and try to read the directory anyway?

> foreach $elem (@interrogabili)
>   {
>   next if $elem =~ /^\..*/;
>   $elem = $home->param($elem);
>   }
> 
> Why the  $home->param($elem) line doesn't work?

You don't define $home anywhere.


-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: using variable in param

2006-02-21 Thread Wiggins d'Anconia
Adriano Allora wrote:
> Hi all,
> 
> I need to obtain some values (passed with a form) without knowing their
> names (but I know these variable names correspond to names of some files.
> 
> So, I tried to write  something like this:
> 
> opendir(QUERY,
> "/Users/adrianoallora/Sites/corpora/VALICO/indici_testa/") or $errtex = $!;

The above "or" condition doesn't die, or at least break the execution
loop in some way. It should.

> @interrogabili = readdir(QUERY);
> foreach $elem (@interrogabili)
> {
> next if $elem =~ /^\..*/;
> $elem = $home->param($elem);
> }
>

You haven't shown us the declaration of $elem, I suspect that is the
issue. And since you haven't shown us the declaration I would have to
guess you aren't using,

use strict;
use warnings;

And you should be.

$elem is getting clobbered each time through the loop with a new value,
from the file list, then a new value from CGI (assuming it is defined).

You need to adjust where you are storing the values to keep all of them.
Or you could just get the full list, see Vars() in the perldoc for CGI.

http://danconia.org


> Why the  $home->param($elem) line doesn't work? All the rest of the code
> works very well (It open effectively the directory, store all the
> entries in the array, read each array item...)
> 
> Any help is soo much appreciated.
> 
> alladr
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




using variable in param

2006-02-21 Thread Adriano Allora

Hi all,

I need to obtain some values (passed with a form) without knowing their 
names (but I know these variable names correspond to names of some 
files.


So, I tried to write  something like this:

opendir(QUERY, 
"/Users/adrianoallora/Sites/corpora/VALICO/indici_testa/") or $errtex = 
$!;

@interrogabili = readdir(QUERY);
foreach $elem (@interrogabili)
{
next if $elem =~ /^\..*/;
$elem = $home->param($elem);
}

Why the  $home->param($elem) line doesn't work? All the rest of the 
code works very well (It open effectively the directory, store all the 
entries in the array, read each array item...)


Any help is soo much appreciated.

alladr



|^|_|^|_|^|  |^|_|^|_|^|
 || ||
 || ||
 ||*\_/*\_/*\_/*\_/*\_/* ||
 |   |
 |   |
 |   |
 | http://www.e-allora.net|
 |   |
 |   |
**


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]