File: monitor.pl

package info (click to toggle)
libgnome2-vfs-perl 1.080-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 468 kB
  • ctags: 71
  • sloc: perl: 1,195; ansic: 446; makefile: 53
file content (20 lines) | stat: -rw-r--r-- 396 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

use strict;
use warnings;
use Gnome2::VFS -init;

push @ARGV, "file:///tmp" unless @ARGV;
foreach my $dir (@ARGV) {
	print STDERR "creating monitor $dir... ";
	my($res,$handle)= Gnome2::VFS::Monitor->add ($dir, 'directory', \&dir_cb );
	print STDERR "$res\n";
}

Glib::MainLoop->new->run;

sub dir_cb {
	my $self= shift;
	my($dir, $file, $event)= @_;
	print STDERR "$event: $file in $dir\n";
}