Young Anonymous,
It's not about wanting and needing, but about sharing and contributing. So I'll help you out a little with this "working" script.
You'll have to change some things to get it working entirely with just perl instead of using system calls ;).
So it's up to you to:
- look up what strict does and to implement it.
- Look for what other javacode makes popups appear and implement the matching of it.
- See why the LWP-module is so very nifty, and usefull if you don't have lynx ;).
And thus completely rewrite this quick and dirty example.
To speak with the unforgettable words of Janice Joplin, "Try-ha-ha-ha-ha, just a little bit harder".
#!/usr/bin/perl -w
#popuppagechecker.pl
$url = "empty";#;)
if ($ARGV[0]) {
$url = $ARGV[0];
}
if ($url eq "empty"){
print "Specify url like popuppagechecker.pl http:\/\/www.makemyhomewor
+k.com\n";
exit;
}
open TEL, "lynx -source $url|";
@text = <TEL>;
$darnpopup = "false";
# teabags full report ;)
print "@text\n$url";
foreach $line(@text){
if ($line =~ m/window.open/g){
print " probably has popups, (or some other lame javascript....)\n";
$darnpopup = "true";
}
}
if ($darnpopup ne "true"){
print " probably has no popups\n";
}
Hmm, I just realised fixing the above code sounds even like more homework then you're in for! hehe...
Teabag
Sure there's more than one way, but one just needs one anyway - Teabag