Menu

Run Ignores Include Path

Help
2007-03-10
2013-05-20
  • David Lloyd

    David Lloyd - 2007-03-10

    My include path includes:

    ${project_loc}

    I didn't do that - I used add to list, navigated the file system and pointed at the project's location on disk. I presume that the plugin realised that I was actually pointing to the same location as an Eclipse variable and displayed it as that.

    I have this on:

    project_loc

    - server.pl
    - Server.pm

    Let's say I run this:

    #!/usr/bin/perl

    use strict;
    use warnings;

    #use Server;

    print join ("\n", @INC) . "\n";

    This will print out this:

    /usr/perl5/5.8.4/lib/i86pc-solaris-64int
    /usr/perl5/5.8.4/lib
    /usr/perl5/site_perl/5.8.4/i86pc-solaris-64int
    /usr/perl5/site_perl/5.8.4
    /usr/perl5/site_perl
    /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int
    /usr/perl5/vendor_perl/5.8.4
    /usr/perl5/vendor_perl
    .

    Note that ${project_loc} is not printed out.

    If I do this:
    #!/usr/bin/perl

    use strict;
    use warnings;

    use Server;

    print join ("\n", @INC) . "\n";

    The syntax highlighter will NOT complain, however if I run that I get this:

    Can't locate Server.pm in @INC (@INC contains: /usr/perl5/5.8.4/lib/i86pc-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/i86pc-solaris-64int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl .) at /home/lloy0076/work/programming/eclipse/Server/server.pl line 6.
    BEGIN failed--compilation aborted at /home/lloy0076/work/programming/eclipse/Server/server.pl line 6.

    NOTE: If I navigate on the command line to ${project_loc} and manually run "perl server.pl" it won't complain.

    Anyone know what's up here?

    DSL

     
    • Jan Ploski

      Jan Ploski - 2007-03-10

      Your description is confusing. Please mention:
      - where the workspace is located in the file system (absolute path)
      - what absolute path project_loc points to
      - where each of your files is located in the file system (absolute path)
      - to which file the quoted source code belongs
      - which working directory do you run in whatever you run

      Alternatively, I suggest the following organization for your code

      /home/lloy0076/workspace/project/bin/server.pl   (contains use Server;)
      /home/lloy0076/workspace/project/lib/Server.pm   (contains package Server;)

      Given that, add 'lib' (the relative path) to the @INC in project properties.
      Everything (including setting breakpoints in Server.pm) should work fine then.

       

Log in to post a comment.

MongoDB Logo MongoDB