Im getting the mysql/DBH 'segmentation fault' error this morning. I have it 'pruned' down to a small sample.
#!/usr/bin/perl -w
use strict;
use DBI;
use LWP::UserAgent;
use HTTP::Request::Common;
use XML::Simple;
use Date::Manip;
my $db_user = 'db_user';
my $db_pw = 'dbpw';
##
# DB connect
my $dbh = DBI->connect('DBI:mysql:db_name:db_host', $db_user, $db_pw,
+ {PrintError => 1, AutoCommit => 1, RaiseError => 1} );
if (DBI::err)
{
die $DBI::errstr;
}
my $xml = new XML::Simple (KeyAttr=>[]);
my $Browser = new LWP::UserAgent;
push @{ $Browser->requests_redirectable }, 'POST';
my $URL = 'https://some_site_with_xml_data';
my %Fields;
##################note this code#################
##
my $Page = $Browser->request(POST $URL,\%Fields);
##
#################################################
# clean up
$dbh->disconnect();
If I run the above code I get a 'segmentation fault' error. If I comment out the call to browser->request the error goes away. Its coming from DBI/DBH.
The snip is from a larger file that opens the XML data and walks through it. Im wanting to retrieve several values from this file and put them in a DB. The code was working until I added the calls to DBI. I pruned until I could get the error to go away.
Suggestions? I've used DBI::mysql in plenty of other projects before. Im not clear on why its not happy with this group of modules.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.