# modules for easier debugging and # better coding standards use warnings; use diagnostics; use strict; #### # URL that returns list of YBX categories my $category_list_http = qw !http://api.yellowbrix.com/api/?service=category_list&method=xml&id=verizon&pass­word=xxxxxx!; #### my $url = qq!http://api.yellowbrix.com/api/?!; my $common = qq!method=xml&id=verizon&pass­word=xxxxxx;! # URL that returns list of YBX categories my $category_list_http = $url . qq!service=category_list&$common!; # URL to xml file on yellowbrix server. CATEGORY must be provided my $category_http_start = $url . qq!service=headlines&$common&category=!; my $category_http_end = qw !&enabletext=1!; # URL to weather on yellowbrix server. weather query must be appended. my $weather_http = $url . qq!service=weather&$common&query=!; #### # mySQL escape character my $sql_escape_char = '\\'; ... $data{pub_source} =~ s/(')/$sql_escape_char'/gs; $data{headline} =~ s/(')/$sql_escape_char'/gs; $data{summary} =~ s/(')/$sql_escape_char'/gs; #### sqlStatement ('INSERT articles ('. 'story_id,'. 'arrival_date,'. 'display_date,'. 'category,'. 'pub_source,'. 'xml_url,'. 'ybh_url,'. 'img_url,'. 'headline,'. 'summary,'. 'summary_url'. ') VALUES ('. "'$article_data{story_id}',". "'$article_data{arrival_date}',". "'$article_data{display_date}',". "'$article_data{category}',". "'$article_data{pub_source}',". "'$article_data{xml_url}',". "'$article_data{ybh_url}',". "'$article_data{img_url}',". "'$article_data{headline}',". "'$article_data{summary}',". "'$article_data{summary_url}'". ')'); #### $article_data{summary_url} = "some stuff \'); drop table articles;"; #### sqlConnectToDB; sqlStatement ("TRUNCATE TABLE articles"); .... # retrieve xml file with all articles my $headline_xml = getHTTPAddress($category_http_start.uri_escape($category_name).$category_http_end);