Re: Programmatically compiling (perl -c) a Perl file

Michael Ludwig <[email protected]>
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <20100806184900.GJ1060@wladimir>
p sena schrieb am 06.08.2010 um 08:54 (-0700):
> It also depends on how you declare the globals in the file and how you
> use them in another file from where you require the first file.
> Use strict and warnings enabled or are they already have it or not ?
> if not how are the compiled results and if yes how are they?

Thanks once more, P Sena. Here's the situation some of the files are in:

          \,,,/
          (o o)
------oOOo-(_)-oOOo------
michael@wladimir:~ :-) cat a.pl
use strict;
use vars '$x';
$x = 1;
require 'b.pl';
bla();
michael@wladimir:~ :-) cat b.pl
use strict;
sub bla { print ++$x, "\n" }
1;
michael@wladimir:~ :-) perl a.pl
2
michael@wladimir:~ :-) perl -c b.pl
Global symbol "$x" requires explicit package name at b.pl line 2.
b.pl had compilation errors.
-------------------------

That's pretty bad, and obviously it cannot stay like this. There's lots
of other things to do, but getting individual files to pass a simple
perl -c test is my first priority.

I guess my interest in possible compiler options is rather theoretical.
I can achieve what I want with what I already know.

> Generate a kind of test frame so as to write and execute test scripts
> for each perl file  from within the framework. These individual test
> scripts would comprise of various test cases/scenarios.

Test::More plus File::Find plus perl -c, for starters.

> Formulate the case/scenarios such that it tests all scenes whetrein
> some globals gets used and sometimes not used may be.

Yeah. I hope to eliminate most of the globals.

> Also, in same lines the scenarios where at  run time one file is
> required at times and not required sometimes.
> Take look at do and eval from perldoc and see if it helps somewhere
> from a to z. The globals much in question, can be taken care from each
> individual test script and similar other things if exists.
> There may be more than one test script corresponding to a perl file
> (original perl program to be tested). This can be done sequentally or
> parallely and depends on situations. RUn framework and
> observer/collect results/reports...

Thanks for your suggestions, much appreciated!

Best,
-- 
Michael Ludwig
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.