Hi there,

I may be beating a dead horse here, but you can easily extract stuff out
of the POD at runtime with Pod::Constants;

our $number;
use Pod::Constants
    'THE MAGIC NUMBER' => sub { ($number) = m/(\d+)/ };

=head2 THE MAGIC NUMBER

There is a magic number, that number is 42.  

=cut

As you can see, the sub passed to Pod::Constant's import() function is a
closure that is passed all of the POD until the next command in $_.  You
can also give a reference to a hash, array or scalar, and slightly
different behaviour occurs.

I've found that using this I can avoid a fair amount of code duplication
and distill key coding concepts into a minimal number of places through my
work.

It's a long shot from elisp's method of tying of documentation and code
into the same data structure, but I never really liked that anyway.

On Sun, 3 Feb 2002 10:58:00 -0500
"Jay Lawrence" <[EMAIL PROTECTED]> wrote:

> Hi Michael,
> 
> I just had a quick look at your module - looks cool! I'll give this a
whirl> sometime soon.
> 
> On a tangential note - something I've been bringing up here 'n there is
the> notion that it would be really interesting if classes would supply
this and> more class/module-related info. In other words - runtime
documentation.> Method to return list of properties or methods in a class.
Method to return> detailed information about a property. We do this and we
can make the> creation of much more interesting run-time environments
easier.> 
> Really its just a case if a module wishes to offer run-time
documentation> they would have a few well known methods/functions. The
issue is deciding> and making those functions well known. :) I've
mentioned this briefly on the> POOP list and I see that P2EE might be
related (but they've got bigger> things on the - go I fear). I've thought
about maybe tying this to the> module's POD by looking to to a POD filter
thus saving duplication of> effort - but maybe introducting some influence
on how methods, etc. are> documented in POD.
> 
> Is ths something that you or others think about or ponder?
> 
> Regards,
> Jay
> 
> ----- Original Message -----
> From: "Michael G Schwern" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Saturday, February 02, 2002 5:15 PM
> Subject: [ANNOUNCE] Module::Info 0.11
> 
> 
> > http://www.pobox.com/~schwern/src/Module-Info-0.11.tar.gz
> >
> > Didn't get quite as far as I'd hoped, but I got the hard part's done.
> >
> > The interesting bit is you can now find every function and method call
> > in a program (I just realized I'm not handling function calls with
> > symbolic refs quite right, will fix), the line its on, etc.... see
> > subroutines_called().
> >
> > superclasses() is actually a really dirty cheat and I have to spruce
> > it up some.
> >
> > Some users were reporting silent failures in the last few versions.
> > I've made failures much more noisy so we'll see if that can be worked
> > out.
> >
> >
> > 0.11  Sat Feb  2 16:54:23 EST 2002
> >     * Fixed B::Utils->kids
> >     * Added subroutines_called()
> >     * Added superclasses()
> >     * Added dynamic_method_calls()
> >     - Documented that it isn't just for modules.
> >     - name() can now be used to set
> >     - failures inside B::Module::Info now report their errors instead
of> >       failing silently
> >     * Added a THANKS section.
> >
> > 0.10  Wed Dec 12 05:40:14 EST 2001
> >     * Windows filenames would cause subroutines() and modules_used()
to> >       choke. (Thanks to Alessandro Forghieri for the patch)
> >
> >
> > --
> >
> > Michael G. Schwern   <[EMAIL PROTECTED]>   
http://www.pobox.com/~schwern/> > Perl Quality Assurance    
<[EMAIL PROTECTED]>        Kwalitee Is Job One> > Let me check my notes.
> > http://www.sluggy.com
> >
> 
> 
> 

Reply via email to