Opened 5 years ago

Closed 2 years ago

#474 closed defect (not relevant)

Syntax checker ignores included dirs

Reported by: Casan Owned by:
Priority: major Milestone:
Component: Syntax Checking Version: 0.50
Keywords: Cc:

Description

From Sewi on #Padre:

I'm using 0.41 rev 6626 and didn't see any fix here since downloading. I identified it in Padre/Task/SyntaxChecker/Perl?.pm lines 69 and 76

The syntax checker ignores included dirs (from#!/usr/bin/perl -I and perl-arguments in settings).

Existing modules/functions are shown as missing.

Reproducing is easy: Open any file from a project which has own Modules, switch the syntax checker on and you're done :-)

Line 69 in Padre/Task/SyntaxChecker/Perl?.pm needs to add -I parameters forany include dirs added. I don't know how to get this information for a file/project, so I can'tfix it. :-(

I just opened an existing perl file, but the Perl.pm doesn't include support for any extra parameters. All of them are fixed.

The second issue is in line 78. The Checker is being run from the current dir(or Padres cwd, but I didn't manage to get a value into $self->{cwd}), but it could just use my $pushd = File::pushd::pushd(Padre::Current->project->root);

But this issues an "can't call method project_find on unblessed reference inPadre/Document.pm line 836" error.

Change History (7)

comment:1 Changed 5 years ago by Casan

From Sewi:

I added my -I to the push in line 69 and the pushd to the projects's home(entered statically) in line 78 - and the syntax checker worked.

comment:2 Changed 5 years ago by claudio

The same problem happens when using "use lib" or "use FindBin?". E.g.:

use lib 'lib'; # Use the lib dir in the cwd: ./lib/

use FindBin?;
use lib "$FindBin::Bin/lib"; # Use the lib dir in the directory of the perl script

The syntax checker shows "/tmp/lib" in @INC meaning it uses a temporary copy in tmp to run the script (no surprise there). The tricky thing is to add the FindBin? dirs (and maybe .) to @INC before running the temporary copy.

comment:3 Changed 5 years ago by mateu

  • Version changed from 0.41 to 0.50

When I add a line like:

use lib '/path/to/my/lib';

it will quiet the syntax check/highlight. In other words, a full path will be acknowledged but a relative one won't.

This comment is for version 0.50

comment:4 Changed 4 years ago by zenogantner

This is related to #381, I guess.

comment:5 Changed 4 years ago by zenogantner

Works now fine withing project, the only problem is that it does not work for modules that are not in something that Padre recognizes as a project:
Syntax checking works if you have Bla.pm that includes Bla::OneModule, but it does not work if you open Bla::OneModule}} that includes {{{Bla::AnotherModule, because then the current working directory for the perl -C call is Bla/.

comment:6 Changed 3 years ago by szabgab

  • Component changed from editor to Syntax Checking

comment:7 Changed 2 years ago by bowtie

  • Resolution set to not relevant
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.