Re: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Henk van Ess

Sorry, I gave the wrong URL

http://www.voelspriet.nl/cgi-bin/spriet.cgi

What did I do wrong?

 Your script works fine on my server. I get a 404 when I try
 to run your link.
 


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




Mail forwarding

2002-01-09 Thread Jenny Yuen

Hello,

I don´t know much about Perl and want to know how can I make a program that downloads 
a file from a server.

Where can I find reference about it?


Jenny



RE: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Bob Showalter

 -Original Message-
 From: Henk van Ess [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 09, 2002 3:19 AM
 To: Bob Showalter; [EMAIL PROTECTED]
 Subject: Re: 2 Q's, Google and Me - can you spell it out?
 
 
 Sorry, I gave the wrong URL
 
 http://www.voelspriet.nl/cgi-bin/spriet.cgi
 
 What did I do wrong?

Can't tell based on the message from the server. Check the following:

1. Is there an error message in your sever error log? I see
you're using Microsoft IIS 5.0, but I don't know anything about
how it logs errors.

2. Does your script run from the command line and produce output?
If I run it on my system, it does.

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




RE: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Camilo Gonzalez

This is a common problem. The heredoc terminator must be on a line all by
itself, no spaces, no tabs. Here you have it preceeded by spaces.

-Original Message-
From: Henk van Ess [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 9:22 AM
To: Bob Showalter; [EMAIL PROTECTED]
Subject: Re: 2 Q's, Google and Me - can you spell it out?


Dear Bob, dear all,

I followed your suggestion and installed Active Perl for a local test. If I
run the script below, I get the following error:

Too late for -T option at C:\spriet.nl

When I remove the first line #!/usr/bin/perl -wT
i get the error:

Can't find string terminator  END_HTMLanywhere before EOF at C:\spriet.pl
line 31

Hope you can help ...

Henk van Ess



#!/usr/bin/perl -wT
use strict;
use CGI qw/:standard/;
use URI::Escape;

# if we came from the form, grab the values and create the URL
if ( param )
{
# get the form data
# see perldoc CGI
my $_prefix = param( 'prefix' ) || '';
my $_search = param( 'search' ) || '';

# untaint it
# see perldoc perlsec
my ( $prefix ) = ( $_prefix =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex
my ( $search ) = ( $_search =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex

# escape characters with special meaning in URIs
# see perldoc URI::Escape
$prefix = uri_escape( $prefix );
$search = uri_escape( $search );
print redirect(
http://www.google.com/search?q=$prefix%20$search; );
}
# otherwise, print the Web page
else
{
print header;
print END_HTML;
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

html
head
titleTest page/title
/head
body
form action=spriet.cgi method=get
input type=checkbox name=prefix value=allintitle: /
All in titlebr /
input type=text name=search /
input type=submit   name=Submit /
/form
/body
/html
END_HTML
}





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

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




Re: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Henk van Ess

Ty for your fast answer, but I;m still puzzled. Could you paste the script
and add the proper syntax?  You really would help me with that

Henk van Ess


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




RE: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Camilo Gonzalez

The last part of your script looks like this

/form
/body
/html
END_HTML
}

It should look like this

/form
/body
/html
END_HTML
}

In other words, the END_HTML token needs to be on its own line with a return
immediately before and after it and no extraneous characters, including
spaces. Does that make sense?

-Original Message-
From: Henk van Ess [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 9:49 AM
To: Camilo Gonzalez; Bob Showalter; [EMAIL PROTECTED]
Subject: Re: 2 Q's, Google and Me - can you spell it out?


Ty for your fast answer, but I;m still puzzled. Could you paste the script
and add the proper syntax?  You really would help me with that

Henk van Ess

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




Re: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Curtis Poe

--- Henk van Ess [EMAIL PROTECTED] wrote:
 Dear Bob, dear all,
 
 I followed your suggestion and installed Active Perl for a local test. If I
 run the script below, I get the following error:
 
 Too late for -T option at C:\spriet.nl

Since you're running IIS, getting the too late for -T option means that your scripts 
are running
through ISAPI.  This will give you a performance benefit, but it also means that you 
lose the
security benefits of taint checking.  An awful tradeoff, as far as I am concerned.  
You can read a
bit more about this at http://www.perlmonks.org/index.pl?node_id=82619
 
 When I remove the first line #!/usr/bin/perl -wT
 i get the error:
 
 Can't find string terminator  END_HTMLanywhere before EOF at C:\spriet.pl
 line 31
 
 Hope you can help ...

Traps with HERE docs:

1.  The final token (END_HTML), in this case, must be on a line by itself and not have 
any
whitespace before or after it.
2.  It must not have a semicolon after it.
3.  It must have at least one line after it.

Actually, the first point above is not quite true.  The following is quite valid 
(let's pretend
that periods are spaces, for a moment):

.print.END_HERE;
.This.will.be.printed
.And.so.will.this
.END_HERE

That can let you cheat and get around the left justification problem.

Cheers,
Curtis Ovid Poe

=
Ovid on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Henk van Ess

Dear all, 

Again, ty so much for your help. I'm learning a lot about Perl now.

Finally the script is running! Details do matter, don't they?

I have a new problem.

Check

http://www.voelspriet.nl/cgi-bin/spriet.pl

check All in Title en press Submit.

Error:

'd:\www\voelspriet.nl\www\cgi-bin\spriet.pl' script produced no output 

Any ideas, you great minds?

Henk van Ess



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




Re: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Curtis Poe

--- Henk van Ess [EMAIL PROTECTED] wrote:
 http://www.voelspriet.nl/cgi-bin/spriet.pl
 
 check All in Title en press Submit.
 
 Error:
 
 'd:\www\voelspriet.nl\www\cgi-bin\spriet.pl' script produced no output 

Henk,

Find your error log.  Since you appear to be using ISAPI, it's likely named something 
like
'perlIS-Err.log'.  Send the appropropriate errors from that log and that would be a 
good start.

Another thing to use is insert the following line into your program:

use CGI::Carp qw/fatalsToBrowser/;

This line will send the fatal error messages to your browser so you can see them 
directly without
needing to search for the log.  That line should only be used in testing, though, and 
not in
production!

Cheers,
Curtis Ovid Poe

=
Ovid on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Henk van Ess

What an excellent tip.. My ISP doesn't give me acces to the log right away,
so the browser-trick helped me out!

here's the error:
Software error:
Can't locate object method appropriate via package regex at
d:\www\voelspriet.nl\www\cgi-bin\spriet.pl line 17.






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




Re: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Curtis Poe

--- Henk van Ess [EMAIL PROTECTED] wrote:
 What an excellent tip.. My ISP doesn't give me acces to the log right away,
 so the browser-trick helped me out!
 
 here's the error:
 Software error:
 Can't locate object method appropriate via package regex at
 d:\www\voelspriet.nl\www\cgi-bin\spriet.pl line 17.

Found your problem:

my ( $prefix ) = ( $_prefix =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex

You appear to have cut and pasted the text directly from the Email.  In this case, 
appropriate
regex should have been part of the comment.  By putting them on the next line (this 
occurs in two
places), you are telling Perl that there is a method called appropriate in a package 
called
regex (this is an alternative method calling syntax that I'm not terribly fond of).

To fix this, either delete this line, or remove the newline after #create so that 
Perl
recognizes appropriate regex as part of the comment:

   ...#create appropriate regex

Cheers,
Curtis Ovid Poe

=
Ovid on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: 2 Q's, Google and Me - can you spell it out?

2002-01-09 Thread Henk van Ess

Dear all,

It worked! You should have seen my face when I saw the script working for
the first time.

My first Perl script, thanks to architect Curtis and with great help of Bob
and Camilo! Ty all.  I'm looking forward to learn more from you guys.


Henk van Ess
www.voelspriet.nl



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




Google-script, enhancements

2002-01-09 Thread Henk van Ess

Dear all,

I'm enhancing the Google-script, and would love to get an OUTPUT like this:

http://www.google.com/search?q=leukas_qdr=m3

How do I get the FIXED value as_qdr=m3 after the VARIABLE q?

I don't need a Prefix now, but a suffix. How do I enter this in Perl?

Here's the script so far:


use strict;
use CGI qw/:standard/;
use URI::Escape;
use CGI::Carp qw/fatalsToBrowser/;

# if we came from the form, grab the values and create the URL
if ( param )
{
# get the form data
# see perldoc CGI
my $_prefix = param( 'prefix' ) || '';
my $_search = param( 'search' ) || '';

# untaint it
# see perldoc perlsec
my ( $prefix ) = ( $_prefix =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex
my ( $search ) = ( $_search =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex

# escape characters with special meaning in URIs
# see perldoc URI::Escape
$prefix = uri_escape( $prefix );
$search = uri_escape( $search );
print redirect(
http://www.google.com/search?q=$prefix%20$search; );
}
# otherwise, print the Web page
else
{
print header;
print END_HTML;
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

html
head
titleTest page/title
/head
body
form action=spriet.pl method=get
input type=checkbox name=prefix value=allintitle: /
All in titlebr /
input type=text name=search /
input type=submit   name=Submit /
/form
/body
/html
END_HTML
}

I w


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




authentication help

2002-01-09 Thread K G Findlay

Hi all, I am trying to implement a members section to my site. 
 
I would like to find some advice on how to-do this efficiently.
 
I understand that sessions is probably the way to go but how would these
be implemented in perl.
 
My users would be expected to login to the site .. then each document
requested will check authentication. 
Which if failed would call login. 
 
Could you please direct me in the right direction by either advice or
relevant links.
 
Cheers (haven't been able to find what I want on google or perlmonk).
 
--
K G Findlay
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--



Re: Cookies ...

2002-01-09 Thread Briac Pilpré

Polikarpov Cyrill wrote:
 I'm working whith perl but I don't know how to work whith cookies. Give 
 me please some tips for this one ...

 A good start would probably be to read the documentation of
 HTTP::Cookies
 perldoc HTTP::Cookies
 or
 http://search.cpan.org/doc/GAAS/libwww-perl-5.63/lib/HTTP/Cookies.pm

 The CGI modules also offers support of cookies and have good examples
 on how to use them in it documentation:
 perldoc CGI
 or
 http://search.cpan.org/doc/LDS/CGI.pm-2.79/CGI.pm
 (search for the section called HTTP Cookies)

 A good read is merlyn's Web Techniques, at least two of them deals
 directly with cookies:
 http://www.stonehenge.com/merlyn/WebTechniques/col61.html
 http://www.stonehenge.com/merlyn/WebTechniques/col32.html
 
 A lot of other articles are using Cookies too, and they're probably
 the best commented examples you could find.

 Hope this helps,
 Briac

-- 
briac
Two kingfishers flying 
towards the west. Master Po 
near the market-place.

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




Re: Google-script, enhancements

2002-01-09 Thread Briac Pilpré

In article 00c101c1993b$662efc40$b81411d5@pc2002, Henk Van Ess wrote:
 Dear all,
 
 I'm enhancing the Google-script, and would love to get an OUTPUT like this:
 
 http://www.google.com/search?q=leukas_qdr=m3
 
 How do I get the FIXED value as_qdr=m3 after the VARIABLE q?
 
 I don't need a Prefix now, but a suffix. How do I enter this in Perl?

You can change the line :
 print redirect(http://www.google.com/search?q=$prefix%20$search; );
 
To :
 print redirect(
http://www.google.com/search?q=$prefix%20$searchas_qdr=m3; 
 );

-- 
briac
The Jade Emperor 
under an elm tree. A wolf 
walks beside a stream.

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