{"id":37,"date":"2003-09-22T03:22:00","date_gmt":"2003-09-22T03:22:00","guid":{"rendered":"http:\/\/jclark.org\/weblog\/Programming\/Perl\/abort.html"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-30T04:00:00","slug":"abort","status":"publish","type":"post","link":"https:\/\/jclark.org\/weblog\/2003\/09\/22\/abort\/","title":{"rendered":"Abort"},"content":{"rendered":"<p>I&#8217;ve categorized this as <strong>Programming::Perl<\/strong> but I could just as easily have put it under <strong>Mistakes::Beginner::Really Stupid<\/strong>.<\/p>\n<p>I was experimenting with a bit of Perl code to process a text file.  The whole thing was only maybe 25 lines or so.  Every time I&#8217;d run the code, the only output I&#8217;d get was a single line:<\/p>\n<blockquote><p><code>Abort.<\/code><\/p><\/blockquote>\n<p>I scratched my head and perused my code for quite a while.  I didn&#8217;t see any place <em>I<\/em> was explicitly causing this, and it seemed like the most cryptic error I&#8217;d seen.  A cursory search of <a href=\"http:\/\/perldoc.com\">perldoc.com<\/a> and <a href=\"http:\/\/perlmonks.org\">Perl Monks<\/a> failed to shed any light.  I assumed I must be abusing my I\/O in some fashion (I am still a rookie in Perldom).<\/p>\n<p>My perl debugging knowledge is even more limited than my Perl knowledge.  At work I&#8217;ve used a TK-based debugger (something like ptkdbg, can&#8217;t remember), which is <span class=\"caps\">GUI<\/span>-fied and fairly straightforward, but which I don&#8217;t seem to have on my Powerbook (note to self: find out what that is, and find a copy for home).  Falling back on that most time-honored of debugging methods, the manual trace (read: liberal (ab)use of print statements), I found that my I\/O was fine.  The abort occured at the very end, when I tried to output (via Data::Dumper) the data structure I&#8217;d built from the file.  Those of you with more perl-fu than I will see the problem immediately:<\/p>\n<blockquote><p><code>dump(\\%ev);<\/code><\/p><\/blockquote>\n<p>I didn&#8217;t see it, so I searched perldoc.com for <code>dump()<\/code>.  And then I learned.  What I should have done was this:<\/p>\n<blockquote><p><code>print Dumper(\\%ev);<\/code><\/p><\/blockquote>\n<p>This would have pretty-printed my hash full of hashes in all its nested glory.  The call to <code>dump()<\/code>, on the other hand, asks Perl to immediately dump core and abort.  Perl obliged.<\/p>\n<p>At least now I know what &#8220;<code>Abort.<\/code>&#8221; in my perl output means.<\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve categorized this as Programming::Perl but I could just as easily have put it under Mistakes::Beginner::Really Stupid. I was experimenting with a bit of Perl code to process a text file. The whole thing was only maybe 25 lines or so. Every time I&#8217;d run the code, the only output I&#8217;d get was a single [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-perl"],"_links":{"self":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":0,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"wp:attachment":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}