Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: organizing large flat modules? use, require, do, ...

by jaldhar (Vicar)
on Jan 12, 2004 at 19:38 UTC ( #320737=note: print w/ replies, xml ) Need Help??

in reply to organizing large flat modules? use, require, do, ...

I know Perl doesn't have an #include directive.

Sure it does. the -P flag to perl runs the code through cpp first. Here's a quick example:

#!/usr/bin/perl -Pw use strict; #define CHOICE 1 print "Hey look! I'm", #ifndef CHOICE ' not', #endif " using the C preprocessor.\n"; # Here is an example of #include. my $passwd = <<'-PASSWD-'; #include "/etc/passwd" -PASSWD- print "Here is /etc/passwd: $passwd\n";

note -P can have problems distinguishing between preprocessor directives and perl comments. Also I don't know how well it works on non-Unix platforms where cpp might be missing. All in all it's a poor solution to your problem but it's there if you do need to us it.


Comment on Re: organizing large flat modules? use, require, do, ...
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://320737]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2015-11-26 13:21 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (699 votes), past polls