Closed bmartin closed 2 years ago
I was issue #2 able to fix this in my copy by adding:
--- a/Perl/LanguageServer/SyntaxChecker.pm +++ b/Perl/LanguageServer/SyntaxChecker.pm @@ -140,6 +140,8 @@ sub background_checker $text = eval { Encode::encode ('utf-8', $text) ; } ; $self -> logger ($@) if ($@) ; + my ($file) = ($uri =~ m{^file://(.*)}); + $text = "local \$0; BEGIN { \$0 = '$file'; if (\$INC{'FindBin.pm'}) { FindBin->again(); } }\n# line 1 \"$file\"\n" . $text; my $ret ; my $errout ; my $out ;
This fixes $0, FindBin:*, and __FILE__. See perlsyn Plain-old-comment (not!) for how it fixes __FILE__ and __LINE__.
$0
FindBin:*
__FILE__
__LINE__
It feels like this is probably function is probably the wrong place to put this fix.
Originally posted by @bmartin in https://github.com/richterger/Perl-LanguageServer/issues/2#issuecomment-602275026
Thank you!
I was issue #2 able to fix this in my copy by adding:
This fixes
$0
,FindBin:*
, and__FILE__
. See perlsyn Plain-old-comment (not!) for how it fixes__FILE__
and__LINE__
.It feels like this is probably function is probably the wrong place to put this fix.
Originally posted by @bmartin in https://github.com/richterger/Perl-LanguageServer/issues/2#issuecomment-602275026