[NeoStats-Devel] [Commits] r2843 - trunk/modules/perltest
[email protected] Thu, 29 Sep 2005 16:02:56 +1000
| Newsgroups | gmane.comp.neostats.devel |
|---|---|
| Message-ID | <[email protected]> |
Author: Fish
Date: Thu Sep 29 14:02:50 2005
New Revision: 2843
Modified:
trunk/modules/perltest/Makefile.am
trunk/modules/perltest/Makefile.in
trunk/modules/perltest/main.c
Log:
more Perl Extension support code.
Modified: trunk/modules/perltest/Makefile.am
==============================================================================
--- trunk/modules/perltest/Makefile.am (original)
+++ trunk/modules/perltest/Makefile.am Thu Sep 29 14:02:50 2005
@@ -1,5 +1,5 @@
pkglib_LTLIBRARIES = perlexttest.la
perlexttest_la_SOURCES = main.c
perlexttest_la_LDFLAGS = -module -avoid-version
-AM_CFLAGS = @PCRE_CFLAGS@ @CURL_CFLAGS@
+AM_CFLAGS = @PCRE_CFLAGS@ @CURL_CFLAGS@ @PERL_CFLAGS@
include $(top_srcdir)/autotools/rules.mk
Modified: trunk/modules/perltest/Makefile.in
==============================================================================
--- trunk/modules/perltest/Makefile.in (original)
+++ trunk/modules/perltest/Makefile.in Thu Sep 29 14:02:50 2005
@@ -211,7 +211,7 @@
pkglib_LTLIBRARIES = perlexttest.la
perlexttest_la_SOURCES = main.c
perlexttest_la_LDFLAGS = -module -avoid-version
-AM_CFLAGS = @PCRE_CFLAGS@ @CURL_CFLAGS@
+AM_CFLAGS = @PCRE_CFLAGS@ @CURL_CFLAGS@ @PERL_CFLAGS@
LINK = $(LIBTOOL) --tag=CXX --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
Modified: trunk/modules/perltest/main.c
==============================================================================
--- trunk/modules/perltest/main.c (original)
+++ trunk/modules/perltest/main.c Thu Sep 29 14:02:50 2005
@@ -26,8 +26,11 @@
*/
#include "neostats.h" /* NeoStats API */
+#define PERLDEFINES
+#include "perlmod.h"
static Bot *perl_bot;
+static int perlext_pong (CmdParams *cmds);
const char* perl_copyright[] =
{
@@ -95,9 +98,20 @@
0,
};
+XS (XS_NeoStats_Test_PerlExt)
+{
+ dXSARGS;
+ if(items != 1) {
+ nlog(LOG_WARNING, "Didn't get required no of params for TestPerlExt Call");
+ } else {
+ irc_chanalert(perl_bot, "TestPerlExt Got this: %s", SvPV_nolen(ST(0)));
+ }
+}
+
static void
perl_ext_init() {
-printf("called extension init");
+ newXS("NeoStats::PerlExt::TestPerlExt", XS_NeoStats_Test_PerlExt, __FILE__);
+ nlog(LOG_INFO, "Loaded Perl Extensions Hooks");
}
@@ -115,7 +129,7 @@
} else {
return NS_FAILURE;
}
-
+ execute_perl(GET_CUR_MODULE(), sv_2mortal (newSVpv ("NeoStats::Module::extension_2eple::TestCall", 0)), 1, "Hello World");
return NS_SUCCESS;
}
@@ -182,6 +196,7 @@
*/
ModuleEvent module_events[] =
{
+ {EVENT_PONG, perlext_pong },
NS_EVENT_END()
};
@@ -233,3 +248,10 @@
{
return NS_SUCCESS;
}
+
+static int
+perlext_pong (CmdParams *cmds) {
+ irc_chanalert(perl_bot, "Got Pong fromm %s", cmds->source->name);
+
+}
+