Hi perl Monks, Im trying to debug some issues and im got stuck...the script below is integrated with a software.... The below will give list of log files($covLogPathname.$suff) in a directory.. i have tried tp123.log and tp_123.log for filenames and im not able to get it printed (Found coverage output $covLogPathname.$suff\n";)

my @coverageLogPathnames; # First, look for files of the form tpxxx/tpxxx.log: use File::Find; my @testDirs; my $testsDir_mixed = ToMixed::PathToMixed( $testsDir ); find( sub { push @testDirs, $File::Find::name if -d && /tp_\w+/i }, +$testsDir_mixed ); foreach (@testDirs) { m{^(.*)/(tp_\w+)}i; my ($pathPrefix,$tpname) = ( $1 ? ($1,$2) : ('.',$_) ); my $covLogPathname = "$pathPrefix/$tpname/$tpname"; #print STDERR " // No coverage-logs/hitmaps fou +nd in test chekcing $covLogPathname\n" unless $found; my $found = 0; foreach my $suff ('log', 'bin', 'txt', 'dat') { my $mixed = ToMixed::PathToMixed( "$covLogPathname" ); print STDERR " // No coverage-logs/hitmaps fo +und in test chekcing $mixed\n" unless $found; if ( -e "$mixed" ) { push @coverageLogPathnames, "$covLogPathname.$suff"; print STDERR " // Found coverage output $covLog +Pathname.$suff\n"; ++$found; $foundone = $found; } } print STDERR " // No coverage-logs/hitmaps found in test su +bdirectory $pathPrefix/$tpname\n" unless $found; }

The below one is giving results but only for certain no of log files...for eg if there are 50 log files only 29 or 30 , im able to get....

if ($foundone == 0) { # New option: search under the hitmaps-direct +ory (one level only, any name in front) my $covLogPathname = "$testsDir"; my @hitfiles; my $covLogPathname_mixed = ToMixed::PathToMixed( $covLogPathname + ); find( sub { push @hitfiles, $File::Find::name if -f }, $covLogPa +thname_mixed ); foreach (@hitfiles) { my $foundfile = $_; my ($base,$path,$suff) = fileparse( $foundfile, "\.(log|bin| +txt|dat)" ); if ($suff ne "") { push @coverageLogPathnames, "$foundfile"; print STDERR " // Found coverage output $foundfil +e\n"; } } }

The below script also doesnt return any result..

# Second, look for logs named hitmap.(log|bin|txt): find( sub { if (-f && /^[-\w]*hitmap[-\w]*\.(log|bin|txt|dat)$/i) { push @coverageLogPathnames, $File::Find::name; print STDERR " // Found coverage output $File::Find +::name\n"; } }, $testsDir_mixed ); print STDERR " // Found coverage output hi4"; print STDERR " // Number of coverage logs found: ", (@coverageLog +Pathnames+0), "\n"; return \@coverageLogPathnames; }

im not strong in perl and im trying to debug the above but im not able to...please help monks..thanks.. $covLogPathname - directory where the log files are kept....


In reply to Debuging Perl Script by jack64

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.