> use Make;
> $CFLAGS = "-O -g";
> $OBJS = "main.o frob.o";
> $LIBS = "-lreadline";
> rule "frob", $OBJS, sub {
> system "$CC $CFLAGS $OBJS -o frob $LIBS";
> };
> make;
OK, point to perl. How would you manipulate something like:
event_wait {
{control $door close} {
signal $alarm "Door $door closed"
}
{control $door open} {
signal $alarm "Door $door opened"
}
}
Easy enough, but now you want to add user-defined events to the end of
this structure:
set default_event_list {
{control $door close} {
signal $alarm "Door $door closed"
}
{control $door open} {
signal $alarm "Door $door opened"
}
}
set event_list $default_event_list
Then later
lappend event_list {
{control $door open} {
set last_event [list $door opened]
}
}
event_wait $event_list
Sometimes it's convenient to add stuff at random times, even
algorithmically, within a consistent syntax.
I will readily admit that this example could probably be done other ways,
such as creating a word to build an event table and assembling it by hand.
I'm just curious how Perl would resolve the above example.
> runoff qq{
^^--- could you explain this?
-- Peter da Silva `-_-' Network Management Technology Incorporated 'U` 1601 Industrial Blvd. Sugar Land, TX 77478 USA +1 713 274 5180 "Hast Du heute schon Deinen Wolf umarmt?"