ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/urxvt.pm
(Generate patch)

Comparing rxvt-unicode/src/urxvt.pm (file contents):
Revision 1.98 by root, Tue Jan 17 17:01:54 2006 UTC vs.
Revision 1.100 by root, Wed Jan 18 08:33:34 2006 UTC

165overlays or changes. 165overlays or changes.
166 166
167=item selection-pastebin 167=item selection-pastebin
168 168
169This is a little rarely useful extension that Uploads the selection as 169This is a little rarely useful extension that Uploads the selection as
170textfile to a remote site (or does other things). 170textfile to a remote site (or does other things). (The implementation is
171not currently secure for use in a multiuser environment as it writes to
172F</tmp> directly.).
171 173
172It listens to the C<selection-pastebin:remote-pastebin> keyboard command, 174It listens to the C<selection-pastebin:remote-pastebin> keyboard command,
173i.e. 175i.e.
174 176
175 URxvt.keysym.C-M-e: perl:selection-pastebin:remote-pastebin 177 URxvt.keysym.C-M-e: perl:selection-pastebin:remote-pastebin
593=back 595=back
594 596
595=cut 597=cut
596 598
597BEGIN { 599BEGIN {
598 urxvt->bootstrap;
599
600 # overwrite perl's warn 600 # overwrite perl's warn
601 *CORE::GLOBAL::warn = sub { 601 *CORE::GLOBAL::warn = sub {
602 my $msg = join "", @_; 602 my $msg = join "", @_;
603 $msg .= "\n" 603 $msg .= "\n"
604 unless $msg =~ /\n$/; 604 unless $msg =~ /\n$/;
617sub verbose { 617sub verbose {
618 my ($level, $msg) = @_; 618 my ($level, $msg) = @_;
619 warn "$msg\n" if $level <= $verbosity; 619 warn "$msg\n" if $level <= $verbosity;
620} 620}
621 621
622my $extension_pkg = "extension0000";
623my %extension_pkg; 622my %extension_pkg;
624 623
625# load a single script into its own package, once only 624# load a single script into its own package, once only
626sub extension_package($) { 625sub extension_package($) {
627 my ($path) = @_; 626 my ($path) = @_;
628 627
628 no strict 'refs';
629
629 $extension_pkg{$path} ||= do { 630 $extension_pkg{$path} ||= do {
630 my $pkg = "urxvt::" . ($extension_pkg++); 631 $path =~ /([^\/\\]+)$/;
632 my $pkg = $1;
633 $pkg =~ s/[^[:word:]]/_/g;
634 $pkg = "urxvt::ext::$pkg";
631 635
632 verbose 3, "loading extension '$path' into package '$pkg'"; 636 verbose 3, "loading extension '$path' into package '$pkg'";
633 637
634 open my $fh, "<:raw", $path 638 open my $fh, "<:raw", $path
635 or die "$path: $!"; 639 or die "$path: $!";
636 640
641 @{"$pkg\::ISA"} = urxvt::term::extension::;
642
637 my $source = 643 my $source =
638 "package $pkg; use strict; use utf8;\n" 644 "package $pkg; use strict; use utf8;\n"
639 . "use base urxvt::term::extension::;\n"
640 . "#line 1 \"$path\"\n{\n" 645 . "#line 1 \"$path\"\n{\n"
641 . (do { local $/; <$fh> }) 646 . (do { local $/; <$fh> })
642 . "\n};\n1"; 647 . "\n};\n1";
643 648
644 eval $source 649 eval $source

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines