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.212 by root, Wed Jun 6 15:06:41 2012 UTC vs.
Revision 1.215 by root, Thu Jun 7 16:30:58 2012 UTC

20=head1 DESCRIPTION 20=head1 DESCRIPTION
21 21
22Every time a terminal object gets created, extension scripts specified via 22Every time a terminal object gets created, extension scripts specified via
23the C<perl> resource are loaded and associated with it. 23the C<perl> resource are loaded and associated with it.
24 24
25Scripts are compiled in a 'use strict' and 'use utf8' environment, and 25Scripts are compiled in a 'use strict "vars"' and 'use utf8' environment, and
26thus must be encoded as UTF-8. 26thus must be encoded as UTF-8.
27 27
28Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where 28Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where
29scripts will be shared (but not enabled) for all terminals. 29scripts will be shared (but not enabled) for all terminals.
30 30
755=cut 755=cut
756 756
757package urxvt; 757package urxvt;
758 758
759use utf8; 759use utf8;
760use strict; 760use strict 'vars';
761use Carp (); 761use Carp ();
762use Scalar::Util (); 762use Scalar::Util ();
763use List::Util (); 763use List::Util ();
764 764
765our $VERSION = 1; 765our $VERSION = 1;
959 ? $pattern eq substr $name, 0, length $pattern 959 ? $pattern eq substr $name, 0, length $pattern
960 : $pattern eq $name 960 : $pattern eq $name
961 ) { 961 ) {
962 $name = "$urxvt::RESCLASS.$name"; 962 $name = "$urxvt::RESCLASS.$name";
963 963
964 push @TERM_EXT, $v->[0]; 964 push @{ $term->{perl_ext_3} }, $v->[0];
965 965
966 if ($v->[1] eq "boolean") { 966 if ($v->[1] eq "boolean") {
967 $term->put_option_db ($name, $flag ? "true" : "false"); 967 $term->put_option_db ($name, $flag ? "true" : "false");
968 return 1; 968 return 1;
969 } else { 969 } else {
996 urxvt::log sprintf " -%-30s %s\n", "/+$pattern", $desc; 996 urxvt::log sprintf " -%-30s %s\n", "/+$pattern", $desc;
997 } else { 997 } else {
998 urxvt::log sprintf " -%-30s %s\n", "$pattern $type", $desc; 998 urxvt::log sprintf " -%-30s %s\n", "$pattern $type", $desc;
999 } 999 }
1000 } else { 1000 } else {
1001 $pattern =~ s/\.$/.*/g;
1001 urxvt::log sprintf " %-31s %s\n", "$pattern:", $type; 1002 urxvt::log sprintf " %-31s %s\n", "$pattern:", $type;
1002 } 1003 }
1003 } 1004 }
1004} 1005}
1005 1006
1026 1027
1027 open my $fh, "<:raw", $path 1028 open my $fh, "<:raw", $path
1028 or die "$path: $!"; 1029 or die "$path: $!";
1029 1030
1030 my $source = 1031 my $source =
1031 "package $pkg; use strict; use utf8; no warnings 'utf8';\n" 1032 "package $pkg; use strict 'vars'; use utf8; no warnings 'utf8';\n"
1032 . "#line 1 \"$path\"\n{\n" 1033 . "#line 1 \"$path\"\n{\n"
1033 . (do { local $/; <$fh> }) 1034 . (do { local $/; <$fh> })
1034 . "\n};\n1"; 1035 . "\n};\n1";
1035 1036
1036 eval $source 1037 eval $source
1059 my @pkg = @TERM_EXT; 1060 my @pkg = @TERM_EXT;
1060 @TERM_EXT = (); 1061 @TERM_EXT = ();
1061 $TERM->register_package ($_) for @pkg; 1062 $TERM->register_package ($_) for @pkg;
1062 } 1063 }
1063 1064
1065 for (
1066 @{ delete $TERM->{perl_ext_3} },
1064 for (grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) { 1067 grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2
1068 ) {
1065 if ($_ eq "default") { 1069 if ($_ eq "default") {
1066 $ext_arg{$_} ||= [] for qw(selection option-popup selection-popup searchable-scrollback readline); 1070 $ext_arg{$_} ||= [] for qw(selection option-popup selection-popup searchable-scrollback readline);
1067 } elsif (/^-(.*)$/) { 1071 } elsif (/^-(.*)$/) {
1068 delete $ext_arg{$1}; 1072 delete $ext_arg{$1};
1069 } elsif (/^([^<]+)<(.*)>$/) { 1073 } elsif (/^([^<]+)<(.*)>$/) {
1359 or next; 1363 or next;
1360 1364
1361 while (<$fh>) { 1365 while (<$fh>) {
1362 if (/^#:META:X_RESOURCE:(.*)/) { 1366 if (/^#:META:X_RESOURCE:(.*)/) {
1363 my ($pattern, $type, $desc) = split /:/, $1; 1367 my ($pattern, $type, $desc) = split /:/, $1;
1364 $pattern =~ s/^%(?:\.|$)/$ext./g; # % in pattern == extension name 1368 $pattern =~ s/^%(\.|$)/$ext$1/g; # % in pattern == extension name
1365 if ($pattern =~ /[^a-zA-Z\.]/) { 1369 if ($pattern =~ /[^a-zA-Z0-9\-\.]/) {
1366 warn "$dir/$ext: meta resource '$pattern' contains illegal characters (not alphanumeric nor . nor *)\n"; 1370 warn "$dir/$ext: meta resource '$pattern' contains illegal characters (not alphanumeric nor . nor *)\n";
1367 } else { 1371 } else {
1368 $meta{resource}{$pattern} = [$ext, $type, $desc]; 1372 $meta{resource}{$pattern} = [$ext, $type, $desc];
1369 } 1373 }
1370 } elsif (/^\s*(?:#|$)/) { 1374 } elsif (/^\s*(?:#|$)/) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines