resource,
@@RXVT_NAME@@ will first look in these directories and then in
-F<@@RXVT_LIBDIR@@/urxvt/perl-ext/>.
+F<@@RXVT_LIBDIR@@/urxvt/perl/>.
See the rxvtperl(3) manpage.
diff --git a/doc/rxvt.1.txt b/doc/rxvt.1.txt
index 342ff5c0..458d2e4b 100644
--- a/doc/rxvt.1.txt
+++ b/doc/rxvt.1.txt
@@ -392,8 +392,9 @@ OPTIONS
my $slave = $pty->slave;
while (<$slave>) { print $slave "got <$_>\n" }
- -perl *string*
- Used by perl extension. See resource perl.
+ -pe *string*
+ Colon-separated list of perl extension scripts to use in this
+ terminal instance. See resource perl-ext.
RESOURCES (available also as long-options)
Note: `rxvt --help' gives a list of all resources (long options)
@@ -918,19 +919,21 @@ RESOURCES (available also as long-options)
URxvt.keysym.M-C-3: command:\033[8;25;80t
URxvt.keysym.M-C-4: command:\033[8;48;110t
- perl: *string*
- Used by perl extension and is free for any use, as it is not
- interpreted by rxvt-unicode itself; option perl.
+ perl-ext: *string*
+ Colon-separated list of perl extension scripts to use in this
+ terminal instance. Each extension is looked up in the library
+ directories, loaded if necessary, and bound to the current terminal
+ instance; option -pe.
perl-eval: *string*
- Perl code to be evaluated when all extensions have been loaded. See
- the rxvtperl(3) manpage.
+ Perl code to be evaluated when all extensions have been registered.
+ See the rxvtperl(3) manpage.
perl-lib: *path*
- Additional directory that holds extension scripts that are loaded
- and enabled for this terminal instance, in addition to scripts
- stored in /opt/rxvt/lib/urxvt/perl-ext/, which are global to all
- terminal instances.
+ Colon-separated list of additional directories that hold extension
+ scripts. When looking for extensions specified by the "perl"
+ resource, rxvt will first look in these directories and then in
+ /opt/rxvt/lib/urxvt/perl-ext/.
See the rxvtperl(3) manpage.
diff --git a/doc/rxvtperl.3.html b/doc/rxvtperl.3.html
index 007335b2..43606e27 100644
--- a/doc/rxvtperl.3.html
+++ b/doc/rxvtperl.3.html
@@ -58,14 +58,10 @@ thus must be encoded as UTF-8.
-On startup, rxvt will scan /opt/rxvt/lib/urxvt/perl-ext/
-for files and will load them. Everytime a terminal object gets created,
-the directory specified by the perl-lib
resource will be additionally
-scanned.
+Everytime a terminal object gets created, scripts specified via the
+perl
resource are associated with it.
Each script will only ever be loaded once, even in rxvtd, where
-scripts will be shared for all terminals.
-Hooks in scripts specified by perl-lib
will only be called for the
-terminals created with that specific option value.
+scripts will be shared (But not enabled) for all terminals.
@@ -255,8 +251,8 @@ list:
borderLess color cursorBlink cursorUnderline cutchars delete_key
display_name embed ext_bwidth fade font geometry hold iconName
imFont imLocale inputMethod insecure int_bwidth intensityStyles
- italicFont jumpScroll lineSpace loginShell mapAlert menu meta8
- modifier mouseWheelScrollPage name pastableTabs path perl perl_eval
+ italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier
+ mouseWheelScrollPage name pastableTabs path perl_eval perl_ext
perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd
reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating
scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput
diff --git a/doc/rxvtperl.3.man.in b/doc/rxvtperl.3.man.in
index c926210d..c00bd974 100644
--- a/doc/rxvtperl.3.man.in
+++ b/doc/rxvtperl.3.man.in
@@ -151,16 +151,11 @@ thus must be encoded as \s-1UTF\-8\s0.
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
-On startup, @@RXVT_NAME@@ will scan \fI@@RXVT_LIBDIR@@/urxvt/perl\-ext/\fR
-for files and will load them. Everytime a terminal object gets created,
-the directory specified by the \f(CW\*(C`perl\-lib\*(C'\fR resource will be additionally
-scanned.
+Everytime a terminal object gets created, scripts specified via the
+\&\f(CW\*(C`perl\*(C'\fR resource are associated with it.
.PP
Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where
-scripts will be shared for all terminals.
-.PP
-Hooks in scripts specified by \f(CW\*(C`perl\-lib\*(C'\fR will only be called for the
-terminals created with that specific option value.
+scripts will be shared (But not enabled) for all terminals.
.Sh "General \s-1API\s0 Considerations"
.IX Subsection "General API Considerations"
All objects (such as terminals, time watchers etc.) are typical
@@ -308,8 +303,8 @@ list:
\& borderLess color cursorBlink cursorUnderline cutchars delete_key
\& display_name embed ext_bwidth fade font geometry hold iconName
\& imFont imLocale inputMethod insecure int_bwidth intensityStyles
-\& italicFont jumpScroll lineSpace loginShell mapAlert menu meta8
-\& modifier mouseWheelScrollPage name pastableTabs path perl perl_eval
+\& italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier
+\& mouseWheelScrollPage name pastableTabs path perl_eval perl_ext
\& perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd
\& reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating
\& scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput
diff --git a/doc/rxvtperl.3.txt b/doc/rxvtperl.3.txt
index 075e7b1e..0a26d667 100644
--- a/doc/rxvtperl.3.txt
+++ b/doc/rxvtperl.3.txt
@@ -16,15 +16,11 @@ SYNOPSIS
1
DESCRIPTION
- On startup, rxvt will scan /opt/rxvt/lib/urxvt/perl-ext/ for files and
- will load them. Everytime a terminal object gets created, the directory
- specified by the "perl-lib" resource will be additionally scanned.
+ Everytime a terminal object gets created, scripts specified via the
+ "perl" resource are associated with it.
Each script will only ever be loaded once, even in rxvtd, where scripts
- will be shared for all terminals.
-
- Hooks in scripts specified by "perl-lib" will only be called for the
- terminals created with that specific option value.
+ will be shared (But not enabled) for all terminals.
General API Considerations
All objects (such as terminals, time watchers etc.) are typical
@@ -157,8 +153,8 @@ DESCRIPTION
borderLess color cursorBlink cursorUnderline cutchars delete_key
display_name embed ext_bwidth fade font geometry hold iconName
imFont imLocale inputMethod insecure int_bwidth intensityStyles
- italicFont jumpScroll lineSpace loginShell mapAlert menu meta8
- modifier mouseWheelScrollPage name pastableTabs path perl perl_eval
+ italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier
+ mouseWheelScrollPage name pastableTabs path perl_eval perl_ext
perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd
reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating
scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput
diff --git a/src/Makefile.in b/src/Makefile.in
index 1a8d7257..893163e8 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -96,9 +96,9 @@ distclean: realclean
install-perl:
@IF_PERL@ $(INSTALL) -d $(DESTDIR)$(libdir)
@IF_PERL@ $(INSTALL) -d $(DESTDIR)$(libdir)/urxvt
-@IF_PERL@ $(INSTALL) -d $(DESTDIR)$(libdir)/urxvt/perl-ext
+@IF_PERL@ $(INSTALL) -d $(DESTDIR)$(libdir)/urxvt/perl
@IF_PERL@ $(INSTALL_DATA) urxvt.pm $(DESTDIR)$(libdir)/urxvt/urxvt.pm
-@IF_PERL@ for ext in perl-ext/*; do test -f "$$ext" && $(INSTALL_DATA) "$$ext" $(DESTDIR)$(libdir)/urxvt/"$$ext"; done
+@IF_PERL@ for ext in perl/*; do test -f "$$ext" && $(INSTALL_DATA) "$$ext" $(DESTDIR)$(libdir)/urxvt/"$$ext"; done
install: allbin alldoc install-perl
$(INSTALL) -d $(DESTDIR)$(bindir)
diff --git a/src/rsinc.h b/src/rsinc.h
index efeb52e0..bb6ede00 100644
--- a/src/rsinc.h
+++ b/src/rsinc.h
@@ -104,7 +104,7 @@
Rs_def(shade)
#endif
#if ENABLE_PERL
- Rs_def(perl_lib)
Rs_def(perl_eval)
- Rs_def(perl)
+ Rs_def(perl_ext)
+ Rs_def(perl_lib)
#endif
diff --git a/src/rxvtperl.h b/src/rxvtperl.h
index 7f49cb76..27e75cae 100644
--- a/src/rxvtperl.h
+++ b/src/rxvtperl.h
@@ -18,12 +18,10 @@ enum data_type {
};
enum hook_type {
- HOOK_LOAD,
-
- HOOK_INIT,
+ HOOK_INIT = 0, // special, hardcoded
+ HOOK_DESTROY = 1, // values in urxvt.pm
HOOK_RESET,
HOOK_START,
- HOOK_DESTROY,
HOOK_SEL_BEGIN,
HOOK_SEL_EXTEND,
diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
index f04ce40e..7f040a29 100644
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -210,9 +210,8 @@ rxvt_perl_interp::init ()
bool
rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
{
- // INIT and DESTROY must be requested by the runtime
-
- if (!perl || !should_invoke [htype])
+ if (!perl
+ || (!should_invoke [htype] && htype != HOOK_INIT && htype != HOOK_DESTROY))
return false;
if (htype == HOOK_INIT) // first hook ever called
@@ -291,7 +290,6 @@ BOOT:
{
# define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0))
AV *hookname = get_av ("urxvt::HOOKNAME", 1);
- set_hookname (LOAD);
set_hookname (INIT);
set_hookname (RESET);
set_hookname (START);
diff --git a/src/urxvt.pm b/src/urxvt.pm
index a051c12f..656e2574 100644
--- a/src/urxvt.pm
+++ b/src/urxvt.pm
@@ -4,7 +4,7 @@ rxvtperl - rxvt-unicode's embedded perl interpreter
=head1 SYNOPSIS
-* Put your scripts into F<@@RXVT_LIBDIR@@/urxvt/perl-ext/>, they will be loaded automatically.
+* Put your scripts into F<@@RXVT_LIBDIR@@/urxvt/perl/>, they will be loaded automatically.
* Scripts are evaluated in a 'use strict' and 'use utf8' environment, and
thus must be encoded as UTF-8.
@@ -228,7 +228,7 @@ sub invoke {
my $htype = shift;
if ($htype == 0) { # INIT
- my @dirs = ((split /:/, $term->resource ("perl_lib")), $LIBDIR);
+ my @dirs = ((split /:/, $term->resource ("perl_lib")), "$LIBDIR/perl");
for my $ext (split /:/, $term->resource ("perl_ext")) {
my @files = grep -f $_, map "$_/$ext", @dirs;
diff --git a/src/xdefaults.C b/src/xdefaults.C
index 8e46827c..54ca3dc6 100644
--- a/src/xdefaults.C
+++ b/src/xdefaults.C
@@ -263,7 +263,7 @@ optList[] = {
#if ENABLE_PERL
STRG (Rs_perl_lib, "perl-lib", 0, "string", "colon-separated directories with extension scripts"),
STRG (Rs_perl_eval, "perl-eval", 0, "string", "code to be evaluated after all extensions have been loaded"),
- STRG (Rs_perl_ext, "perl-ext", "pe", "string", "colon-sepaated list of perl extensions to enable"),
+ STRG (Rs_perl_ext, "perl-ext", "pe", "string", "colon-separated list of perl extensions to enable"),
#endif
#if 0 && TODO
#if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT)