Skip to content

Instantly share code, notes, and snippets.

@sycobuny
Created August 22, 2012 18:06
Show Gist options
  • Save sycobuny/3428012 to your computer and use it in GitHub Desktop.
Save sycobuny/3428012 to your computer and use it in GitHub Desktop.
Demonstrating a method for breaking long lines
package POE::Component::dns::monitor::sniffer;
use POE;
use warnings;
use strict;
sub spawn {
my ($session) = POE::Session->create(
inline_states => {
_start => sub {
print "hi " . $_[SESSION]->ID . "\n @{[join(', ', @_)]}\n"
},
_stop => sub {
print "bye " . $_[SESSION]->ID . "\n @{[join(', ', @_)]}"
},
},
);
print "session: $session\n";
$session;
}
package main;
foreach (1..2) {
POE::Component::dns::monitor::sniffer->spawn();
}
POE::Kernel->run();
1;
package POE::Component::dns::monitor::sniffer;
use POE;
use warnings;
use strict;
sub spawn {
my ($session) = POE::Session->create(
inline_states => {
_start => sub { print "hi " . $_[SESSION]->ID . "\n @{[join(', ', @_)]}\n" },
_stop => sub { print "bye " . $_[SESSION]->ID . "\n @{[join(', ', @_)]}" },
},
);
print "session: $session\n";
$session;
}
package main;
foreach (1..2) {
POE::Component::dns::monitor::sniffer->spawn();
}
POE::Kernel->run();
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment