On Thu, Oct 17, 2002 at 01:29:59AM -1000, Beau E. Cox wrote:

> Hi -
> 
> I don't think so...
> 
> Of course you can write a perl preprocessor in perl...
> 
> or, what about some open source preprocessor?
> 
> Aloha => Beau.

If you want the C preprocessor, check out the -P option to Perl.  But
I'd suggest that is not a good solution to most problems.

> Hi,
> 
>  in C:
> #ifndef __DEBUG__
> #define MYD(x) x
> #else
>  #define MYD(x)
> #endif
> 
> and in perl ?
> 
> (the question being: how can I do macros within perl, and how can I pass
> "things" to the perl interpreter? )
> 
> or is there any other approach to this ?

The approach is usually something like

  if ($Debug)
  {
  }

or

  print "Everything's fine up to here: ", Dumper $data if $Debug;

If you're concerned about performance and want to leave your debugging
code in place:

  sub Debug () { 1 }

  if (Debug)
  {
  }

This will allow your debugging code to be optimised away if you set the
debugging value to something false.

You can then get more complicated if you need too.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to