Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Detecting for HTTP pages code changes

by Athanasius (Chancellor)
on Jan 15, 2018 at 03:15 UTC ( #1207255=note: print w/replies, xml ) Need Help??


in reply to Detecting for HTTP pages code changes

Hello dotowwxo,

This sounds like a job for the flip-flop operator:

use strict; use warnings; use feature qw( state ); while (my $code = get_code()) { print "Send email re: http code $code\n" if $code != 404 .. $code +== 404; } sub get_code { state $codes = [ 200, 200, 404, 404, 404, 404, 200, 200, 404, 404, + 200, ]; return shift @$codes; }

Output:

13:10 >perl 1861_SoPW.pl Send email re: http code 200 Send email re: http code 200 Send email re: http code 404 Send email re: http code 200 Send email re: http code 200 Send email re: http code 404 Send email re: http code 200 13:10 >

The above is just a proof of concept, but adapting it to your actual code should be a straightforward exercise. References:

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1207255]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2018-07-20 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (438 votes). Check out past polls.

    Notices?