Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ProphET_standalone.pl to use RealBin #39

Open
microbioticajon opened this issue Sep 11, 2019 · 4 comments
Open

Update ProphET_standalone.pl to use RealBin #39

microbioticajon opened this issue Sep 11, 2019 · 4 comments

Comments

@microbioticajon
Copy link

Hi Guys, thought I would make an issue for this PR: #37

Changed GFFLib import to look in the physical location of the ProphET_standalone.pl script using FindBin::RealBin. Currently the code uses FindBin::Bin which will not follow symbolic links if, for example, you symlink /opt/prophet/ProphET_standalone.pl to: /usr/local/bin/ProphET_standalone.pl

I have checked this change with ProphET_standalone.pl -h but not much further...

Cheers,
Jon

@microbioticajon
Copy link
Author

Oddly, I think this might be related to: #38

@tseemann
Copy link

I use my $EXE = $FindBin::RealScript; all the time. It follows symlinks.

@microbioticajon
Copy link
Author

microbioticajon commented Sep 18, 2019

I use my $EXE = $FindBin::RealScript; all the time. It follows symlinks.

Hi @tseemann, thanks for the reply!

You are correct FindBin::RealScrip will follow symlinks as you would expect. However, ProphET_standalone.pl uses FindBin::Bin not FindBin::RealBin. As such it wont find the shipped GFFLib as it is looking in a path relative to the symlink not the concrete file.

In ProphET_standalone.pl, change:

use lib "$FindBin::Bin/UTILS.dir/GFFLib";

to:

use lib "$FindBin::RealBin/UTILS.dir/GFFLib";

This way you dont need to add:
export PERL5LIB <Folder_you_installed_prophet>/UTILS.dir/GFFLib

For the purpose of others coming across this, the following docs explain the difference https://metacpan.org/pod/FindBin::Real

Bin

  • path to bin directory from where script was invoked

RealBin

  • Bin() with all links resolved

I hope this helps clarify my problem :)

@tseemann
Copy link

tseemann commented Sep 30, 2019

Yep - i use the same system in all my tools.

SRC
+- bin
    +- tool
+- perl5
    +- MyModule.pm
% head bin/tool

use FindBin;
use lib "$FindBin::RealBin/../perl5";
use MyModule;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants