non vorrei lavorare

ブログ名の通りです。javascript three.js mruby rust OCaml golang julialang blender

IE7をPerlで操る

IE7複数立ち上げると落ちることが発覚してますが、

#!/perl/bin/perl
use Win32::OLE;
use Win32::ODBC;
use strict;

my $dsn="websearch";

my $uid="himitsu";

my $pwd="";

my $IE = Win32::OLE->new('InternetExplorer.Application');

$IE->{visible} = 1;

my $Data = new Win32::ODBC("DSN=$dsn;UID=$uid;PWD=$pwd");

$Data->Sql("select url from url where status like '200%' order by lastupdate desc limit 1000");

while($Data->FetchRow()) {

    my (%data) = $Data->DataHash();

   
    $IE->Navigate($data{'url'});

while($IE->{Busy} || $IE->{ReadyState} != 4) {

    sleep(1);

}

    my $IEDocument = $IE->{Document};

my $links = $IEDocument->links;

    foreach my $link (in $links) {

my $url = $link->href;

print "$url\n";

    }

}

$Data->Close();

関連記事