ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/doc/rxvtperl.3.html
Revision: 1.7
Committed: Tue Jan 3 01:45:12 2006 UTC (18 years, 6 months ago) by root
Content type: text/html
Branch: MAIN
Changes since 1.6: +4 -4 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
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.7 <li><a href="#prepackaged_extensions">Prepackaged Extensions</a></li>
21 root 1.3 <li><a href="#general_api_considerations">General API Considerations</a></li>
22 root 1.1 <li><a href="#hooks">Hooks</a></li>
23     <li><a href="#functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></li>
24     <li><a href="#the_urxvt__term_class">The <code>urxvt::term</code> Class</a></li>
25 root 1.6 <li><a href="#rendition">RENDITION</a></li>
26 root 1.1 <li><a href="#the_urxvt__timer_class">The <code>urxvt::timer</code> Class</a></li>
27     <li><a href="#the_urxvt__iow_class">The <code>urxvt::iow</code> Class</a></li>
28     </ul>
29    
30 root 1.2 <li><a href="#environment">ENVIRONMENT</a></li>
31     <ul>
32    
33     <li><a href="#urxvt_perl_verbosity">URXVT_PERL_VERBOSITY</a></li>
34     </ul>
35    
36 root 1.1 <li><a href="#author">AUTHOR</a></li>
37     </ul>
38     <!-- INDEX END -->
39    
40     <hr />
41     <p>
42     </p>
43 root 1.7 <hr />
44 root 1.1 <h1><a name="name">NAME</a></h1>
45     <p>rxvtperl - rxvt-unicode's embedded perl interpreter</p>
46     <p>
47     </p>
48     <hr />
49     <h1><a name="synopsis">SYNOPSIS</a></h1>
50 root 1.5 <pre>
51     # create a file grab_test in $HOME:</pre>
52 root 1.1 <pre>
53     sub on_sel_grab {
54     warn &quot;you selected &quot;, $_[0]-&gt;selection;
55     ()
56     }</pre>
57     <pre>
58 root 1.5 # start a rxvt using it:</pre>
59     <pre>
60     rxvt --perl-lib $HOME -pe grab_test</pre>
61 root 1.1 <p>
62     </p>
63     <hr />
64     <h1><a name="description">DESCRIPTION</a></h1>
65 root 1.4 <p>Everytime a terminal object gets created, scripts specified via the
66 root 1.5 <code>perl</code> resource are loaded and associated with it.</p>
67     <p>Scripts are compiled in a 'use strict' and 'use utf8' environment, and
68     thus must be encoded as UTF-8.</p>
69 root 1.3 <p>Each script will only ever be loaded once, even in rxvtd, where
70 root 1.7 scripts will be shared (but not enabled) for all terminals.</p>
71 root 1.3 <p>
72     </p>
73 root 1.7 <h2><a name="prepackaged_extensions">Prepackaged Extensions</a></h2>
74 root 1.6 <p>This section describes the extensiosn delivered with this version. You can
75     find them in <em>/opt/rxvt/lib/urxvt/perl/</em>.</p>
76     <p>You can activate them like this:</p>
77     <pre>
78     rxvt -pe &lt;extensionname&gt;</pre>
79     <dl>
80     <dt><strong><a name="item_selection">selection</a></strong><br />
81     </dt>
82     <dd>
83     Miscellaneous selection modifications.
84     </dd>
85     <dl>
86     <dt><strong><a name="item_rot13">rot13</a></strong><br />
87     </dt>
88     <dd>
89     Rot-13 the selection when activated. Used via keyboard trigger:
90     </dd>
91     <dd>
92     <pre>
93     URxvt.keysym.C-M-r: perl:selection:rot13</pre>
94     </dd>
95     <p></p></dl>
96     <dt><strong><a name="item_digital_2dclock">digital-clock</a></strong><br />
97     </dt>
98     <dd>
99     Displays a very simple digital clock in the upper right corner of the
100     window. Illustrates overwriting the refresh callbacks to create your own
101     overlays or changes.
102     </dd>
103     <p></p>
104     <dt><strong><a name="item_simple_2doverlay_2dclock">simple-overlay-clock</a></strong><br />
105     </dt>
106     <dd>
107     Displays a digital clock using the built-in overlay (colorful, useless).
108     </dd>
109     <p></p></dl>
110     <p>
111     </p>
112 root 1.3 <h2><a name="general_api_considerations">General API Considerations</a></h2>
113     <p>All objects (such as terminals, time watchers etc.) are typical
114     reference-to-hash objects. The hash can be used to store anything you
115     like. All members starting with an underscore (such as <code>_ptr</code> or
116     <code>_hook</code>) are reserved for internal uses and must not be accessed or
117     modified).</p>
118     <p>When objects are destroyed on the C++ side, the perl object hashes are
119     emptied, so its best to store related objects such as time watchers and
120     the like inside the terminal object so they get destroyed as soon as the
121     terminal is destroyed.</p>
122 root 1.1 <p>
123     </p>
124     <h2><a name="hooks">Hooks</a></h2>
125     <p>The following subroutines can be declared in loaded scripts, and will be called
126     whenever the relevant event happens.</p>
127     <p>All of them must return a boolean value. If it is true, then the event
128     counts as being <em>consumed</em>, and the invocation of other hooks is skipped,
129     and the relevant action might not be carried out by the C++ code.</p>
130     <p>When in doubt, return a false value (preferably <code>()</code>).</p>
131     <dl>
132     <dt><strong><a name="item_on_init__24term">on_init $term</a></strong><br />
133     </dt>
134     <dd>
135     Called after a new terminal object has been initialized, but before
136     windows are created or the command gets run.
137     </dd>
138     <p></p>
139     <dt><strong><a name="item_on_reset__24term">on_reset $term</a></strong><br />
140     </dt>
141     <dd>
142     Called after the screen is ``reset'' for any reason, such as resizing or
143     control sequences. Here is where you can react on changes to size-related
144     variables.
145     </dd>
146     <p></p>
147     <dt><strong><a name="item_on_start__24term">on_start $term</a></strong><br />
148     </dt>
149     <dd>
150     Called at the very end of initialisation of a new terminal, just before
151     returning to the mainloop.
152     </dd>
153     <p></p>
154     <dt><strong><a name="item_on_sel_make__24term_2c__24eventtime">on_sel_make $term, $eventtime</a></strong><br />
155     </dt>
156     <dd>
157     Called whenever a selection has been made by the user, but before the
158     selection text is copied, so changes to the beginning, end or type of the
159     selection will be honored.
160     </dd>
161     <dd>
162     <p>Returning a true value aborts selection making by urxvt, in which case you
163     have to make a selection yourself by calling <a href="#item_selection_grab"><code>$term-&gt;selection_grab</code></a>.</p>
164     </dd>
165     <p></p>
166     <dt><strong><a name="item_on_sel_grab__24term_2c__24eventtime">on_sel_grab $term, $eventtime</a></strong><br />
167     </dt>
168     <dd>
169     Called whenever a selection has been copied, but before the selection is
170     requested from the server. The selection text can be queried and changed
171     by calling <a href="#item_selection"><code>$term-&gt;selection</code></a>.
172     </dd>
173     <dd>
174     <p>Returning a true value aborts selection grabbing. It will still be hilighted.</p>
175     </dd>
176     <p></p>
177     <dt><strong><a name="item_on_focus_in__24term">on_focus_in $term</a></strong><br />
178     </dt>
179     <dd>
180     Called whenever the window gets the keyboard focus, before urxvt does
181     focus in processing.
182     </dd>
183     <p></p>
184     <dt><strong><a name="item_on_focus_out__24term">on_focus_out $term</a></strong><br />
185     </dt>
186     <dd>
187     Called wheneever the window loses keyboard focus, before urxvt does focus
188     out processing.
189     </dd>
190     <p></p>
191     <dt><strong><a name="item_on_view_change__24term_2c__24offset">on_view_change $term, $offset</a></strong><br />
192     </dt>
193     <dd>
194     Called whenever the view offset changes, i..e the user or program
195     scrolls. Offset <code>0</code> means display the normal terminal, positive values
196     show this many lines of scrollback.
197     </dd>
198     <p></p>
199     <dt><strong><a name="item_on_scroll_back__24term_2c__24lines_2c__24saved">on_scroll_back $term, $lines, $saved</a></strong><br />
200     </dt>
201     <dd>
202     Called whenever lines scroll out of the terminal area into the scrollback
203     buffer. <code>$lines</code> is the number of lines scrolled out and may be larger
204     than the scroll back buffer or the terminal.
205     </dd>
206     <dd>
207     <p>It is called before lines are scrolled out (so rows 0 .. min ($lines - 1,
208     $nrow - 1) represent the lines to be scrolled out). <code>$saved</code> is the total
209     number of lines that will be in the scrollback buffer.</p>
210     </dd>
211     <p></p>
212     <dt><strong><a name="item_on_tty_activity__24term__2anyi_2a">on_tty_activity $term *NYI*</a></strong><br />
213     </dt>
214     <dd>
215     Called whenever the <code>program(s)</code> running in the urxvt window send output.
216     </dd>
217     <p></p>
218     <dt><strong><a name="item_on_refresh_begin__24term">on_refresh_begin $term</a></strong><br />
219     </dt>
220     <dd>
221     Called just before the screen gets redrawn. Can be used for overlay
222     or similar effects by modify terminal contents in refresh_begin, and
223     restoring them in refresh_end. The built-in overlay and selection display
224     code is run after this hook, and takes precedence.
225     </dd>
226     <p></p>
227     <dt><strong><a name="item_on_refresh_end__24term">on_refresh_end $term</a></strong><br />
228     </dt>
229     <dd>
230     Called just after the screen gets redrawn. See <code>on_refresh_begin</code>.
231     </dd>
232 root 1.5 <p></p>
233     <dt><strong><a name="item_on_keyboard_command__24term_2c__24string">on_keyboard_command $term, $string</a></strong><br />
234     </dt>
235     <dd>
236     Called whenever the user presses a key combination that has a
237     <code>perl:string</code> action bound to it (see description of the <strong>keysym</strong>
238     resource in the <code>rxvt(1)</code> manpage).
239     </dd>
240 root 1.1 <p></p></dl>
241     <p>
242     </p>
243     <h2><a name="functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></h2>
244     <dl>
245     <dt><strong><a name="item_urxvt_3a_3afatal__24errormessage">urxvt::fatal $errormessage</a></strong><br />
246     </dt>
247     <dd>
248     Fatally aborts execution with the given error message. Avoid at all
249     costs! The only time this is acceptable is when the terminal process
250     starts up.
251     </dd>
252     <p></p>
253     <dt><strong><a name="item_urxvt_3a_3awarn__24string">urxvt::warn $string</a></strong><br />
254     </dt>
255     <dd>
256 root 1.3 Calls <code>rxvt_warn</code> with the given string which should not include a
257 root 1.1 newline. The module also overwrites the <code>warn</code> builtin with a function
258     that calls this function.
259     </dd>
260     <dd>
261     <p>Using this function has the advantage that its output ends up in the
262     correct place, e.g. on stderr of the connecting urxvtc client.</p>
263     </dd>
264     <p></p>
265     <dt><strong><a name="item__24time__3d_urxvt_3a_3anow">$time = urxvt::NOW</a></strong><br />
266     </dt>
267     <dd>
268     Returns the ``current time'' (as per the event loop).
269     </dd>
270     <p></p></dl>
271     <p>
272     </p>
273     <h2><a name="the_urxvt__term_class">The <code>urxvt::term</code> Class</a></h2>
274     <dl>
275 root 1.2 <dt><strong><a name="item_resource">$value = $term-&gt;resource ($name[, $newval])</a></strong><br />
276     </dt>
277     <dd>
278     Returns the current resource value associated with a given name and
279     optionally sets a new value. Setting values is most useful in the <code>init</code>
280     hook. Unset resources are returned and accepted as <code>undef</code>.
281     </dd>
282     <dd>
283     <p>The new value must be properly encoded to a suitable character encoding
284     before passing it to this method. Similarly, the returned value may need
285     to be converted from the used encoding to text.</p>
286     </dd>
287     <dd>
288     <p>Resource names are as defined in <em>src/rsinc.h</em>. Colours can be specified
289     as resource names of the form <code>color+&lt;index&gt;</code>, e.g. <code>color+5</code>. (will
290     likely change).</p>
291     </dd>
292     <dd>
293     <p>Please note that resource strings will currently only be freed when the
294     terminal is destroyed, so changing options frequently will eat memory.</p>
295     </dd>
296     <dd>
297     <p>Here is a a likely non-exhaustive list of resource names, not all of which
298     are supported in every build, please see the source to see the actual
299     list:</p>
300     </dd>
301     <dd>
302     <pre>
303     answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont
304     borderLess color cursorBlink cursorUnderline cutchars delete_key
305     display_name embed ext_bwidth fade font geometry hold iconName
306     imFont imLocale inputMethod insecure int_bwidth intensityStyles
307 root 1.4 italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier
308     mouseWheelScrollPage name pastableTabs path perl_eval perl_ext
309 root 1.3 perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd
310     reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating
311     scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput
312     scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle
313     shade term_name title transparent transparent_all tripleclickwords
314     utmpInhibit visualBell</pre>
315 root 1.2 </dd>
316     <p></p>
317 root 1.1 <dt><strong><a name="item_selection_mark">($row, $col) = $term-&gt;selection_mark ([$row, $col])</a></strong><br />
318     </dt>
319     <dt><strong><a name="item_selection_beg">($row, $col) = $term-&gt;selection_beg ([$row, $col])</a></strong><br />
320     </dt>
321     <dt><strong><a name="item_selection_end">($row, $col) = $term-&gt;selection_end ([$row, $col])</a></strong><br />
322     </dt>
323     <dd>
324     Return the current values of the selection mark, begin or end positions,
325     and optionally set them to new values.
326     </dd>
327     <p></p>
328     <dt><strong><a name="item_selection_grab">$success = $term-&gt;selection_grab ($eventtime)</a></strong><br />
329     </dt>
330     <dd>
331     Try to request the primary selection from the server (for example, as set
332     by the next method).
333     </dd>
334     <p></p>
335 root 1.6 <dt><strong>$oldtext = $term-&gt;selection ([$newtext])</strong><br />
336 root 1.1 </dt>
337     <dd>
338     Return the current selection text and optionally replace it by <code>$newtext</code>.
339     </dd>
340     <p></p>
341     <dt><strong><a name="item_scr_overlay">$term-&gt;scr_overlay ($x, $y, $text)</a></strong><br />
342     </dt>
343     <dd>
344     Create a simple multi-line overlay box. See the next method for details.
345     </dd>
346     <p></p>
347     <dt><strong><a name="item_scr_overlay_new">$term-&gt;scr_overlay_new ($x, $y, $width, $height)</a></strong><br />
348     </dt>
349     <dd>
350     Create a new (empty) overlay at the given position with the given
351     width/height. A border will be put around the box. If either <code>$x</code> or
352     <code>$y</code> is negative, then this is counted from the right/bottom side,
353     respectively.
354     </dd>
355     <p></p>
356     <dt><strong><a name="item_scr_overlay_off">$term-&gt;scr_overlay_off</a></strong><br />
357     </dt>
358     <dd>
359     Switch the overlay off again.
360     </dd>
361     <p></p>
362     <dt><strong><a name="item_scr_overlay_set_char">$term-&gt;scr_overlay_set_char ($x, $y, $char, $rend = OVERLAY_RSTYLE)</a></strong><br />
363     </dt>
364     <dd>
365     Put a single character (specified numerically) at the given overlay
366     position.
367     </dd>
368     <p></p>
369     <dt><strong><a name="item_scr_overlay_set">$term-&gt;scr_overlay_set ($x, $y, $text)</a></strong><br />
370     </dt>
371     <dd>
372     Write a string at the given position into the overlay.
373     </dd>
374 root 1.3 <p></p>
375     <dt><strong><a name="item_strwidth">$cellwidth = $term-&gt;strwidth $string</a></strong><br />
376     </dt>
377     <dd>
378     Returns the number of screen-cells this string would need. Correctly
379     accounts for wide and combining characters.
380     </dd>
381     <p></p>
382     <dt><strong><a name="item_locale_encode">$octets = $term-&gt;locale_encode $string</a></strong><br />
383     </dt>
384     <dd>
385     Convert the given text string into the corresponding locale encoding.
386     </dd>
387     <p></p>
388     <dt><strong><a name="item_locale_decode">$string = $term-&gt;locale_decode $octets</a></strong><br />
389     </dt>
390     <dd>
391     Convert the given locale-encoded octets into a perl string.
392     </dd>
393     <p></p>
394     <dt><strong><a name="item_tt_write">$term-&gt;tt_write ($octets)</a></strong><br />
395     </dt>
396     <dd>
397     Write the octets given in <code>$data</code> to the tty (i.e. as program input). To
398 root 1.6 pass characters instead of octets, you should convert your strings first
399     to the locale-specific encoding using <a href="#item_locale_encode"><code>$term-&gt;locale_encode</code></a>.
400     </dd>
401     <p></p>
402     <dt><strong><a name="item_nrow">$nrow = $term-&gt;nrow</a></strong><br />
403     </dt>
404     <dt><strong><a name="item_ncol">$ncol = $term-&gt;ncol</a></strong><br />
405     </dt>
406     <dd>
407     Return the number of rows/columns of the terminal window (i.e. as
408     specified by <code>-geometry</code>, excluding any scrollback).
409     </dd>
410     <p></p>
411     <dt><strong><a name="item_nsaved">$nsaved = $term-&gt;nsaved</a></strong><br />
412     </dt>
413     <dd>
414     Returns the number of lines in the scrollback buffer.
415     </dd>
416     <p></p>
417     <dt><strong><a name="item_view_start">$view_start = $term-&gt;view_start ([$newvalue])</a></strong><br />
418     </dt>
419     <dd>
420     Returns the negative row number of the topmost line. Minimum value is
421     <code>0</code>, which displays the normal terminal contents. Larger values scroll
422     this many lines into the scrollback buffer.
423     </dd>
424     <p></p>
425     <dt><strong><a name="item_want_refresh">$term-&gt;want_refresh</a></strong><br />
426     </dt>
427     <dd>
428     Requests a screen refresh. At the next opportunity, rxvt-unicode will
429     compare the on-screen display with its stored representation. If they
430     differ, it redraws the differences.
431     </dd>
432     <dd>
433     <p>Used after changing terminal contents to display them.</p>
434     </dd>
435     <p></p>
436     <dt><strong><a name="item_row_t">$text = $term-&gt;ROW_t ($row_number[, $new_text[, $start_col]])</a></strong><br />
437     </dt>
438     <dd>
439     Returns the text of the entire row with number <code>$row_number</code>. Row <code>0</code>
440     is the topmost terminal line, row <code>$term-&gt;$ncol-1</code> is the bottommost
441     terminal line. The scrollback buffer starts at line <code>-1</code> and extends to
442     line <a href="#item_nsaved"><code>-$term-&gt;nsaved</code></a>.
443     </dd>
444     <dd>
445     <p>If <code>$new_text</code> is specified, it will replace characters in the current
446     line, starting at column <code>$start_col</code> (default <code>0</code>), which is useful
447     to replace only parts of a line. The font iindex in the rendition will
448     automatically be updated.</p>
449     </dd>
450     <dd>
451     <p><code>$text</code> is in a special encoding: tabs and wide characters that use more
452     than one cell when displayed are padded with urxvt::NOCHAR characters
453     (<code>chr 65535</code>). Characters with combining characters and other characters
454     that do not fit into the normal tetx encoding will be replaced with
455     characters in the private use area.</p>
456     </dd>
457     <dd>
458     <p>You have to obey this encoding when changing text. The advantage is
459     that <code>substr</code> and similar functions work on screen cells and not on
460     characters.</p>
461     </dd>
462     <dd>
463     <p>The methods <a href="#item_special_encode"><code>$term-&gt;special_encode</code></a> and <a href="#item_special_decode"><code>$term-&gt;special_decode</code></a>
464     can be used to convert normal strings into this encoding and vice versa.</p>
465     </dd>
466     <p></p>
467     <dt><strong><a name="item_row_r">$rend = $term-&gt;ROW_r ($row_number[, $new_rend[, $start_col]])</a></strong><br />
468     </dt>
469     <dd>
470     Like <a href="#item_row_t"><code>$term-&gt;ROW_t</code></a>, but returns an arrayref with rendition
471     bitsets. Rendition bitsets contain information about colour, font, font
472     styles and similar information. See also <a href="#item_row_t"><code>$term-&gt;ROW_t</code></a>.
473     </dd>
474     <dd>
475     <p>When setting rendition, the font mask will be ignored.</p>
476     </dd>
477     <dd>
478     <p>See the section on RENDITION, below.</p>
479     </dd>
480     <p></p>
481     <dt><strong><a name="item_row_l">$length = $term-&gt;ROW_l ($row_number[, $new_length])</a></strong><br />
482     </dt>
483     <dd>
484     Returns the number of screen cells that are in use (``the line length''). If
485     it is <code>-1</code>, then the line is part of a multiple-row logical ``line'', which
486     means all characters are in use and it is continued on the next row.
487     </dd>
488     <p></p>
489     <dt><strong><a name="item_special_encode">$text = $term-&gt;special_encode $string</a></strong><br />
490     </dt>
491     <dd>
492     Converts a perl string into the special encoding used by rxvt-unicode,
493     where one character corresponds to one screen cell. See
494     <a href="#item_row_t"><code>$term-&gt;ROW_t</code></a> for details.
495     </dd>
496     <p></p>
497     <dt><strong><a name="item_special_decode">$string = $term-&gt;special_decode $text</a></strong><br />
498     </dt>
499     <dd>
500     Converts rxvt-unicodes text reprsentation into a perl string. See
501     <a href="#item_row_t"><code>$term-&gt;ROW_t</code></a> for details.
502     </dd>
503     <p></p></dl>
504     <p>
505     </p>
506     <h2><a name="rendition">RENDITION</a></h2>
507     <p>Rendition bitsets contain information about colour, font, font styles and
508     similar information for each screen cell.</p>
509     <p>The following ``macros'' deal with changes in rendition sets. You should
510     never just create a bitset, you should always modify an existing one,
511     as they contain important information required for correct operation of
512     rxvt-unicode.</p>
513     <dl>
514     <dt><strong><a name="item__24rend__3d_urxvt_3a_3adefault_rstyle">$rend = urxvt::DEFAULT_RSTYLE</a></strong><br />
515     </dt>
516     <dd>
517     Returns the default rendition, as used when the terminal is starting up or
518     being reset. Useful as a base
519 root 1.3 </dd>
520 root 1.1 <p></p></dl>
521     <p>
522     </p>
523     <h2><a name="the_urxvt__timer_class">The <code>urxvt::timer</code> Class</a></h2>
524     <p>This class implements timer watchers/events. Time is represented as a
525     fractional number of seconds since the epoch. Example:</p>
526     <pre>
527     # create a digital clock display in upper right corner
528     $term-&gt;{timer} = urxvt::timer
529     -&gt;new
530     -&gt;start (urxvt::NOW)
531     -&gt;cb (sub {
532     my ($timer) = @_;
533     my $time = $timer-&gt;at;
534     $timer-&gt;start ($time + 1);
535     $self-&gt;scr_overlay (-1, 0,
536     POSIX::strftime &quot;%H:%M:%S&quot;, localtime $time);
537     });</pre>
538     <dl>
539     <dt><strong><a name="item__24timer__3d_new_urxvt_3a_3atimer">$timer = new urxvt::timer</a></strong><br />
540     </dt>
541     <dd>
542     Create a new timer object in stopped state.
543     </dd>
544     <p></p>
545     <dt><strong><a name="item_cb">$timer = $timer-&gt;cb (sub { my ($timer) = @_; ... })</a></strong><br />
546     </dt>
547     <dd>
548     Set the callback to be called when the timer triggers.
549     </dd>
550     <p></p>
551     <dt><strong><a name="item_at">$tstamp = $timer-&gt;at</a></strong><br />
552     </dt>
553     <dd>
554     Return the time this watcher will fire next.
555     </dd>
556     <p></p>
557     <dt><strong><a name="item_set">$timer = $timer-&gt;set ($tstamp)</a></strong><br />
558     </dt>
559     <dd>
560     Set the time the event is generated to $tstamp.
561     </dd>
562     <p></p>
563     <dt><strong><a name="item_start">$timer = $timer-&gt;start</a></strong><br />
564     </dt>
565     <dd>
566     Start the timer.
567     </dd>
568     <p></p>
569     <dt><strong>$timer = $timer-&gt;start ($tstamp)</strong><br />
570     </dt>
571     <dd>
572     Set the event trigger time to <code>$tstamp</code> and start the timer.
573     </dd>
574     <p></p>
575     <dt><strong><a name="item_stop">$timer = $timer-&gt;stop</a></strong><br />
576     </dt>
577     <dd>
578     Stop the timer.
579     </dd>
580     <p></p></dl>
581     <p>
582     </p>
583     <h2><a name="the_urxvt__iow_class">The <code>urxvt::iow</code> Class</a></h2>
584     <p>This class implements io watchers/events. Example:</p>
585     <pre>
586     $term-&gt;{socket} = ...
587     $term-&gt;{iow} = urxvt::iow
588     -&gt;new
589     -&gt;fd (fileno $term-&gt;{socket})
590     -&gt;events (1) # wait for read data
591     -&gt;start
592     -&gt;cb (sub {
593     my ($iow, $revents) = @_;
594     # $revents must be 1 here, no need to check
595     sysread $term-&gt;{socket}, my $buf, 8192
596     or end-of-file;
597     });</pre>
598     <dl>
599     <dt><strong><a name="item__24iow__3d_new_urxvt_3a_3aiow">$iow = new urxvt::iow</a></strong><br />
600     </dt>
601     <dd>
602     Create a new io watcher object in stopped state.
603     </dd>
604     <p></p>
605     <dt><strong>$iow = $iow-&gt;cb (sub { my ($iow, $reventmask) = @_; ... })</strong><br />
606     </dt>
607     <dd>
608     Set the callback to be called when io events are triggered. <code>$reventmask</code>
609     is a bitset as described in the <a href="#item_events"><code>events</code></a> method.
610     </dd>
611     <p></p>
612     <dt><strong><a name="item_fd">$iow = $iow-&gt;fd ($fd)</a></strong><br />
613     </dt>
614     <dd>
615     Set the filedescriptor (not handle) to watch.
616     </dd>
617     <p></p>
618     <dt><strong><a name="item_events">$iow = $iow-&gt;events ($eventmask)</a></strong><br />
619     </dt>
620     <dd>
621     Set the event mask to watch. Bit #0 (value <code>1</code>) enables watching for read
622     data, Bit #1 (value <code>2</code>) enables watching for write data.
623     </dd>
624     <p></p>
625     <dt><strong>$iow = $iow-&gt;start</strong><br />
626     </dt>
627     <dd>
628     Start watching for requested events on the given handle.
629     </dd>
630     <p></p>
631     <dt><strong>$iow = $iow-&gt;stop</strong><br />
632     </dt>
633     <dd>
634     Stop watching for events on the given filehandle.
635     </dd>
636     <p></p></dl>
637     <p>
638     </p>
639     <hr />
640 root 1.2 <h1><a name="environment">ENVIRONMENT</a></h1>
641     <p>
642     </p>
643     <h2><a name="urxvt_perl_verbosity">URXVT_PERL_VERBOSITY</a></h2>
644     <p>This variable controls the verbosity level of the perl extension. Higher
645     numbers indicate more verbose output.</p>
646     <ol>
647     <li><strong><a name="item__2d_only_fatal_messages">- only fatal messages</a></strong><br />
648     </li>
649     <li><strong><a name="item__2d_script_loading_and_management">- script loading and management</a></strong><br />
650     </li>
651     <li><strong><a name="item__2d_all_events_received">- all events received</a></strong><br />
652     </li>
653     </ol>
654     <p>
655     </p>
656     <hr />
657 root 1.1 <h1><a name="author">AUTHOR</a></h1>
658     <pre>
659     Marc Lehmann &lt;pcg@goof.com&gt;
660     <a href="http://software.schmorp.de/pkg/rxvt-unicode">http://software.schmorp.de/pkg/rxvt-unicode</a></pre>
661    
662     </body>
663    
664     </html>