Sunday, July 15, 2012

My Girl

The warmth, the smell, the touch
The kiss, The cuddle and the talk
She makes me feel alive
She makes me feel good

The courage, the confidence, the smile
The conduct, the style and the face
She helps me clear my head
She helps me feel confident

The smart, the sweet, the cute
The hot, The bad and the sexy
She makes me feel my manhood
She makes me what I am

The sad, the hate, the worries
The cry, The weak and the sob
She helps me understand the world
She helps me know my limits

The pain, the remorse, the mistakes
The regret, the past and the failures
She makes me forgive everything
She makes me learn from it

The dark, the fear, the unknown
The ghosts, the demons and the devils
She helps me stay alert
She helps me be inquisitive

The lessons, the experience, the feelings
The care, the affection and the love
She has given me everything
That I will live my life with her, for her, only her

Tuesday, July 3, 2012

perl - Identifying who is loading a module

So far I was under the impression that it is difficult to identify who is loading a module since all the use statements are executed even before the debugger prompt appears on the terminal.
Ref: http://perldoc.perl.org/perlmod.html#BEGIN%2c-UNITCHECK%2c-CHECK%2c-INIT-and-END

One can setup a break point when a module is loaded by another module.
b load GT/A.pm # this will set a breakpoint on module load of A.pm

But since use statements are evaluated much before the debug prompt appears on the terminal, we will not be able to identify who has actually loaded the module.

However, we can identify the same via a workaround as follows:

1. Start the debugger
2. set a breakpoint on load of a module (eg: b load GT/A.pm)
3. R # This will restart the debugger session - however, the debug point will be retained
4. T # see the stack trace to identify who is trying to load the module


I will upload the script and module used to experiment this, shortly. Meanwhile, one can take a look at the demonstration of this hack below.


ganesathandavamponnuraj@GT-MBP.local:DebugModuleLoad:>>perl -d useAB.pl

Loading DB routines from perl5db.pl version 1.3
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

A BEGIN
A static
A method print
B BEGIN
B static
B method print
Inside BEGIN block
main::(useAB.pl:8): print "Before function call\n";
  DB<1> b load GT/A.pm
Will stop on load of `GT/A.pm'.
  DB<2> R
Warning: some settings and command-line options may be lost!

Loading DB routines from perl5db.pl version 1.3
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

A BEGIN
'GT/A.pm' loaded...
GT::A::CODE(0x825600)(GT/A.pm:8): print "A static\n";
  DB<2> T
$ = require 'GT/A.pm' called from file `useAB.pl' line 1
$ = main::BEGIN() called from file `GT/A.pm' line 0
$ = eval {...} called from file `GT/A.pm' line 0
  DB<2>