looking for help with script (what's new?)

L

leepincat

I don't know scripting from Chinese. I'm trying to do a little
research for someone as an act of human kindness.
I don't know if it's difficult, or a simple thing.... hoping if
someone knows how to do this without a lot of effort and time, that
would be great. If I'm off base, ....I tried.
(I don't even know if I'm in the "correct" group.

Is the following something that can be done with PERL?
Could you post some examples? Again, if this is too much to ask, I
apoligize in advance- Donna

1. Code must compile/run without errors
2. It takes arguments for: timeout, url, expected_response_code,
retry_count
3. The script performs an HTTP GET for the url
4. If the HTTP response code matches the expected_response_code the
script will exit with status code 0
5. If the HTTP response code doesn't match exit with a nonzero status
code and print an error
6. If the HTTP GET either times out or fails in another way
(connection
refused, etc.) retry until retry count is exhausted
7. If all retries are exhausted without a success, print a message
to STDERR and exit with a non-zero status code.
 
L

leepincat

I don't know scripting from Chinese. I'm trying to do a little
research for someone as an act of human kindness.
 I don't know if it's difficult, or a simple thing.... hoping if
someone knows how to do this without a lot of effort and time, that
would be great. If I'm off base, ....I tried.
(I don't even know if I'm in the "correct" group.

Is the following something that can be done with PERL?
Could you post some examples?  Again, if this is too much to ask, I
apoligize in advance- Donna

 1. Code must compile/run without errors
 2. It takes arguments for: timeout, url, expected_response_code,
   retry_count
 3. The script performs an HTTP GET for the url
 4. If the HTTP response code matches the expected_response_code the
   script will exit with status code 0
 5. If the HTTP response code doesn't match exit with a nonzero status
   code and print an error
 6. If the HTTP GET either times out or fails in another way
(connection
   refused, etc.) retry until retry count is exhausted
 7. If all retries are exhausted without a success, print a message
   to STDERR and exit with a non-zero status code.


I was hoping someone in this group might be a bit more open minded.
Simply trying to help someone out as I explained.... I don't know
why that upsets you. Maybe it's "acts of human kindness" you're not
familiar with. You should try it sometime. -dj
 
U

Uri Guttman

l> I was hoping someone in this group might be a bit more open minded.
l> Simply trying to help someone out as I explained.... I don't know
l> why that upsets you. Maybe it's "acts of human kindness" you're not
l> familiar with. You should try it sometime. -dj

and you should ask for a pony if you have that attitude. this group is
to help people with perl issues, not code for them. if you want coding
done, go to jobs.perl.org and post a paying job.

what you have asked for is way beyond a simple little script. it is
called work.

uri
 
K

Keith Keller

1. Code must compile/run without errors

perldoc strict
2. It takes arguments for: timeout, url, expected_response_code,
retry_count

perldoc perlfunc
3. The script performs an HTTP GET for the url

perldoc LWP
4. If the HTTP response code matches the expected_response_code the
script will exit with status code 0

perldoc -f exit
5. If the HTTP response code doesn't match exit with a nonzero status
code and print an error

perldoc -f warn
6. If the HTTP GET either times out or fails in another way
(connection
refused, etc.) retry until retry count is exhausted

perldoc perlsyn
7. If all retries are exhausted without a success, print a message
to STDERR and exit with a non-zero status code.

perldoc perlsyn
perldoc -f warn
perldoc -f exit
perldoc perl

Good luck.

--keith
 
L

leepincat

perldoc strict


perldoc perlfunc


perldoc LWP


perldoc -f exit


perldoc -f warn


perldoc perlsyn


perldoc perlsyn
perldoc -f warn
perldoc -f exit
perldoc perl

Good luck.

--keith

--
(e-mail address removed)-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

Thank-You VERY much for the constructive response !
Truly appreciated - Donna K
 
S

Steve C

I don't know scripting from Chinese. I'm trying to do a little
research for someone as an act of human kindness.
I don't know if it's difficult, or a simple thing.... hoping if
someone knows how to do this without a lot of effort and time, that
would be great. If I'm off base, ....I tried.
(I don't even know if I'm in the "correct" group.

Is the following something that can be done with PERL?
Could you post some examples? Again, if this is too much to ask, I
apoligize in advance- Donna

1. Code must compile/run without errors
2. It takes arguments for: timeout, url, expected_response_code,
retry_count
3. The script performs an HTTP GET for the url
4. If the HTTP response code matches the expected_response_code the
script will exit with status code 0
5. If the HTTP response code doesn't match exit with a nonzero status
code and print an error
6. If the HTTP GET either times out or fails in another way
(connection
refused, etc.) retry until retry count is exhausted
7. If all retries are exhausted without a success, print a message
to STDERR and exit with a non-zero status code.


If all you want is the response code you should do HEAD, not GET.
Perl is an excellent choice for doing this.
 
C

ccc31807

Perl is know informally as the glue of the internet. It was at one
time very widely used for server side programming. If your
requirements are any indication, Perl is a good choice. Of course, if
you are masochistic, you could also use C, VB, or even ASM.

You can find examples of your needs by using Google or equivalent. You
can purchase 'Perl and LWP' by Sean Burke for less than $10.00. Also,
'Network Programming with Perl' by Linclon Stein is also very good. Of
course, you might want to try reading 'Learning Perl' by Randal
Schwartz first.

Is the following something that can be done with PERL?
 1. Code must compile/run without errors

Yes, it's possible for Perl code to run without errors.
 2. It takes arguments for: timeout, url, expected_response_code,
   retry_count

Yes, Perl scripts can take arguments, either from the command line or
interactively.
 3. The script performs an HTTP GET for the url

Yes, you can retrieve web pages with Perl.
 4. If the HTTP response code matches the expected_response_code the
   script will exit with status code 0

Yes, you can test the response code and conditionally exit.
 5. If the HTTP response code doesn't match exit with a nonzero status
   code and print an error

Yes, see above.
 6. If the HTTP GET either times out or fails in another way
(connection
   refused, etc.) retry until retry count is exhausted

Yes, this is normally called a loop.
 7. If all retries are exhausted without a success, print a message
   to STDERR and exit with a non-zero status code.

Yes.

CC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top