For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > September 2007 > How to use pragmas into the caller of a module?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to use pragmas into the caller of a module?
Marcio Faustino

2007-09-15, 10:00 pm

Hi,

How can I make a module that automatically uses pragmas (like
"strict", "utf8" and "warnings") into the caller of a module? For
example, being able to do this:

use Pragmas; # "use strict", "use utf8", "use warnings"
$var = 123;

and making perl complain about $var not being declared?
Thanks!

Paul Lalli

2007-09-15, 10:00 pm

On Sep 15, 5:06 pm, m.faust...@gmail.com (Marcio Faustino) wrote:
> Hi,
>
> How can I make a module that automatically uses pragmas (like
> "strict", "utf8" and "warnings") into the caller of a module? For
> example, being able to do this:
>
> use Pragmas; # "use strict", "use utf8", "use warnings"
> $var = 123;
>
> and making perl complain about $var not being declared?


I would be surprised if you can (though I don't know for sure that you
can't). Pragmas are lexically scoped.

You could try a source filter, maybe?
http://search.cpan.org/~dconway/Fil...ilter/Simple.pm

Paul Lalli

Marcio Faustino

2007-09-16, 7:59 am

Thanks, that'll work.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com