I'm new to XML::Twig, and I'm trying to parse a PubMed XML 2.0 esummary final to place into a mySQL database. I've gotten this far:

```
#!/bin/perl -w
use strict;
use DBI;
use XML::Twig;

my $uid = "";
my $title = "";
my $sortpubdate = "";
my $sortfirstauthor = "";
my $dbh = DBI->connect ("DBI:mysql:medline:localhost:80",
                           "root", "mysql");
my $t= new XML::Twig(   twig_roots => { 'DocumentSummary' => $uid => \&submit },
                        twig_handlers => { 'DocumentSummary/Title' => $title, 'DocumentSummary/SortPubDate' => $sortpubdate, 'DocumentSummary/SortFirstAuthor' => $sortfirstauthor});
$t->parsefile('20112.xml'); 
$dbh->disconnect();
exit;

sub submit
    {   my $insert= $dbh->prepare( "INSERT INTO medline_citation (uid, title, sortpubdate, sortfirstauthor) VALUES (?, ?, ?, ?);");
        $insert->bind_param( 1, $uid);
        $insert->bind_param( 2, $title);
        $insert->bind_param( 3, $sortpubdate);
        $insert->bind_param( 4, $sortfirstauthor);
        $insert->execute();
        $t->purge;
    }

```

But Perl seems to stall for some reason. Am I doing this right? I'm trying to use twig\_roots to decrease the amount of parsing since I'm only interested in a few fields (these are large files).

Here is an example of the XML:

```
<DocumentSummary uid="22641317">
    <PubDate>2012 Jun 1</PubDate>
    <EPubDate></EPubDate>
    <Source>Clin J Oncol Nurs</Source>
    <Authors>
        <Author>
            <Name>Park SH</Name>
            <AuthType>
                Author
            </AuthType>
            <ClusterID>0</ClusterID>
        </Author>
        <Author>
            <Name>Knobf MT</Name>
            <AuthType>
                Author
            </AuthType>
            <ClusterID>0</ClusterID>
        </Author>
        <Author>
            <Name>Sutton KM</Name>
            <AuthType>
                Author
            </AuthType>
            <ClusterID>0</ClusterID>
        </Author>
    </Authors>
    <LastAuthor>Sutton KM</LastAuthor>
    <Title>Etiology, assessment, and management of aromatase inhibitor-related musculoskeletal symptoms.</Title>
    <SortTitle>etiology assessment and management of aromatase inhibitor related musculoskeletal symptoms </SortTitle>
    <Volume>16</Volume>
    <Issue>3</Issue>
    <Pages>260-6</Pages>
    <Lang>
        <string>eng</string>
    </Lang>
    <NlmUniqueID>9705336</NlmUniqueID>
    <ISSN>1092-1095</ISSN>
    <ESSN>1538-067X</ESSN>
    <PubType>
        <flag>Journal Article</flag>
    </PubType>
    <RecordStatus>
        PubMed - in process
    </RecordStatus>
    <PubStatus>4</PubStatus>
    <ArticleIds>
        <ArticleId>
            <IdType>pii</IdType>
            <IdTypeN>4</IdTypeN>
            <Value>N1750TW804546361</Value>
        </ArticleId>
        <ArticleId>
            <IdType>doi</IdType>
            <IdTypeN>3</IdTypeN>
            <Value>10.1188/12.CJON.260-266</Value>
        </ArticleId>
        <ArticleId>
            <IdType>pubmed</IdType>
            <IdTypeN>1</IdTypeN>
            <Value>22641317</Value>
        </ArticleId>
        <ArticleId>
            <IdType>rid</IdType>
            <IdTypeN>8</IdTypeN>
            <Value>22641317</Value>
        </ArticleId>
        <ArticleId>
            <IdType>eid</IdType>
            <IdTypeN>8</IdTypeN>
            <Value>22641317</Value>
        </ArticleId>
    </ArticleIds>
    <History>
        <PubMedPubDate>
            <PubStatus>entrez</PubStatus>
            <Date>2012/05/30 06:00</Date>
        </PubMedPubDate>
        <PubMedPubDate>
            <PubStatus>pubmed</PubStatus>
            <Date>2012/05/30 06:00</Date>
        </PubMedPubDate>
        <PubMedPubDate>
            <PubStatus>medline</PubStatus>
            <Date>2012/05/30 06:00</Date>
        </PubMedPubDate>
    </History>
    <References>
    </References>
    <Attributes>
        <flag>Has Abstract</flag>
    </Attributes>
    <PmcRefCount>0</PmcRefCount>
    <FullJournalName>Clinical journal of oncology nursing</FullJournalName>
    <ELocationID></ELocationID>
    <ViewCount>0</ViewCount>
    <DocType>citation</DocType>
    <SrcContribList>
    </SrcContribList>
    <BookTitle></BookTitle>
    <Medium></Medium>
    <Edition></Edition>
    <PublisherLocation></PublisherLocation>
    <PublisherName></PublisherName>
    <SrcDate></SrcDate>
    <ReportNumber></ReportNumber>
    <AvailableFromURL></AvailableFromURL>
    <LocationLabel></LocationLabel>
    <DocContribList>
    </DocContribList>
    <DocDate></DocDate>
    <BookName></BookName>
    <Chapter></Chapter>
    <SortPubDate>2012/06/01 00:00</SortPubDate>
    <SortFirstAuthor>Park SH</SortFirstAuthor>
</DocumentSummary>

```

Thanks!