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, |
|
|---|