Hello monks: I was tryng to feed a file with last ip granted by my dhcp server. Trying to inspect dhcpd.log file using tail, I tryed a simple code from documentation. test.pl

#!/usr/bin/perl use File::Tail; $file=File::Tail->new("/var/log/dhcpd.log"); while (defined($line=$file->read)) { print "$line"; }

Here dont get any output nor error so, then I tryed other piece of code that works ok. test2.pl

#!/usr/bin/perl -w use File::Tail; sub find_aaa_name { return '/var/log/dhcpd.log'; } my $file = File::Tail->new( name =>'/opt/dhcp_tail/dummy.txt', interval => 1, maxinterval => 1, resetafter=> 5, name_changes=> \&find_aaa_name, ignore_nonexistant => 1 ); while (defined($line = $file->read)) { print $line,"\n"; } 1;
Can someone give me a clue? What is the difference ; why test1 dont work and dont print even an error message and test2 works ok ? I hope it can be usefull to someone. Regards, Leo.

In reply to File::Tail can not get output by leostereo

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.