From 42e4d2b23759185fa0d32decab19c95614e91e03 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sun, 9 Jan 2011 21:46:51 +0000 Subject: some dirty hacks to make the package appear as an internal module, LeoNerd++ --- feature-tests/format-test.pl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'feature-tests/format-test.pl') diff --git a/feature-tests/format-test.pl b/feature-tests/format-test.pl index d8be412..2c99d50 100644 --- a/feature-tests/format-test.pl +++ b/feature-tests/format-test.pl @@ -14,13 +14,21 @@ our %IRSSI = ( license => 'Public Domain', ); -init(); +sub actually_printformat { + my ($win, $level, $module, $format, @args) = @_; + { + # deeeeeeep black magic. + local *CORE::GLOBAL::caller = sub { $module }; + $win->printformat($level, $format, @args); + } -sub init { - Irssi::command_bind('ft', \&format_test); } +init(); + +sub init { + my $win = Irssi::active_win(); + actually_printformat($win, Irssi::MSGLEVEL_CLIENTCRAP, 'fe-common/irc', + "kill_server", "foo", "bar", "horse", "cake"); -sub format_test { - my ($args, $win, $server) = @_; } -- cgit v1.2.3 From d285e7854dfc62c213bec4c101eaf080fa81ac46 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Wed, 12 Jan 2011 00:10:16 +0000 Subject: pipes: added an example feature test on how to use pipes for non-blocking IO. Hope to expand it to include network IO at some point. --- feature-tests/format-test.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'feature-tests/format-test.pl') diff --git a/feature-tests/format-test.pl b/feature-tests/format-test.pl index 2c99d50..7a38d9f 100644 --- a/feature-tests/format-test.pl +++ b/feature-tests/format-test.pl @@ -3,7 +3,7 @@ use warnings; use Irssi; - +use Data::Dumper; our $VERSION = '0.1'; our %IRSSI = ( @@ -16,19 +16,24 @@ our %IRSSI = ( sub actually_printformat { my ($win, $level, $module, $format, @args) = @_; + my $ret = ''; { # deeeeeeep black magic. local *CORE::GLOBAL::caller = sub { $module }; $win->printformat($level, $format, @args); - } + $ret = Irssi::current_theme()->get_format($module, $format); + } + return $ret; } init(); sub init { my $win = Irssi::active_win(); - actually_printformat($win, Irssi::MSGLEVEL_CLIENTCRAP, 'fe-common/irc', - "kill_server", "foo", "bar", "horse", "cake"); + my $moo = actually_printformat($win, Irssi::MSGLEVEL_CLIENTCRAP, 'fe-common/irc', + "kill_server", "foo", "bar", "horse", "cake"); + + print Dumper($moo); } -- cgit v1.2.3