Re: Perl scripts
Theo Schlossnagle <[email protected]> Fri, 23 Jun 2006 14:52:35 -0400
| Newsgroups | gmane.comp.apache.mod-wackamole.general |
|---|---|
| Message-ID | <[email protected]> |
On Jun 23, 2006, at 12:16 PM, Ian Eiloart wrote: > Hi, > > I'm trying to use the embedded perl interpreter in wackamole to > reconfigure my services when an VIF comes up. I want to start an > instance of Exim smtp server listening on port 25 on the newly > acquired IP address, but only for certain addresses. > > I've managed to get a perl function logging to syslog, but I don't > see how to work out what the new IP address is. Does the perl > function get called with any parameters? Is there a way to do that? > If not, is there another way of deciding which interfaces just came > up? It isn't doc'd. check in perl.c: you get three arguments: (1) hash ref with the psuedo interface that was affected. (2) an array ref of hashrefs of the extra interfaces associated with it (3) hash ref with the real interface that was affected. These are complicated to explain, I suggest Dumper'ing them to see what you get first -- it might be obvious at that point. > I'm using MacOSX 10.4 with this config: > > # Named socket for online control > Control = /var/run/wack.it > PerlUseLib /opt/local/etc/ > PerlUse wackamole > RunDynamic wackamole::mysub on up > > mysub just prints a string to syslog. I tried to capture arguments > passed to mysub by dumping $_ into the string, but couldn't make > any sense of the output. That could be my perl ignorance, though. use Data::Dumper; print LOGFILE Dumper(\@_); // Theo Schlossnagle // CTO -- http://www.omniti.com/~jesus/ // OmniTI Computer Consulting, Inc. -- http://www.omniti.com/ // Ecelerity: Run with it.