[Israel.pm] Access control/usage log for a package

Shmuel Fomberg semuelf at 012.net.il
Tue Oct 24 14:53:29 PDT 2006


Hello There.

Thanks, I think that this is exactly what I was looking for. 
I didn't thank you for the PadWalker that you wrote about last week.
It's a killer module too.

I'm doing this for debugging. Wanted to map how a program use some
modules. Maybe I'll use profiling tools and will be over with this.

Good night,
Shmuel.

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Gaal Yahas
Sent: Tuesday, October 24, 2006 7:09 AM
To: Perl in Israel
Subject: Re: [Israel.pm] Access control/usage log for a package

On Tue, Oct 24, 2006 at 01:27:16AM +0200, Shmuel Fomberg wrote:
> I am looking at making an access logging tool for a package.
> Meaning that I want to log every subroutine call for this package and
in
> the package.
> My idea is to iterate on the symbol table of the package, and to put
an
> anonymous function
> Instead of every function. (that calls that function, after logging
the
> access)

Wrapping every function is certainly one way to do it, but if you use
AOP you get nice declarative syntax and someone else to do the dirty
work for you:

    http://search.cpan.org/dist/Aspect/

The greatest thing about AOP is that the intrusion on your existing code
is minimal: you define what you want to do for a certain purpose
(logging,
invariant assertion, security) in one place. Ran is the maintainer of
that module and has given a great talk on it in YAPC a few years back.

> Do you have better idea?
> Any idea how can I log variable access?

If you have an opportunity to tie some of them, try that. If you want
lexicals, it becomes much harder.

Do you need this stuff for debugging or for production use? Look into
the various trace modes of the debugger, they might do the job for you
too.

-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl


-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.11/494 - Release Date:
24/10/2006





More information about the Perl mailing list