[tpm] how to conditional compile
Indy Singh
indy at indigostar.com
Fri Nov 27 19:18:45 PST 2009
How about making your service routines into an object? At runtime you
could set an object pointer to one of two different classes.
Indy Singh
IndigoSTAR Software -- www.indigostar.com
----- Original Message -----
From: <arocker at vex.net>
To: "TPM" <tpm at to.pm.org>
Sent: Friday, November 27, 2009 6:54 PM
Subject: Re: [tpm] how to conditional compile
> How about using references?
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my $name;
>
> if (@ARGV) {
> $name = \suba();
> }
> else {
> $name = \subb();
> }
> my $x = $name;
>
> sub suba {
> print "I'm a Mac\n";
> }
>
> sub subb {
> print "I'm a PC\n";
> }
> # subs Ends
>
> It should be obvious how to test this.
--------------------------------------------------------------------------------
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>
More information about the toronto-pm
mailing list