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.213 by root, Wed Jun 6 15:09:49 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 {
1027 1027
1028 open my $fh, "<:raw", $path 1028 open my $fh, "<:raw", $path
1029 or die "$path: $!"; 1029 or die "$path: $!";
1030 1030
1031 my $source = 1031 my $source =
1032 "package $pkg; use strict; use utf8; no warnings 'utf8';\n" 1032 "package $pkg; use strict 'vars'; use utf8; no warnings 'utf8';\n"
1033 . "#line 1 \"$path\"\n{\n" 1033 . "#line 1 \"$path\"\n{\n"
1034 . (do { local $/; <$fh> }) 1034 . (do { local $/; <$fh> })
1035 . "\n};\n1"; 1035 . "\n};\n1";
1036 1036
1037 eval $source 1037 eval $source
1060 my @pkg = @TERM_EXT; 1060 my @pkg = @TERM_EXT;
1061 @TERM_EXT = (); 1061 @TERM_EXT = ();
1062 $TERM->register_package ($_) for @pkg; 1062 $TERM->register_package ($_) for @pkg;
1063 } 1063 }
1064 1064
1065 for (
1066 @{ delete $TERM->{perl_ext_3} },
1065 for (grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) { 1067 grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2
1068 ) {
1066 if ($_ eq "default") { 1069 if ($_ eq "default") {
1067 $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);
1068 } elsif (/^-(.*)$/) { 1071 } elsif (/^-(.*)$/) {
1069 delete $ext_arg{$1}; 1072 delete $ext_arg{$1};
1070 } elsif (/^([^<]+)<(.*)>$/) { 1073 } elsif (/^([^<]+)<(.*)>$/) {
1360 or next; 1363 or next;
1361 1364
1362 while (<$fh>) { 1365 while (<$fh>) {
1363 if (/^#:META:X_RESOURCE:(.*)/) { 1366 if (/^#:META:X_RESOURCE:(.*)/) {
1364 my ($pattern, $type, $desc) = split /:/, $1; 1367 my ($pattern, $type, $desc) = split /:/, $1;
1365 $pattern =~ s/^%(?:\.|$)/$ext./g; # % in pattern == extension name 1368 $pattern =~ s/^%(\.|$)/$ext$1/g; # % in pattern == extension name
1366 if ($pattern =~ /[^a-zA-Z0-9\-\.]/) { 1369 if ($pattern =~ /[^a-zA-Z0-9\-\.]/) {
1367 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";
1368 } else { 1371 } else {
1369 $meta{resource}{$pattern} = [$ext, $type, $desc]; 1372 $meta{resource}{$pattern} = [$ext, $type, $desc];
1370 } 1373 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines