Re: Why Can't locate auto/Heap/add.al?
On Thu, 5 Jun 2003, Ying Liu wrote: I finally install the Heap module. But I run the example of the CPAN: foreach $i ( 1..100 ) { $elem = NumElem($i); $heap-add($elem); } It told me: Can't locate auto/Heap/add.al in @INC In Heap-0.50, when use it to new a heap, actually, it will use the Heap::Fibonacci to create a new one. So, I use: $heap = Heap::Fibonacci-new; instead of $heap = Heap-new;. It's OK. And then it said Can't locate auto/Heap/Fibonacci/extract_maximum.al, it's because there is no 'extract_maximu' subrutine in this package, so I use: extract_minimum instead, now it runs no problem. Work in the morning is much better than work at night :) Have a good one! Ying -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why Can't locate auto/Heap/add.al?
Ying Liu wrote at Thu, 05 Jun 2003 20:20:02 -0500: I finally install the Heap module. But I run the example of the CPAN: foreach $i ( 1..100 ) { $elem = NumElem($i); $heap-add($elem); } } It told me: Can't locate auto/Heap/add.al in @INC I search this directory but didn't find the add.al, is it caused by the wrong installing or something else? There seems to be two bugs in the documentation. First, you have to use a specific Heap-Class for the constructor (e.g. Heap::Fibonacci), Second, there is no extract_maximum but an extract_minimum function in the heap module. Together, the following snippet runs: use Heap::Fibonacci; my $heap = Heap::Fibonacci-new; my $elem; use Heap::Elem::Num(NumElem); foreach $i ( 1..100 ) { $elem = NumElem( $i ); $heap-add( $elem ); } while( defined( $elem = $heap-extract_minimum ) ) { print Smallest is , $elem-val, \n; } I'd rather suggest to contact the author of this module, as it seems really to be a bug that has to be fixed. Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why Can't locate auto/Heap/add.al?
Thank you very much Janek! I found these bugs too and wrote to [EMAIL PROTECTED] but don't know why it is not sent out. And I wrote to the writer but no response :( In fact, it should use to specify it: @ISA = qw(Heap::Fibonacci); The Heap package is a front end class and use Heap::Fibonacci in disguise. Thank you once again! Ying Ying Liu wrote at Thu, 05 Jun 2003 20:20:02 -0500: I finally install the Heap module. But I run the example of the CPAN: foreach $i ( 1..100 ) { $elem = NumElem($i); $heap-add($elem); } } It told me: Can't locate auto/Heap/add.al in @INC I search this directory but didn't find the add.al, is it caused by the wrong installing or something else? There seems to be two bugs in the documentation. First, you have to use a specific Heap-Class for the constructor (e.g. Heap::Fibonacci), Second, there is no extract_maximum but an extract_minimum function in the heap module. Together, the following snippet runs: use Heap::Fibonacci; my $heap = Heap::Fibonacci-new; my $elem; use Heap::Elem::Num(NumElem); foreach $i ( 1..100 ) { $elem = NumElem( $i ); $heap-add( $elem ); } while( defined( $elem = $heap-extract_minimum ) ) { print Smallest is , $elem-val, \n; } I'd rather suggest to contact the author of this module, as it seems really to be a bug that has to be fixed. Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]