Hi monks!!!

I have been using File::Monitor perl module to monitor a directory and its working well when create or delete a file to a given directory ,if i update a file it shows nothing and i have referred all the links but i don't know what i did wrong

Here is my code

#! usr/bin/perl use strict; use warnings; use File::Monitor; use File::Monitor::Delta; use File::Monitor::Object; use Getopt::Long; use Config::IniFiles; use MIME::Lite; $file_list[$#file_list]=''; $temp=join('/',@file_list); $email_body=$email_body."\n File Name : $fil +e_name , Path : ".$temp."\n"; print "\n\n File Name : $file_name , Path : +".$temp."\n"; } $email_subject="Monitor Path : $path , Status : Added" +; &email; $email_subject=''; $email_body=''; undef @file_changes; undef @file_list; } if($file->files_deleted){ #print $file->files_deleted, " deleted\n"; print "Files Removed \n"; @file_changes=$file->files_deleted; $email_body="\nFiles Removed,\n"; for my $temp(@file_changes){ @file_list=split('/',$temp); my $file_name=$file_list[$#file_list]; $file_list[$#file_list]=''; $temp=join('/',@file_list); $email_body=$email_body."\n File Name : $fil +e_name , Path : ".$temp."\n"; print "\n\n File Name : $file_name , Path : +".$temp."\n"; } $email_subject="Monitor Path : $path , Status : Remove +d"; &email; $email_subject=''; $email_body=''; undef @changes; undef @file_list; } if($file->is_event('size')){ print "size change\n\n"; } if ($file->is_size) { my $name = $file->name; my $old_size = $file->old_size; my $new_size = $file->new_size; print "$name has changed size from $old_size to $new_size\ +n"; } } }

Actual Output

[abc@linux0059 monitor]$ perl code.pl --c config.ini Files Removed File Name : same1 , Path : /tmp/abc/ Email send : abc@google.com Files Created File Name : same1 , Path : /tmp/abc/ Email send : abc@google.com [abc@linux0059 monitor]$

Monitor Directory

[abc@linux0059 abc]$ ls folder log same1 same.txt sample2.txt simple [abc@linux0059 abc]$ rm same1 [abc@linux0059 abc]$ touch same1 [abc@linux0059 abc]$ echo "hai hello" > same1 [abc@linux0059 abc]$

Response Much appreciated!!!


In reply to Directory Monitor by perlmad

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.