| 1 |
root |
1.1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 2 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 |
|
|
<head> |
| 4 |
|
|
<title>rxvtperl - rxvt-unicode's embedded perl interpreter</title> |
| 5 |
|
|
<link rev="made" href="mailto:perl-binary@plan9.de" /> |
| 6 |
|
|
</head> |
| 7 |
|
|
|
| 8 |
|
|
<body style="background-color: white"> |
| 9 |
|
|
|
| 10 |
|
|
<p><a name="__index__"></a></p> |
| 11 |
|
|
<!-- INDEX BEGIN --> |
| 12 |
|
|
|
| 13 |
|
|
<ul> |
| 14 |
|
|
|
| 15 |
|
|
<li><a href="#name">NAME</a></li> |
| 16 |
|
|
<li><a href="#synopsis">SYNOPSIS</a></li> |
| 17 |
|
|
<li><a href="#description">DESCRIPTION</a></li> |
| 18 |
|
|
<ul> |
| 19 |
|
|
|
| 20 |
root |
1.3 |
<li><a href="#general_api_considerations">General API Considerations</a></li> |
| 21 |
root |
1.1 |
<li><a href="#hooks">Hooks</a></li> |
| 22 |
|
|
<li><a href="#functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></li> |
| 23 |
|
|
<li><a href="#the_urxvt__term_class">The <code>urxvt::term</code> Class</a></li> |
| 24 |
|
|
<li><a href="#the_urxvt__timer_class">The <code>urxvt::timer</code> Class</a></li> |
| 25 |
|
|
<li><a href="#the_urxvt__iow_class">The <code>urxvt::iow</code> Class</a></li> |
| 26 |
|
|
</ul> |
| 27 |
|
|
|
| 28 |
root |
1.2 |
<li><a href="#environment">ENVIRONMENT</a></li> |
| 29 |
|
|
<ul> |
| 30 |
|
|
|
| 31 |
|
|
<li><a href="#urxvt_perl_verbosity">URXVT_PERL_VERBOSITY</a></li> |
| 32 |
|
|
</ul> |
| 33 |
|
|
|
| 34 |
root |
1.1 |
<li><a href="#author">AUTHOR</a></li> |
| 35 |
|
|
</ul> |
| 36 |
|
|
<!-- INDEX END --> |
| 37 |
|
|
|
| 38 |
|
|
<hr /> |
| 39 |
|
|
<p> |
| 40 |
|
|
</p> |
| 41 |
|
|
<h1><a name="name">NAME</a></h1> |
| 42 |
|
|
<p>rxvtperl - rxvt-unicode's embedded perl interpreter</p> |
| 43 |
|
|
<p> |
| 44 |
|
|
</p> |
| 45 |
|
|
<hr /> |
| 46 |
|
|
<h1><a name="synopsis">SYNOPSIS</a></h1> |
| 47 |
|
|
<p>* Put your scripts into <em>/opt/rxvt/lib/urxvt/perl-ext/</em>, they will be loaded automatically.</p> |
| 48 |
|
|
<p>* Scripts are evaluated in a 'use strict' and 'use utf8' environment, and |
| 49 |
|
|
thus must be encoded as UTF-8.</p> |
| 50 |
|
|
<pre> |
| 51 |
|
|
sub on_sel_grab { |
| 52 |
|
|
warn "you selected ", $_[0]->selection; |
| 53 |
|
|
() |
| 54 |
|
|
}</pre> |
| 55 |
|
|
<pre> |
| 56 |
|
|
1</pre> |
| 57 |
|
|
<p> |
| 58 |
|
|
</p> |
| 59 |
|
|
<hr /> |
| 60 |
|
|
<h1><a name="description">DESCRIPTION</a></h1> |
| 61 |
root |
1.4 |
<p>Everytime a terminal object gets created, scripts specified via the |
| 62 |
|
|
<code>perl</code> resource are associated with it.</p> |
| 63 |
root |
1.3 |
<p>Each script will only ever be loaded once, even in rxvtd, where |
| 64 |
root |
1.4 |
scripts will be shared (But not enabled) for all terminals.</p> |
| 65 |
root |
1.3 |
<p> |
| 66 |
|
|
</p> |
| 67 |
|
|
<h2><a name="general_api_considerations">General API Considerations</a></h2> |
| 68 |
|
|
<p>All objects (such as terminals, time watchers etc.) are typical |
| 69 |
|
|
reference-to-hash objects. The hash can be used to store anything you |
| 70 |
|
|
like. All members starting with an underscore (such as <code>_ptr</code> or |
| 71 |
|
|
<code>_hook</code>) are reserved for internal uses and must not be accessed or |
| 72 |
|
|
modified).</p> |
| 73 |
|
|
<p>When objects are destroyed on the C++ side, the perl object hashes are |
| 74 |
|
|
emptied, so its best to store related objects such as time watchers and |
| 75 |
|
|
the like inside the terminal object so they get destroyed as soon as the |
| 76 |
|
|
terminal is destroyed.</p> |
| 77 |
root |
1.1 |
<p> |
| 78 |
|
|
</p> |
| 79 |
|
|
<h2><a name="hooks">Hooks</a></h2> |
| 80 |
|
|
<p>The following subroutines can be declared in loaded scripts, and will be called |
| 81 |
|
|
whenever the relevant event happens.</p> |
| 82 |
|
|
<p>All of them must return a boolean value. If it is true, then the event |
| 83 |
|
|
counts as being <em>consumed</em>, and the invocation of other hooks is skipped, |
| 84 |
|
|
and the relevant action might not be carried out by the C++ code.</p> |
| 85 |
|
|
<p>When in doubt, return a false value (preferably <code>()</code>).</p> |
| 86 |
|
|
<dl> |
| 87 |
|
|
<dt><strong><a name="item_on_init__24term">on_init $term</a></strong><br /> |
| 88 |
|
|
</dt> |
| 89 |
|
|
<dd> |
| 90 |
|
|
Called after a new terminal object has been initialized, but before |
| 91 |
|
|
windows are created or the command gets run. |
| 92 |
|
|
</dd> |
| 93 |
|
|
<p></p> |
| 94 |
|
|
<dt><strong><a name="item_on_reset__24term">on_reset $term</a></strong><br /> |
| 95 |
|
|
</dt> |
| 96 |
|
|
<dd> |
| 97 |
|
|
Called after the screen is ``reset'' for any reason, such as resizing or |
| 98 |
|
|
control sequences. Here is where you can react on changes to size-related |
| 99 |
|
|
variables. |
| 100 |
|
|
</dd> |
| 101 |
|
|
<p></p> |
| 102 |
|
|
<dt><strong><a name="item_on_start__24term">on_start $term</a></strong><br /> |
| 103 |
|
|
</dt> |
| 104 |
|
|
<dd> |
| 105 |
|
|
Called at the very end of initialisation of a new terminal, just before |
| 106 |
|
|
returning to the mainloop. |
| 107 |
|
|
</dd> |
| 108 |
|
|
<p></p> |
| 109 |
|
|
<dt><strong><a name="item_on_sel_make__24term_2c__24eventtime">on_sel_make $term, $eventtime</a></strong><br /> |
| 110 |
|
|
</dt> |
| 111 |
|
|
<dd> |
| 112 |
|
|
Called whenever a selection has been made by the user, but before the |
| 113 |
|
|
selection text is copied, so changes to the beginning, end or type of the |
| 114 |
|
|
selection will be honored. |
| 115 |
|
|
</dd> |
| 116 |
|
|
<dd> |
| 117 |
|
|
<p>Returning a true value aborts selection making by urxvt, in which case you |
| 118 |
|
|
have to make a selection yourself by calling <a href="#item_selection_grab"><code>$term->selection_grab</code></a>.</p> |
| 119 |
|
|
</dd> |
| 120 |
|
|
<p></p> |
| 121 |
|
|
<dt><strong><a name="item_on_sel_grab__24term_2c__24eventtime">on_sel_grab $term, $eventtime</a></strong><br /> |
| 122 |
|
|
</dt> |
| 123 |
|
|
<dd> |
| 124 |
|
|
Called whenever a selection has been copied, but before the selection is |
| 125 |
|
|
requested from the server. The selection text can be queried and changed |
| 126 |
|
|
by calling <a href="#item_selection"><code>$term->selection</code></a>. |
| 127 |
|
|
</dd> |
| 128 |
|
|
<dd> |
| 129 |
|
|
<p>Returning a true value aborts selection grabbing. It will still be hilighted.</p> |
| 130 |
|
|
</dd> |
| 131 |
|
|
<p></p> |
| 132 |
|
|
<dt><strong><a name="item_on_focus_in__24term">on_focus_in $term</a></strong><br /> |
| 133 |
|
|
</dt> |
| 134 |
|
|
<dd> |
| 135 |
|
|
Called whenever the window gets the keyboard focus, before urxvt does |
| 136 |
|
|
focus in processing. |
| 137 |
|
|
</dd> |
| 138 |
|
|
<p></p> |
| 139 |
|
|
<dt><strong><a name="item_on_focus_out__24term">on_focus_out $term</a></strong><br /> |
| 140 |
|
|
</dt> |
| 141 |
|
|
<dd> |
| 142 |
|
|
Called wheneever the window loses keyboard focus, before urxvt does focus |
| 143 |
|
|
out processing. |
| 144 |
|
|
</dd> |
| 145 |
|
|
<p></p> |
| 146 |
|
|
<dt><strong><a name="item_on_view_change__24term_2c__24offset">on_view_change $term, $offset</a></strong><br /> |
| 147 |
|
|
</dt> |
| 148 |
|
|
<dd> |
| 149 |
|
|
Called whenever the view offset changes, i..e the user or program |
| 150 |
|
|
scrolls. Offset <code>0</code> means display the normal terminal, positive values |
| 151 |
|
|
show this many lines of scrollback. |
| 152 |
|
|
</dd> |
| 153 |
|
|
<p></p> |
| 154 |
|
|
<dt><strong><a name="item_on_scroll_back__24term_2c__24lines_2c__24saved">on_scroll_back $term, $lines, $saved</a></strong><br /> |
| 155 |
|
|
</dt> |
| 156 |
|
|
<dd> |
| 157 |
|
|
Called whenever lines scroll out of the terminal area into the scrollback |
| 158 |
|
|
buffer. <code>$lines</code> is the number of lines scrolled out and may be larger |
| 159 |
|
|
than the scroll back buffer or the terminal. |
| 160 |
|
|
</dd> |
| 161 |
|
|
<dd> |
| 162 |
|
|
<p>It is called before lines are scrolled out (so rows 0 .. min ($lines - 1, |
| 163 |
|
|
$nrow - 1) represent the lines to be scrolled out). <code>$saved</code> is the total |
| 164 |
|
|
number of lines that will be in the scrollback buffer.</p> |
| 165 |
|
|
</dd> |
| 166 |
|
|
<p></p> |
| 167 |
|
|
<dt><strong><a name="item_on_tty_activity__24term__2anyi_2a">on_tty_activity $term *NYI*</a></strong><br /> |
| 168 |
|
|
</dt> |
| 169 |
|
|
<dd> |
| 170 |
|
|
Called whenever the <code>program(s)</code> running in the urxvt window send output. |
| 171 |
|
|
</dd> |
| 172 |
|
|
<p></p> |
| 173 |
|
|
<dt><strong><a name="item_on_refresh_begin__24term">on_refresh_begin $term</a></strong><br /> |
| 174 |
|
|
</dt> |
| 175 |
|
|
<dd> |
| 176 |
|
|
Called just before the screen gets redrawn. Can be used for overlay |
| 177 |
|
|
or similar effects by modify terminal contents in refresh_begin, and |
| 178 |
|
|
restoring them in refresh_end. The built-in overlay and selection display |
| 179 |
|
|
code is run after this hook, and takes precedence. |
| 180 |
|
|
</dd> |
| 181 |
|
|
<p></p> |
| 182 |
|
|
<dt><strong><a name="item_on_refresh_end__24term">on_refresh_end $term</a></strong><br /> |
| 183 |
|
|
</dt> |
| 184 |
|
|
<dd> |
| 185 |
|
|
Called just after the screen gets redrawn. See <code>on_refresh_begin</code>. |
| 186 |
|
|
</dd> |
| 187 |
|
|
<p></p></dl> |
| 188 |
|
|
<p> |
| 189 |
|
|
</p> |
| 190 |
|
|
<h2><a name="functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></h2> |
| 191 |
|
|
<dl> |
| 192 |
|
|
<dt><strong><a name="item_urxvt_3a_3afatal__24errormessage">urxvt::fatal $errormessage</a></strong><br /> |
| 193 |
|
|
</dt> |
| 194 |
|
|
<dd> |
| 195 |
|
|
Fatally aborts execution with the given error message. Avoid at all |
| 196 |
|
|
costs! The only time this is acceptable is when the terminal process |
| 197 |
|
|
starts up. |
| 198 |
|
|
</dd> |
| 199 |
|
|
<p></p> |
| 200 |
|
|
<dt><strong><a name="item_urxvt_3a_3awarn__24string">urxvt::warn $string</a></strong><br /> |
| 201 |
|
|
</dt> |
| 202 |
|
|
<dd> |
| 203 |
root |
1.3 |
Calls <code>rxvt_warn</code> with the given string which should not include a |
| 204 |
root |
1.1 |
newline. The module also overwrites the <code>warn</code> builtin with a function |
| 205 |
|
|
that calls this function. |
| 206 |
|
|
</dd> |
| 207 |
|
|
<dd> |
| 208 |
|
|
<p>Using this function has the advantage that its output ends up in the |
| 209 |
|
|
correct place, e.g. on stderr of the connecting urxvtc client.</p> |
| 210 |
|
|
</dd> |
| 211 |
|
|
<p></p> |
| 212 |
|
|
<dt><strong><a name="item__24time__3d_urxvt_3a_3anow">$time = urxvt::NOW</a></strong><br /> |
| 213 |
|
|
</dt> |
| 214 |
|
|
<dd> |
| 215 |
|
|
Returns the ``current time'' (as per the event loop). |
| 216 |
|
|
</dd> |
| 217 |
|
|
<p></p></dl> |
| 218 |
|
|
<p> |
| 219 |
|
|
</p> |
| 220 |
|
|
<h2><a name="the_urxvt__term_class">The <code>urxvt::term</code> Class</a></h2> |
| 221 |
|
|
<dl> |
| 222 |
root |
1.2 |
<dt><strong><a name="item_resource">$value = $term->resource ($name[, $newval])</a></strong><br /> |
| 223 |
|
|
</dt> |
| 224 |
|
|
<dd> |
| 225 |
|
|
Returns the current resource value associated with a given name and |
| 226 |
|
|
optionally sets a new value. Setting values is most useful in the <code>init</code> |
| 227 |
|
|
hook. Unset resources are returned and accepted as <code>undef</code>. |
| 228 |
|
|
</dd> |
| 229 |
|
|
<dd> |
| 230 |
|
|
<p>The new value must be properly encoded to a suitable character encoding |
| 231 |
|
|
before passing it to this method. Similarly, the returned value may need |
| 232 |
|
|
to be converted from the used encoding to text.</p> |
| 233 |
|
|
</dd> |
| 234 |
|
|
<dd> |
| 235 |
|
|
<p>Resource names are as defined in <em>src/rsinc.h</em>. Colours can be specified |
| 236 |
|
|
as resource names of the form <code>color+<index></code>, e.g. <code>color+5</code>. (will |
| 237 |
|
|
likely change).</p> |
| 238 |
|
|
</dd> |
| 239 |
|
|
<dd> |
| 240 |
|
|
<p>Please note that resource strings will currently only be freed when the |
| 241 |
|
|
terminal is destroyed, so changing options frequently will eat memory.</p> |
| 242 |
|
|
</dd> |
| 243 |
|
|
<dd> |
| 244 |
|
|
<p>Here is a a likely non-exhaustive list of resource names, not all of which |
| 245 |
|
|
are supported in every build, please see the source to see the actual |
| 246 |
|
|
list:</p> |
| 247 |
|
|
</dd> |
| 248 |
|
|
<dd> |
| 249 |
|
|
<pre> |
| 250 |
|
|
answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont |
| 251 |
|
|
borderLess color cursorBlink cursorUnderline cutchars delete_key |
| 252 |
|
|
display_name embed ext_bwidth fade font geometry hold iconName |
| 253 |
|
|
imFont imLocale inputMethod insecure int_bwidth intensityStyles |
| 254 |
root |
1.4 |
italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier |
| 255 |
|
|
mouseWheelScrollPage name pastableTabs path perl_eval perl_ext |
| 256 |
root |
1.3 |
perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd |
| 257 |
|
|
reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating |
| 258 |
|
|
scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput |
| 259 |
|
|
scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle |
| 260 |
|
|
shade term_name title transparent transparent_all tripleclickwords |
| 261 |
|
|
utmpInhibit visualBell</pre> |
| 262 |
root |
1.2 |
</dd> |
| 263 |
|
|
<p></p> |
| 264 |
root |
1.1 |
<dt><strong><a name="item_selection_mark">($row, $col) = $term->selection_mark ([$row, $col])</a></strong><br /> |
| 265 |
|
|
</dt> |
| 266 |
|
|
<dt><strong><a name="item_selection_beg">($row, $col) = $term->selection_beg ([$row, $col])</a></strong><br /> |
| 267 |
|
|
</dt> |
| 268 |
|
|
<dt><strong><a name="item_selection_end">($row, $col) = $term->selection_end ([$row, $col])</a></strong><br /> |
| 269 |
|
|
</dt> |
| 270 |
|
|
<dd> |
| 271 |
|
|
Return the current values of the selection mark, begin or end positions, |
| 272 |
|
|
and optionally set them to new values. |
| 273 |
|
|
</dd> |
| 274 |
|
|
<p></p> |
| 275 |
|
|
<dt><strong><a name="item_selection_grab">$success = $term->selection_grab ($eventtime)</a></strong><br /> |
| 276 |
|
|
</dt> |
| 277 |
|
|
<dd> |
| 278 |
|
|
Try to request the primary selection from the server (for example, as set |
| 279 |
|
|
by the next method). |
| 280 |
|
|
</dd> |
| 281 |
|
|
<p></p> |
| 282 |
|
|
<dt><strong><a name="item_selection">$oldtext = $term->selection ([$newtext])</a></strong><br /> |
| 283 |
|
|
</dt> |
| 284 |
|
|
<dd> |
| 285 |
|
|
Return the current selection text and optionally replace it by <code>$newtext</code>. |
| 286 |
|
|
</dd> |
| 287 |
|
|
<p></p> |
| 288 |
|
|
<dt><strong><a name="item_scr_overlay">$term->scr_overlay ($x, $y, $text)</a></strong><br /> |
| 289 |
|
|
</dt> |
| 290 |
|
|
<dd> |
| 291 |
|
|
Create a simple multi-line overlay box. See the next method for details. |
| 292 |
|
|
</dd> |
| 293 |
|
|
<p></p> |
| 294 |
|
|
<dt><strong><a name="item_scr_overlay_new">$term->scr_overlay_new ($x, $y, $width, $height)</a></strong><br /> |
| 295 |
|
|
</dt> |
| 296 |
|
|
<dd> |
| 297 |
|
|
Create a new (empty) overlay at the given position with the given |
| 298 |
|
|
width/height. A border will be put around the box. If either <code>$x</code> or |
| 299 |
|
|
<code>$y</code> is negative, then this is counted from the right/bottom side, |
| 300 |
|
|
respectively. |
| 301 |
|
|
</dd> |
| 302 |
|
|
<p></p> |
| 303 |
|
|
<dt><strong><a name="item_scr_overlay_off">$term->scr_overlay_off</a></strong><br /> |
| 304 |
|
|
</dt> |
| 305 |
|
|
<dd> |
| 306 |
|
|
Switch the overlay off again. |
| 307 |
|
|
</dd> |
| 308 |
|
|
<p></p> |
| 309 |
|
|
<dt><strong><a name="item_scr_overlay_set_char">$term->scr_overlay_set_char ($x, $y, $char, $rend = OVERLAY_RSTYLE)</a></strong><br /> |
| 310 |
|
|
</dt> |
| 311 |
|
|
<dd> |
| 312 |
|
|
Put a single character (specified numerically) at the given overlay |
| 313 |
|
|
position. |
| 314 |
|
|
</dd> |
| 315 |
|
|
<p></p> |
| 316 |
|
|
<dt><strong><a name="item_scr_overlay_set">$term->scr_overlay_set ($x, $y, $text)</a></strong><br /> |
| 317 |
|
|
</dt> |
| 318 |
|
|
<dd> |
| 319 |
|
|
Write a string at the given position into the overlay. |
| 320 |
|
|
</dd> |
| 321 |
root |
1.3 |
<p></p> |
| 322 |
|
|
<dt><strong><a name="item_strwidth">$cellwidth = $term->strwidth $string</a></strong><br /> |
| 323 |
|
|
</dt> |
| 324 |
|
|
<dd> |
| 325 |
|
|
Returns the number of screen-cells this string would need. Correctly |
| 326 |
|
|
accounts for wide and combining characters. |
| 327 |
|
|
</dd> |
| 328 |
|
|
<p></p> |
| 329 |
|
|
<dt><strong><a name="item_locale_encode">$octets = $term->locale_encode $string</a></strong><br /> |
| 330 |
|
|
</dt> |
| 331 |
|
|
<dd> |
| 332 |
|
|
Convert the given text string into the corresponding locale encoding. |
| 333 |
|
|
</dd> |
| 334 |
|
|
<p></p> |
| 335 |
|
|
<dt><strong><a name="item_locale_decode">$string = $term->locale_decode $octets</a></strong><br /> |
| 336 |
|
|
</dt> |
| 337 |
|
|
<dd> |
| 338 |
|
|
Convert the given locale-encoded octets into a perl string. |
| 339 |
|
|
</dd> |
| 340 |
|
|
<p></p> |
| 341 |
|
|
<dt><strong><a name="item_tt_write">$term->tt_write ($octets)</a></strong><br /> |
| 342 |
|
|
</dt> |
| 343 |
|
|
<dd> |
| 344 |
|
|
Write the octets given in <code>$data</code> to the tty (i.e. as program input). To |
| 345 |
|
|
pass characters instead of octets, you should convetr you strings first to |
| 346 |
|
|
the locale-specific encoding using <a href="#item_locale_encode"><code>$term->locale_encode</code></a>. |
| 347 |
|
|
</dd> |
| 348 |
root |
1.1 |
<p></p></dl> |
| 349 |
|
|
<p> |
| 350 |
|
|
</p> |
| 351 |
|
|
<h2><a name="the_urxvt__timer_class">The <code>urxvt::timer</code> Class</a></h2> |
| 352 |
|
|
<p>This class implements timer watchers/events. Time is represented as a |
| 353 |
|
|
fractional number of seconds since the epoch. Example:</p> |
| 354 |
|
|
<pre> |
| 355 |
|
|
# create a digital clock display in upper right corner |
| 356 |
|
|
$term->{timer} = urxvt::timer |
| 357 |
|
|
->new |
| 358 |
|
|
->start (urxvt::NOW) |
| 359 |
|
|
->cb (sub { |
| 360 |
|
|
my ($timer) = @_; |
| 361 |
|
|
my $time = $timer->at; |
| 362 |
|
|
$timer->start ($time + 1); |
| 363 |
|
|
$self->scr_overlay (-1, 0, |
| 364 |
|
|
POSIX::strftime "%H:%M:%S", localtime $time); |
| 365 |
|
|
});</pre> |
| 366 |
|
|
<dl> |
| 367 |
|
|
<dt><strong><a name="item__24timer__3d_new_urxvt_3a_3atimer">$timer = new urxvt::timer</a></strong><br /> |
| 368 |
|
|
</dt> |
| 369 |
|
|
<dd> |
| 370 |
|
|
Create a new timer object in stopped state. |
| 371 |
|
|
</dd> |
| 372 |
|
|
<p></p> |
| 373 |
|
|
<dt><strong><a name="item_cb">$timer = $timer->cb (sub { my ($timer) = @_; ... })</a></strong><br /> |
| 374 |
|
|
</dt> |
| 375 |
|
|
<dd> |
| 376 |
|
|
Set the callback to be called when the timer triggers. |
| 377 |
|
|
</dd> |
| 378 |
|
|
<p></p> |
| 379 |
|
|
<dt><strong><a name="item_at">$tstamp = $timer->at</a></strong><br /> |
| 380 |
|
|
</dt> |
| 381 |
|
|
<dd> |
| 382 |
|
|
Return the time this watcher will fire next. |
| 383 |
|
|
</dd> |
| 384 |
|
|
<p></p> |
| 385 |
|
|
<dt><strong><a name="item_set">$timer = $timer->set ($tstamp)</a></strong><br /> |
| 386 |
|
|
</dt> |
| 387 |
|
|
<dd> |
| 388 |
|
|
Set the time the event is generated to $tstamp. |
| 389 |
|
|
</dd> |
| 390 |
|
|
<p></p> |
| 391 |
|
|
<dt><strong><a name="item_start">$timer = $timer->start</a></strong><br /> |
| 392 |
|
|
</dt> |
| 393 |
|
|
<dd> |
| 394 |
|
|
Start the timer. |
| 395 |
|
|
</dd> |
| 396 |
|
|
<p></p> |
| 397 |
|
|
<dt><strong>$timer = $timer->start ($tstamp)</strong><br /> |
| 398 |
|
|
</dt> |
| 399 |
|
|
<dd> |
| 400 |
|
|
Set the event trigger time to <code>$tstamp</code> and start the timer. |
| 401 |
|
|
</dd> |
| 402 |
|
|
<p></p> |
| 403 |
|
|
<dt><strong><a name="item_stop">$timer = $timer->stop</a></strong><br /> |
| 404 |
|
|
</dt> |
| 405 |
|
|
<dd> |
| 406 |
|
|
Stop the timer. |
| 407 |
|
|
</dd> |
| 408 |
|
|
<p></p></dl> |
| 409 |
|
|
<p> |
| 410 |
|
|
</p> |
| 411 |
|
|
<h2><a name="the_urxvt__iow_class">The <code>urxvt::iow</code> Class</a></h2> |
| 412 |
|
|
<p>This class implements io watchers/events. Example:</p> |
| 413 |
|
|
<pre> |
| 414 |
|
|
$term->{socket} = ... |
| 415 |
|
|
$term->{iow} = urxvt::iow |
| 416 |
|
|
->new |
| 417 |
|
|
->fd (fileno $term->{socket}) |
| 418 |
|
|
->events (1) # wait for read data |
| 419 |
|
|
->start |
| 420 |
|
|
->cb (sub { |
| 421 |
|
|
my ($iow, $revents) = @_; |
| 422 |
|
|
# $revents must be 1 here, no need to check |
| 423 |
|
|
sysread $term->{socket}, my $buf, 8192 |
| 424 |
|
|
or end-of-file; |
| 425 |
|
|
});</pre> |
| 426 |
|
|
<dl> |
| 427 |
|
|
<dt><strong><a name="item__24iow__3d_new_urxvt_3a_3aiow">$iow = new urxvt::iow</a></strong><br /> |
| 428 |
|
|
</dt> |
| 429 |
|
|
<dd> |
| 430 |
|
|
Create a new io watcher object in stopped state. |
| 431 |
|
|
</dd> |
| 432 |
|
|
<p></p> |
| 433 |
|
|
<dt><strong>$iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... })</strong><br /> |
| 434 |
|
|
</dt> |
| 435 |
|
|
<dd> |
| 436 |
|
|
Set the callback to be called when io events are triggered. <code>$reventmask</code> |
| 437 |
|
|
is a bitset as described in the <a href="#item_events"><code>events</code></a> method. |
| 438 |
|
|
</dd> |
| 439 |
|
|
<p></p> |
| 440 |
|
|
<dt><strong><a name="item_fd">$iow = $iow->fd ($fd)</a></strong><br /> |
| 441 |
|
|
</dt> |
| 442 |
|
|
<dd> |
| 443 |
|
|
Set the filedescriptor (not handle) to watch. |
| 444 |
|
|
</dd> |
| 445 |
|
|
<p></p> |
| 446 |
|
|
<dt><strong><a name="item_events">$iow = $iow->events ($eventmask)</a></strong><br /> |
| 447 |
|
|
</dt> |
| 448 |
|
|
<dd> |
| 449 |
|
|
Set the event mask to watch. Bit #0 (value <code>1</code>) enables watching for read |
| 450 |
|
|
data, Bit #1 (value <code>2</code>) enables watching for write data. |
| 451 |
|
|
</dd> |
| 452 |
|
|
<p></p> |
| 453 |
|
|
<dt><strong>$iow = $iow->start</strong><br /> |
| 454 |
|
|
</dt> |
| 455 |
|
|
<dd> |
| 456 |
|
|
Start watching for requested events on the given handle. |
| 457 |
|
|
</dd> |
| 458 |
|
|
<p></p> |
| 459 |
|
|
<dt><strong>$iow = $iow->stop</strong><br /> |
| 460 |
|
|
</dt> |
| 461 |
|
|
<dd> |
| 462 |
|
|
Stop watching for events on the given filehandle. |
| 463 |
|
|
</dd> |
| 464 |
|
|
<p></p></dl> |
| 465 |
|
|
<p> |
| 466 |
|
|
</p> |
| 467 |
|
|
<hr /> |
| 468 |
root |
1.2 |
<h1><a name="environment">ENVIRONMENT</a></h1> |
| 469 |
|
|
<p> |
| 470 |
|
|
</p> |
| 471 |
|
|
<h2><a name="urxvt_perl_verbosity">URXVT_PERL_VERBOSITY</a></h2> |
| 472 |
|
|
<p>This variable controls the verbosity level of the perl extension. Higher |
| 473 |
|
|
numbers indicate more verbose output.</p> |
| 474 |
|
|
<ol> |
| 475 |
|
|
<li><strong><a name="item__2d_only_fatal_messages">- only fatal messages</a></strong><br /> |
| 476 |
|
|
</li> |
| 477 |
|
|
<li><strong><a name="item__2d_script_loading_and_management">- script loading and management</a></strong><br /> |
| 478 |
|
|
</li> |
| 479 |
|
|
<li><strong><a name="item__2d_all_events_received">- all events received</a></strong><br /> |
| 480 |
|
|
</li> |
| 481 |
|
|
</ol> |
| 482 |
|
|
<p> |
| 483 |
|
|
</p> |
| 484 |
|
|
<hr /> |
| 485 |
root |
1.1 |
<h1><a name="author">AUTHOR</a></h1> |
| 486 |
|
|
<pre> |
| 487 |
|
|
Marc Lehmann <pcg@goof.com> |
| 488 |
|
|
<a href="http://software.schmorp.de/pkg/rxvt-unicode">http://software.schmorp.de/pkg/rxvt-unicode</a></pre> |
| 489 |
|
|
|
| 490 |
|
|
</body> |
| 491 |
|
|
|
| 492 |
|
|
</html> |