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]