#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Cookies; #use lib '/Perl/site/lib/myModules';s use myModules::initHTTP qw(:all); use DBI; initHttp('http://water:8080'); ########################################################################## my ($dbh) = DBI->connect('DBI:ODBC:xxxx', 'xcx', '') or die "Couldn't connect to database: " . DBI->errstr; ########################################################################## getAll(); ########################################################################## $dbh->disconnect(); ########################################################################## sub getAll{ print "Fetching All records\n"; my $rs = sendRequest('GET', 'http://www.mycareer.loreal.com/candidate/searchjobresults_xml.asp?l=15'); #fetch page while ($rs =~ m!vacancytitle="(.*?)".*?country="(.*?)" startdate="(.*?)".*?employmentfield="(.*?)".*?/>!isg){ print $1."\t".$2."\t".$3."\t".$4."\n"; insert($1, $2, $3, $4); } #Adump($rs);exit; } sub insert{ my ($vacancytitle, $country, $startdate, $employmentfield) = @_; my $sth2 = $dbh->prepare('insert into xxxx..Loreal (vacancytitle, country, startdate, employmentfield) values (?, ?, ?, ?)') or die "Couldn't prepare UPDATE statement: " . $dbh->errstr; # this line is only for the Itchy server $sth2->execute ($vacancytitle, $country, $startdate, $employmentfield) or die "Couldn't execute INSERT statement: " . $sth2->errstr; $sth2->finish; } sub load { $/ = undef; open OUT, 'optList.asp'; my $p = ; close OUT; return $p; } sub Adump { my $lst = shift; open OUT, '>Loreal.xml'; print OUT $lst; close OUT; }