473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Issues working with callbacks File::Monitor

63
Hi, I already posted a similar problem, but now I have more concrete ideas of what I need. I'm trying to build a "drop box" so I can be watching a directory and every time a file is created I'll work with it automatically.
The problem is that I only can return if the directory was modified or not. I'd like to get the names of the new files.
I understood by reading the File::Monitor and File::Monitor::Delta documentation that I must build a "callback" for each modification I want to watch, but I can't figure where to do that in my code...
That's what I have:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use File::Monitor;
  5. ### use File::Monitor::Object;
  6. use File::Monitor::Delta;
  7.  
  8. my $monitor = File::Monitor->new();
  9.  
  10.  # Watch a directory
  11.     $monitor->watch('/home/joao/PERLFOLDER');
  12.  
  13.  
  14. while (1){
  15.     my @changes=$monitor->scan;
  16.  
  17.     for my $change (@changes) {
  18.     warn $change->name, " has changes\n";
  19. }
  20.  
  21.     sleep 1;
  22.  
  23. }
Can someone help me with the callbacks?

thanks,

Joćo
Sep 28 '07 #1
1 1806
jcor
63
I made it work (for now) :-).
thanks anyway!!!
Sep 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: web1110 | last post by:
I have a file monitor program using FileSystemWatcher. All events seem to be "Changed" even when I delete a file. I checked and don't see any "deleted" events even when I delete some files. Is...
7
by: Mark | last post by:
Hello, I have researched and tried every thing I have found on the web, in groups and MS KB articles. Here is what I have. I have a Windows 2000 Domain Controller all service packs and...
1
by: LeapFrog27 | last post by:
I have built a file monitor programs that monitors both files and folders on a network drive. However I can not figure out a way to caputure the person's logon id or computer name when they delete...
4
by: rrutkowski | last post by:
Hi! I need to rasterize a svg file in a .NET project. Currently I'm trying to use an open source library called librsvg. I've completed all the dlls and started writing the following wrapper: ...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
2
by: TwistedPair | last post by:
All, This is sort of a continuation of a previous post of mine. The code below basically reads a registry key to get a path to a folder and it watches for files created in that folder (only...
3
by: =?Utf-8?B?RGFuaWVs?= | last post by:
I'm working with the FileSystemWatcher which has a Created event. But this event is raised as soon as the new file begins to be written on disk. What I want is a notification after a file being...
1
by: nanban4u | last post by:
Hi, Programming Language - HTML, JavaScript Web server : IIS 6 Browser : IE 6 + I am working in a Dual Monitor screen setup. I have a scenario some times the user move the IE screen from...
1
by: ScottZ | last post by:
With python 2.6 and wxpython I'm trying to create a system tray icon application based around an example found here:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.