Index: perlglue.xs
===================================================================
--- perlglue.xs	(revision 19bab8e06c354655085dfcac4d3a07b10bb01c36)
+++ perlglue.xs	(revision 5d2248c62dd7715238ac8948f05c0b8fd2963856)
@@ -24,8 +24,8 @@
 	 * complex argument processing or something, we define a
 	 * simple version here that takes arguments in as flat a
-	 * manner as possible, to simplify the XS code, with a name
-	 * with a trailing `_internal', and write a perl wrapper in
-	 * perlwrap.pm that munges the arguments as appropriate and
-	 * calls the internal version.
+	 * manner as possible, to simplify the XS code, put it in
+	 * BarnOwl::Intenal::, and write a perl wrapper in perlwrap.pm
+	 * that munges the arguments as appropriate and calls the
+	 * internal version.
 	 */
 
@@ -143,6 +143,193 @@
 		if (rv) owl_free(rv);
 
-void
-new_command_internal(name, func, summary, usage, description)
+void queue_message(msg) 
+	SV *msg
+	PREINIT:
+		owl_message *m;
+	CODE:
+	{
+		if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) {
+			croak("Usage: BarnOwl::queue_message($message)");
+		}
+
+		m = owl_perlconfig_hashref2message(msg);
+
+		owl_global_messagequeue_addmsg(&g, m);
+	}
+
+void admin_message(header, body) 
+	char *header
+	char *body
+	CODE:
+	{
+		owl_function_adminmsg(header, body);		
+	}
+
+void start_question(line, callback)
+	char *line
+	SV *callback
+	PREINIT:
+	CODE:
+	{
+		if(!SV_IS_CODEREF(callback))
+			croak("Callback must be a subref");
+
+		owl_function_start_question(line);
+
+		SvREFCNT_inc(callback);
+		owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
+		owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
+	}
+
+void start_password(line, callback)
+	char *line
+	SV *callback
+	PREINIT:
+	CODE:
+	{
+		if(!SV_IS_CODEREF(callback))
+			croak("Callback must be a subref");
+
+		owl_function_start_password(line);
+
+		SvREFCNT_inc(callback);
+		owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
+		owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
+	}
+
+void start_edit_win(line, callback)
+	char *line
+	SV *callback
+	PREINIT:
+		owl_editwin * e;
+		char buff[1024];
+	CODE:
+	{
+		if(!SV_IS_CODEREF(callback))
+			croak("Callback must be a subref");
+
+		e = owl_global_get_typwin(&g);
+		owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE,
+				      owl_global_get_msg_history(&g));
+		owl_editwin_clear(e);
+		owl_editwin_set_dotsend(e);
+		snprintf(buff, 1023, "----> %s\n", line);
+		owl_editwin_set_locktext(e, buff);
+
+		owl_global_set_typwin_active(&g);
+
+		SvREFCNT_inc(callback);
+		owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
+		owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
+	}
+
+
+char * 
+get_data_dir ()
+	CODE:
+		RETVAL = (char *) owl_get_datadir();
+	OUTPUT:
+	RETVAL
+
+char * 
+get_config_dir ()
+	CODE:
+		RETVAL = (char *) owl_global_get_confdir(&g);
+	OUTPUT:
+	RETVAL	
+
+void
+popless_text(text) 
+	char *text
+	CODE:
+	{
+		owl_function_popless_text(text);
+	}
+
+void
+popless_ztext(text) 
+	char *text
+	CODE:
+	{
+		owl_fmtext fm;
+		owl_fmtext_init_null(&fm);
+		owl_fmtext_append_ztext(&fm, text);
+		owl_function_popless_fmtext(&fm);
+		owl_fmtext_free(&fm);
+	}
+
+void
+error(text) 
+	char *text
+	CODE:
+	{
+		owl_function_error("%s", text);
+	}
+
+void
+create_style(name, object)
+     char *name
+     SV  *object
+     PREINIT:
+		owl_style *s;
+     CODE:
+	{
+		s = owl_malloc(sizeof(owl_style));
+		owl_style_create_perl(s, name, object);
+		owl_global_add_style(&g, s);
+	}
+
+int
+getnumcolors()
+	CODE:
+		RETVAL = owl_function_get_color_count();
+	OUTPUT:
+		RETVAL
+
+void
+_remove_filter(filterName)
+	char *filterName
+	CODE:
+	{
+		/* Don't delete the current view, or the 'all' filter */
+		if (strcmp(filterName, owl_view_get_filtname(owl_global_get_current_view(&g)))
+		    && strcmp(filterName, "all")) {
+			owl_global_remove_filter(&g,filterName);
+		}
+	}
+
+char *
+wordwrap(in, cols)
+	char *in
+	int cols
+	PREINIT:
+		char *rv = NULL;
+	CODE:
+		rv = owl_text_wordwrap(in, cols);
+		RETVAL = rv;	
+	OUTPUT:
+		RETVAL
+	CLEANUP:
+		if (rv) owl_free(rv);
+
+void
+add_dispatch(fd, cb)
+	int fd
+	SV * cb
+	CODE:
+        SvREFCNT_inc(cb);
+	owl_select_add_perl_dispatch(fd, cb);
+
+void
+remove_dispatch(fd)
+	int fd
+	CODE:
+	owl_select_remove_perl_dispatch(fd);
+
+MODULE = BarnOwl		PACKAGE = BarnOwl::Internal
+
+
+void
+new_command(name, func, summary, usage, description)
 	char *name
 	SV *func
@@ -174,176 +361,6 @@
 	   }
 
-void queue_message(msg) 
-	SV *msg
-	PREINIT:
-		owl_message *m;
-	CODE:
-	{
-		if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) {
-			croak("Usage: BarnOwl::queue_message($message)");
-		}
-
-		m = owl_perlconfig_hashref2message(msg);
-
-		owl_global_messagequeue_addmsg(&g, m);
-	}
-
-void admin_message(header, body) 
-	char *header
-	char *body
-	CODE:
-	{
-		owl_function_adminmsg(header, body);		
-	}
-
-void start_question(line, callback)
-	char *line
-	SV *callback
-	PREINIT:
-	CODE:
-	{
-		if(!SV_IS_CODEREF(callback))
-			croak("Callback must be a subref");
-
-		owl_function_start_question(line);
-
-		SvREFCNT_inc(callback);
-		owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
-		owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
-	}
-
-void start_password(line, callback)
-	char *line
-	SV *callback
-	PREINIT:
-	CODE:
-	{
-		if(!SV_IS_CODEREF(callback))
-			croak("Callback must be a subref");
-
-		owl_function_start_password(line);
-
-		SvREFCNT_inc(callback);
-		owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
-		owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
-	}
-
-void start_edit_win(line, callback)
-	char *line
-	SV *callback
-	PREINIT:
-		owl_editwin * e;
-		char buff[1024];
-	CODE:
-	{
-		if(!SV_IS_CODEREF(callback))
-			croak("Callback must be a subref");
-
-		e = owl_global_get_typwin(&g);
-		owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE,
-				      owl_global_get_msg_history(&g));
-		owl_editwin_clear(e);
-		owl_editwin_set_dotsend(e);
-		snprintf(buff, 1023, "----> %s\n", line);
-		owl_editwin_set_locktext(e, buff);
-
-		owl_global_set_typwin_active(&g);
-
-		SvREFCNT_inc(callback);
-		owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback);
-		owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback);
-	}
-
-
-char * 
-get_data_dir ()
-	CODE:
-		RETVAL = (char *) owl_get_datadir();
-	OUTPUT:
-	RETVAL
-
-char * 
-get_config_dir ()
-	CODE:
-		RETVAL = (char *) owl_global_get_confdir(&g);
-	OUTPUT:
-	RETVAL	
-
-void
-popless_text(text) 
-	char *text
-	CODE:
-	{
-		owl_function_popless_text(text);
-	}
-
-void
-popless_ztext(text) 
-	char *text
-	CODE:
-	{
-		owl_fmtext fm;
-		owl_fmtext_init_null(&fm);
-		owl_fmtext_append_ztext(&fm, text);
-		owl_function_popless_fmtext(&fm);
-		owl_fmtext_free(&fm);
-	}
-
-void
-error(text) 
-	char *text
-	CODE:
-	{
-		owl_function_error("%s", text);
-	}
-
-void
-create_style(name, object)
-     char *name
-     SV  *object
-     PREINIT:
-		owl_style *s;
-     CODE:
-	{
-		s = owl_malloc(sizeof(owl_style));
-		owl_style_create_perl(s, name, object);
-		owl_global_add_style(&g, s);
-	}
-
-int
-getnumcolors()
-	CODE:
-		RETVAL = owl_function_get_color_count();
-	OUTPUT:
-		RETVAL
-
-void
-_remove_filter(filterName)
-	char *filterName
-	CODE:
-	{
-		/* Don't delete the current view, or the 'all' filter */
-		if (strcmp(filterName, owl_view_get_filtname(owl_global_get_current_view(&g)))
-		    && strcmp(filterName, "all")) {
-			owl_global_remove_filter(&g,filterName);
-		}
-	}
-
-char *
-wordwrap(in, cols)
-	char *in
-	int cols
-	PREINIT:
-		char *rv = NULL;
-	CODE:
-		rv = owl_text_wordwrap(in, cols);
-		RETVAL = rv;	
-	OUTPUT:
-		RETVAL
-	CLEANUP:
-		if (rv) owl_free(rv);
-
-void
-new_variable_string_internal(name, ival, summ, desc)
+void
+new_variable_string(name, ival, summ, desc)
 	char * name
 	char * ival
@@ -358,5 +375,5 @@
 
 void
-new_variable_int_internal(name, ival, summ, desc)
+new_variable_int(name, ival, summ, desc)
 	char * name
 	int ival
@@ -371,5 +388,5 @@
 
 void
-new_variable_bool_internal(name, ival, summ, desc)
+new_variable_bool(name, ival, summ, desc)
 	char * name
 	int ival
@@ -382,16 +399,2 @@
 				      desc,
 				      ival);
-
-void
-add_dispatch(fd, cb)
-	int fd
-	SV * cb
-	CODE:
-        SvREFCNT_inc(cb);
-	owl_select_add_perl_dispatch(fd, cb);
-
-void
-remove_dispatch(fd)
-	int fd
-	CODE:
-	owl_select_remove_perl_dispatch(fd);
Index: perlwrap.pm
===================================================================
--- perlwrap.pm	(revision 799b60ea3145bfa2ad773b09544d31a3e30e77ff)
+++ perlwrap.pm	(revision 5d2248c62dd7715238ac8948f05c0b8fd2963856)
@@ -242,5 +242,5 @@
     );
 
-    BarnOwl::new_command_internal($name, $func, $args{summary}, $args{usage}, $args{description});
+    BarnOwl::Internal::new_command($name, $func, $args{summary}, $args{usage}, $args{description});
 }
 
@@ -275,15 +275,15 @@
 
 sub new_variable_int {
-    unshift @_, \&BarnOwl::new_variable_int_internal, 0;
+    unshift @_, \&BarnOwl::Internal::new_variable_int, 0;
     goto \&_new_variable;
 }
 
 sub new_variable_bool {
-    unshift @_, \&BarnOwl::new_variable_bool_internal, 0;
+    unshift @_, \&BarnOwl::Internal::new_variable_bool, 0;
     goto \&_new_variable;
 }
 
 sub new_variable_string {
-    unshift @_, \&BarnOwl::new_variable_string_internal, "";
+    unshift @_, \&BarnOwl::Internal::new_variable_string, "";
     goto \&_new_variable;
 }
