# problem with math/algotutor



## bkouhi (Jun 11, 2013)

Hi.

I've installed math/algotutor but when I run:

`% algotutor`

This error message will be shown:


```
Can't locate utilalgo in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.8.8/algotutor /usr/local/lib/perl5/5.14.2/BSDPAN /usr/local/lib/perl5/site_perl/5.14.2/mach /usr/local/lib/perl5/site_perl/5.14.2 /usr/local/lib/perl5/5.14.2/mach /usr/local/lib/perl5/5.14.2 . /usr/local/bin/) at /usr/local/bin/algotutor line 28.
```

This is line 28 of /usr/local/bin/algotutor (it is a perl script):


```
require "utilalgo";
```

That file is here:

```
[CMD]% find /usr/local/ -name utilalgo[/CMD]
/usr/local/lib/perl5/site_perl/5.14.2/algotutor/utilalgo
```

How can I fix it?


----------



## fonz (Jun 11, 2013)

bkouhi said:
			
		

> ```
> Can't locate utilalgo in @INC (@INC contains: /usr/local/lib/perl5/site_perl/[u]5.8.8[/u]/algotutor /usr/local/lib/perl5/5.14.2/BSDPAN /usr/local/lib/perl5/site_perl/5.14.2/mach /usr/local/lib/perl5/site_perl/5.14.2 /usr/local/lib/perl5/5.14.2/mach /usr/local/lib/perl5/5.14.2 . /usr/local/bin/) at /usr/local/bin/algotutor line 28.
> ```
> [snip]
> ...


See the underlines. If you're lucky, you can fix it by simply adding the actual path to utilalgo to the script's @INC. If not, you could use symlinks as a workaround until it gets fixed properly.

In any case, please verify that both Perl and math/algotutor are up to date and notify the port maintainer if the discrepancy persists.


----------



## bkouhi (Jun 11, 2013)

Thanks. That works. I found this line in the /usr/local/bin/algotutor:


```
use lib '/usr/local/lib/perl5/site_perl/[U]5.8.8[/U]/algotutor';
```

And then changed it to:

```
use lib '/usr/local/lib/perl5/site_perl/[U]5.14.2[/U]/algotutor';
```

And now it works. My ports are up to date and I don't have anything special in my make.conf, so I will send a PR for this.


----------



## fonz (Jun 11, 2013)

Be sure to include a patch, that tends to speed up things.


----------



## ShelLuser (Jun 11, 2013)

There's definitely something peculiar with this port, but given my limited experience with ports I can't say for sure if this is an oddity or not.

But if you check out the patches which will be applied to this port (see file/patch-algotutor) then this immediately stands out for me:


```
use strict;
 use Getopt::Std;
-use lib '/usr/share/perl5/algotutor';
+use lib '!!PREFIX!!/lib/perl5/site_perl/5.8.8/algotutor';
```
I would have expected some dynamic variable to be used instead of a hard coded version.


----------



## bkouhi (Jun 11, 2013)

Yes, the perl version is hard coded in files/patch-algotutor. I sent the PR: PR ports/179489


----------



## fonz (Jun 11, 2013)

ShelLuser said:
			
		

> ```
> use strict;
> use Getopt::Std;
> -use lib '/usr/share/perl5/algotutor';
> ...


Ick, I don't like the looks of that. I'd expect something like this:

```
use strict;
 use Getopt::Std;
-use lib '/usr/share/perl5/algotutor';
+use lib '!!PREFIX!!/share/perl5/algotutor';
```


----------



## bkouhi (Jun 11, 2013)

fonz said:
			
		

> Ick, I don't like the looks of that. I'd expect something like this:
> 
> 
> ```
> ...


----------



## fonz (Jun 11, 2013)

bkouhi said:
			
		

> because it's not a cpan.org project.
> [snip]
> for this reason it should be installed into ${SITE_PERL}.


Fair enough. However, that does bring us back to @ShelLuser's point: the patch in /usr/ports/math/algotutor/files/ has a specific (and old, as it turns out) version of Perl hardcoded in it, where a variable or some other dynamic construct probably makes more sense.


----------



## bkouhi (Jun 11, 2013)

Yes, the perl version is hard coded in that file, but I fixed this by the patch included in my PR. (6th post)


----------



## fonz (Jun 11, 2013)

bkouhi said:
			
		

> I fixed this by the patch included in my PR. (6th post)


Yes, I've seen it. Looks good, now let's hope the maintainer picks it up soon.


----------

