Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

constantly monitoring the size of an object

by blackadder (Hermit)
on Sep 02, 2003 at 19:32 UTC ( #288399=perlquestion: print w/replies, xml ) Need Help??

blackadder has asked for the wisdom of the Perl Monks concerning the following question:

Dear All,

I need you to set me on the right path on how can I go about constantly monitoring the size of an object in a win32 environment, please.

The Object can only be some sort of a data repository (remote drive, share, file or folder). Does this require me to code the script to run as service? Would I need service accounts set-up since I will be monitoring a number of remote servers?

I am sure I have came across a script somewhere that does what I need, but I just canít remember where. I would appreciate if anyone knows of such code or have tackled something similar and can point me to the right direction.

  • Comment on constantly monitoring the size of an object

Replies are listed 'Best First'.
Re: constantly monitoring the size of an object
by BrowserUk (Pope) on Sep 02, 2003 at 20:11 UTC

    Look a Win32::ChangeNotify

    Also try a super search for "AdvNotify" and/or FileSystemObject. There were several recent threads on this.

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.

Re: constantly monitoring the size of an object
by hardburn (Abbot) on Sep 02, 2003 at 19:38 UTC

    You don't actually need it to be a service. You can just run the monitoring portion in an infinte loop:

    while(1) { my $result = monitor_object(); display_result($result); }

    Though I suspect making it a service will make your monitoring script use less system resources.

    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Re: constantly monitoring the size of an object
by Limbic~Region (Chancellor) on Sep 02, 2003 at 19:48 UTC
    The following is stolen from Elian's homenode, I think it should get you started.

    Curious about how big your variables or data structures are? Try Devel::Size

    Cheers - L~R

    Update: As Elian pointed out, I am an idiot. Since you have already answered your own question there is nothing more I can do but watch the downvotes ;-)

      Nope. Devel::Size shows the size of a perl object. The OP wants to monitor the size of a Windows object, and those are external to the program. (They're things like files and directories)
        Ok - so I was reading your blog this morning and had you on the brain (in a purely Perl way). Thanks for squaring that away - my eyes don't seem to work right anymore - vacation is a terrible thing.

        Cheers - L~R

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://288399]
Approved by gjb
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2021-09-25 06:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found