---------- Forwarded message ----------
From: Charles Colbourn <charles.colbo...@googlemail.com>
Date: 7 October 2010 10:10
Subject: Re: Module naming - Test::Import::DontRun
To: ebhans...@cpan.org


@Eirik

>>
>> There's some complex and potentially slightly
>> fragile stuff to handle @EXPORT if you want to, but the basic case
>> works pretty well.
>
>   Whoops.  What would your legacy script(?) use @EXPORT for?

Some of the code I'm testing in our own legacy codebase includes
modules that 'do things' when use'd or require'd, and also export
methods via @EXPORT. My code attempts to handle this by duplicating
the @EXPORT* declarations outside the anonymous scope. It does this
simply by parsing the code and finding the appropriate strings. You
can switch this behaviour off if need be, although I'm tempted to make
it default to 'off' since it may not be as robust as the rest.


>
>   (I'd be more concerned about __END__, __DATA__, __FILE__, and __LINE__.
> Okay, the latter two could be handled with a #line directive, but to handle
> the first two right, it seems you'd have to parse Perl ... or drop the {}s?)
>
Eirik++ I'd overlooked those. I'll see what I can do with it, write
some test cases etc.


@Nadim

"OK, I get what you want to do. I have seen this before. My brains being what
they are lately, I don't remember where but it was not so long ago. Maybe Andy
maybe someone else. Maybe even you ;)

So before you go further, you can, if you so wish, look around a bit."

I've had a dig around CPAN, and sifted through 'Perl testing, a
developers notebook' and not found anything. I think I did bandy this
idea around about 6 months ago, but the version I had then depended on
modifying the legacy code, and was a glorified version of:
{
if (caller()){last}
#code
}

So perhaps that was it? I don't think I posted here about it, but I
may have mentioned it in the CB on Perlmonks, and I definitely floated
the idea past a couple of people. OTOH if there's something around
that does this already, that would save me some work :-)

Reply via email to