Here's a much shorter example:
#! /usr/bin/perl -wd use strict; #use Carp; use DBI; my $dbname = "passive"; my $dbuser = "scand"; my $dbpass = "redacted"; my $dsn = "DBI:mysql:" . $dbname; # Open the database my $dbh = DBI->connect($dsn, $dbuser, $dbpass); unless( defined $dbh ) { warn( "($$) Database connect failed: $DBI::errstr\n" ); } my @userids = (); my @passwords = (); my $sth = $dbh->prepare("SELECT id,userid,passwd FROM credentials"); $sth->execute(); while ( my @row = $sth->fetchrow_array ) { $userids[$row[0]] = $row[1]; $passwords[$row[0]] = $row[2]; } $sth->finish; # $dbh->disconnect opendir( DIR, '/usr/local/bin' ); my @filenames = readdir DIR; closedir DIR; my $userid; for( my $i=0; $i<=$#filenames; ++$i ) { $sth = $dbh->prepare("SELECT id FROM target WHERE note='$filenames +[$i]"); $sth->execute(); my @row = $sth->fetchrow_array; if( defined $row[0] ) { next; } open( FILE, '<', "$filenames[$i]" ); my $line = <FILE>; while( defined $line ) { if( $line =~ /ssh (\w+)\@([\d\.]+)/ ) { my $username = $1; my $ipaddr = $2; if( $username =~ /\$userid/ ) { $userid = 4; } else { $userid=0; for( my $j=0; $j<=$#userids; ++$j ) { if( $username =~ $userids[$j] ) { $userid = $j; last; } } if( $userid == 0 ) { warn "Unknown username encountered: $username\n"; } else { $sth = $dbh->prepare("INSERT INTO target (target,note,cred +,enapwd) VALUES ('$ipaddr','$filename[$i]',$userid,$userid)"); $sth->execute(); } } } } close FILE; } exit 0;

The error line is 60, the one beginning with "$sth = $dbh->prepare("INSERT INTO target...". I know this because if I comment out just this one line, it compiles without an error. Heres the output I get when I leave it in:

$ perl -c loader.pl Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. BEGIN not safe after errors--compilation aborted at /usr/share/perl5/C +arp/Heavy.pm line 11. Compilation failed in require at /usr/share/perl5/Carp.pm line 33.

Note that Carp is actually commented out at the top, so DBI is pulling it in. This is ultimately an issue with Carp.

Any aid identifying what is wrong here, also appreciated :-)


In reply to Re: No errors listed by dfdumont
in thread No errors listed by dfdumont

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.