Sending a location Header

2003-01-11 Thread Colin Johnstone
Gidday All,

After adding a member to my mailing list using a form with the get method. I
wish to send a location header to call the page again, to clear the query
string. So that if the refresh key is hit that member is not added again.

Is this the correct implementation of the location header

print "location: press_managelist1.pl\n\n";




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




using an AND operator

2003-01-11 Thread Susan Aurand

Is there an AND operator in perl? For example;

if ($SRF=1 and $SRL=1) {print"YES";)

 Any help would be appreciated.
Thank you - Susan


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




Re: using an AND operator

2003-01-11 Thread WilliamGunther
In a message dated 1/11/2003 9:43:32 AM Eastern Standard Time, 
[EMAIL PROTECTED] writes:


> if ($SRF=1 and $SRL=1) {print"YES";)

You got the and right, but the conditional wrong. 2 equal signs for 
conditionals.
So your example:
$SRF = 1; $SRL = 1;
if ($SRF==1 and $SRL==1) {print"YES";} #True

or is
$SRF = 1; $SRL = 1;
if ($SRF==1 or $SRL==1) {print"YES";} #True

xor (both not true, 1 is)
$SRF = 1; $SRL = 1;
if ($SRF==1 xor $SRL==1) {print"YES";} #False

You can also use  | and & for logical and bitwise "and" or "or" .
http://www.cs.appstate.edu/~can/classes/3481/IA/3481PerlTABLES.html";>(The 
CS-3481 Perl Tables)



Re: using an AND operator

2003-01-11 Thread Rene Verharen
At 11-01-2003 09:48 -0500, Susan Aurand wrote:


Is there an AND operator in perl? For example;

if ($SRF=1 and $SRL=1) {print"YES";)


print "YES"if ($SRF=1 && $SRL=1);



Kind regards,



Rene Verharen


Please DO NOT reply to me personally.  I'll get my copy from the list.


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




Re: Sending a location Header

2003-01-11 Thread Wiggins d'Anconia
Colin Johnstone wrote:

Gidday All,

After adding a member to my mailing list using a form with the get method. I
wish to send a location header to call the page again, to clear the query
string. So that if the refresh key is hit that member is not added again.

Is this the correct implementation of the location header

print "location: press_managelist1.pl\n\n";



This appears correct, did it not work (you might want to fully specify 
the URL, though there are occasions when you won't)?  As an aside, you 
should consider checking your list before adding a new addition if you 
really want to avoid duplicates, unless dupes are ok.  In which case you 
might set a cookie or something that contains a date and then not allow 
them to post a dup until a certain amount of time has passed, etc.

http://danconia.org


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



Re: using an AND operator

2003-01-11 Thread Rob Dixon
Hi Susan

"Susan Aurand" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Is there an AND operator in perl? For example;
>
> if ($SRF=1 and $SRL=1) {print"YES";)
>
>  Any help would be appreciated.
> Thank you - Susan
>

What you've written will work as it is, except that for comparing numeric
quantities for equality you need '==' instead of the assigment operator '='.
(You also have a typo - a closing parenthesis instead of a closing brace).
Try this:

if ($SRF == 1 and $SRL == 1) { print "YES" };

Perl provides both the C-like '&&' operator and 'and', which do the same
thing but bind with their operands with different priorities. The most
important difference is that the assignment operators have a lower priority
than '&&' but a higher priority than 'and', so:

$bool = $SRF == 1 && $SRL == 1
means
$bool = (($SRF == 1) && ($SRL == 1))

but

$bool = $SRF == 1 and $SRL == 1
means
($bool = ($SRF == 1)) and ($SRL == 1)

HTH,

Rob






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




funny characters in form field

2003-01-11 Thread Colin Johnstone
Gidday all,

In my mailing list form I have a hidden field that stores the date the
subscriber subscribed.

When processing the form the date in this format 3/1/2003 is converted to
3%2F1%2F2003.

Can someone give me a regex to convert it back again please. Im only new to
perl and am struggling with regex's

thanking you in anticipation

Colin



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




Re: funny characters in form field

2003-01-11 Thread WilliamGunther
In a message dated 1/11/2003 8:55:37 PM Eastern Standard Time, 
[EMAIL PROTECTED] writes:


> When processing the form the date in this format 3/1/2003 is converted to
> 3%2F1%2F2003.
> 
> Can someone give me a regex to convert it back again please. Im only new to
> perl and am struggling with regex's

$value = "3%2F1%2F2003";  
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 



Re: funny characters in form field

2003-01-11 Thread Randal L. Schwartz
> "Colin" == Colin Johnstone <[EMAIL PROTECTED]> writes:

Colin> Gidday all,
Colin> In my mailing list form I have a hidden field that stores the date the
Colin> subscriber subscribed.

Colin> When processing the form the date in this format 3/1/2003 is converted to
Colin> 3%2F1%2F2003.

Colin> Can someone give me a regex to convert it back again please. Im only new to
Colin> perl and am struggling with regex's

Don't use a regex.  If you use CGI.pm, you never have to think about
encoding or decoding *anything*.

during HTML generation:

param('my_hidden', '3/1/2003');
print hidden('my_hidden');

during CGI response:

my $input = param('my_hidden');

No mess, no stress.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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