PDL function call failing

Discussion in 'Perl' started by Mark Ohlund, May 2, 2004.

  1. Mark Ohlund

    Mark Ohlund Guest

    I'm trying to use the PDL modules to perform a Vector Space search as
    shown in: http://www.perl.com/pub/a/2003/02/19/engine.html

    I'm running FreeBSD 4.9 w/ Perl 5.6.1 and 2.4.1 of PDL.

    The source code for the search is:
    http://www.perl.com/2003/02/19/examples/VectorSpace.pm

    I'm calling this with the following code:

    #!/usr/bin/perl

    use Search::VectorSpace;

    my @docs = ("the cat in the hat.", "A cat is a fine pet.",
    "Dogs and cats make good pets.", "I haven't got a hat.");
    my $engine = Search::VectorSpace->new( docs => \@docs, threshold => .04);
    $engine->build_index();

    while ( my $query = <STDIN> ) {
    my %results = $engine->search( $query );
    print join "\n>>", keys %results;
    }

    When I call the VectorSpace code, I get an error at line 180:

    Can't modify non-lvalue subroutine call in concatenation (.) or string
    at /usr/local/lib/perl5/5.6.1/Search/VectorSpace.pm line 180, near "$value;"

    Line 180 is:

    index( $vector, $offset ) .= $value;

    I *think* the problem is that rather than using the PDL index function
    which should set the value of the PDL vector object at $offset to
    $value, Perl thinks I'm trying to access the intrinsic Perl index
    function. I've tried prefacing the index call with PDL:: to no avail.

    Does anyone have insight into what I may be doing wrong? I'll admit my
    Perl is pretty rusty, but making use of this search would be a big help.
    Thanks.

    Mark.
     
    Mark Ohlund, May 2, 2004
    #1
    1. Advertising

  2. Mark Ohlund

    Slaven Rezic Guest

    Mark Ohlund <> writes:

    > I'm trying to use the PDL modules to perform a Vector Space search as
    > shown in: http://www.perl.com/pub/a/2003/02/19/engine.html
    >
    > I'm running FreeBSD 4.9 w/ Perl 5.6.1 and 2.4.1 of PDL.
    >
    > The source code for the search is:
    > http://www.perl.com/2003/02/19/examples/VectorSpace.pm
    >
    > I'm calling this with the following code:
    >
    > #!/usr/bin/perl
    >
    > use Search::VectorSpace;
    >
    > my @docs = ("the cat in the hat.", "A cat is a fine pet.",
    > "Dogs and cats make good pets.", "I haven't got a hat.");
    > my $engine = Search::VectorSpace->new( docs => \@docs, threshold => .04);
    > $engine->build_index();
    >
    > while ( my $query = <STDIN> ) {
    > my %results = $engine->search( $query );
    > print join "\n>>", keys %results;
    > }
    >
    > When I call the VectorSpace code, I get an error at line 180:
    >
    > Can't modify non-lvalue subroutine call in concatenation (.) or string
    > at /usr/local/lib/perl5/5.6.1/Search/VectorSpace.pm line 180, near
    > "$value;"
    >
    > Line 180 is:
    >
    > index( $vector, $offset ) .= $value;


    This looks like invalid perl to me.

    >
    > I *think* the problem is that rather than using the PDL index function
    > which should set the value of the PDL vector object at $offset to
    > $value, Perl thinks I'm trying to access the intrinsic Perl index
    > function. I've tried prefacing the index call with PDL:: to no avail.
    >
    > Does anyone have insight into what I may be doing wrong? I'll admit my
    > Perl is pretty rusty, but making use of this search would be a big
    > help. Thanks.
    >


    It's probably best to ask the module author about this.

    Regards,
    Slaven

    --
    Slaven Rezic -

    tkruler - Perl/Tk program for measuring screen distances
    http://ptktools.sourceforge.net/#tkruler
     
    Slaven Rezic, May 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Junmou Zhang
    Replies:
    0
    Views:
    1,424
    Junmou Zhang
    Jul 10, 2003
  2. Jose Quesada
    Replies:
    1
    Views:
    134
    Joel VanderWerf
    Sep 20, 2003
  3. Jeff Silverman

    I am having problems installing PDL using CPAN

    Jeff Silverman, Nov 11, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    142
    Jeff Silverman
    Nov 11, 2003
  4. Mark Ohlund

    PDL code

    Mark Ohlund, May 3, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    111
    Anno Siegel
    May 4, 2004
  5. Keflavich
    Replies:
    0
    Views:
    131
    Keflavich
    Feb 15, 2007
Loading...

Share This Page