… | |
… | |
20 | =head1 DESCRIPTION |
20 | =head1 DESCRIPTION |
21 | |
21 | |
22 | Every time a terminal object gets created, extension scripts specified via |
22 | Every time a terminal object gets created, extension scripts specified via |
23 | the C<perl> resource are loaded and associated with it. |
23 | the C<perl> resource are loaded and associated with it. |
24 | |
24 | |
25 | Scripts are compiled in a 'use strict' and 'use utf8' environment, and |
25 | Scripts are compiled in a 'use strict "vars"' and 'use utf8' environment, and |
26 | thus must be encoded as UTF-8. |
26 | thus must be encoded as UTF-8. |
27 | |
27 | |
28 | Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where |
28 | Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where |
29 | scripts will be shared (but not enabled) for all terminals. |
29 | scripts will be shared (but not enabled) for all terminals. |
30 | |
30 | |
… | |
… | |
755 | =cut |
755 | =cut |
756 | |
756 | |
757 | package urxvt; |
757 | package urxvt; |
758 | |
758 | |
759 | use utf8; |
759 | use utf8; |
760 | use strict; |
760 | use strict 'vars'; |
761 | use Carp (); |
761 | use Carp (); |
762 | use Scalar::Util (); |
762 | use Scalar::Util (); |
763 | use List::Util (); |
763 | use List::Util (); |
764 | |
764 | |
765 | our $VERSION = 1; |
765 | our $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 (/^([^<]+)<(.*)>$/) { |