http://www.perlmonks.org?node_id=432987

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

I'm currently using Doxygen which creates a .pm file that looks like this:
$doxydocs= { classes => [ ], namespaces => [ ], files => [ { name => 'agc_1fs.hdf.c', includes => [ ...
These are the first 10 lines, so there is no package declaration or anything.

How do i get to it's $doxydocs variable in a strict and warnings enabled way?

Replies are listed 'Best First'.
Re: use dirty .pm
by PodMaster (Abbot) on Feb 21, 2005 at 10:35 UTC
    How do i get to it's $doxydocs variable in a strict and warnings enabled way?
    You require the file as usual, but before you do, you predeclare the variable(s), namely $doxydocs, using vars or our.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: use dirty .pm
by betterworld (Curate) on Feb 21, 2005 at 10:23 UTC
    The only solution I can think of is something like
    use strict; use warnings; my $doxydocs = do "dirty.pm";
      If i do that, $doxydocs contains the value "1", and i still can't access the data. Even when i do this:
      my $a = do "$ARGV[0]/DoxyDocs.pm"; print Dumper($doxydocs), "\n";
      I get the error that $doxydocs is empty.
        In your example, $doxydocs is in fact empty, but $a is not. Try print Dumper($a)."\n";