Global Symbol $release error

Help
alex
2010-10-22
2013-01-02
  • alex
    alex
    2010-10-22

    Everything is starting up fine besides when I click on identifier search or click on any links within code.  The error is:

      Apache/2.2.14 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.1 configured - resuming normal operations
      -T switch is ignored, enable with 'PerlSwitches -T' in httpd.conf\n
      Global symbol "$release" requires explicit package name at /usr/share/lxr/ident line 52.\nGlobal symbol "$release" requires explicit package name at /usr/share/lxr/ident line 89.\n

    Someone suggested here to change $release to $releaseid in the /lxr/ident file - that brings up the page with no 500 Internal Error page but there is nothing being shown below the header.

    Any help would be greatly appreciated.

     
  • alex
    alex
    2010-10-22

    When changing $release to $releaseid I get this error:

    fatal: ModPerl::ROOT::ModPerl::RegistryPrefork::usr_share_lxr_ident, line 52: Can't locate object method "getindex" via package "LXR::Index::Mysql" at /usr/share/lxr/ident line 52.

     
  • Jordan Mc
    Jordan Mc
    2011-03-04

    This is how I got v0.9.8 working using a mysql database:

    1. Edit to /path/to/your/lxr/ident
        Replace "$release" with "$releaseid" in lines 52 and 89 so that they look like
            "my @refs = $index->getindex($identifier, $releaseid);"

    2. Edit /path/to/your/lxr/lib/LXR/Index/Mysql.pm
        There seems to be some functions that were removed between 0.9.5 and 0.9.8. I just added them back in. Copy and
        paste the following just before the last line of code which reads "1;"

    #
    # Functions missing from LXR::Index API Implementation
    #

    sub index {
            my ($self, $symname, $fileid, $line, $langid, $type, $relsym) = @_;

            $self->{indexes_insert}->execute($self->symid($symname),
                    $fileid, $line, $langid, $type, $relsym ? $self->symid($relsym) : undef);
    }

    sub dropfileindex {
            my ($self, $fileid) = @_;
            $self->{delete_fileindex}->execute($fileid);
    }

    sub reference {
            my ($self, $symname, $fileid, $line) = @_;

            $self->{usage_insert}->execute($fileid, $line, $self->symid($symname));

    }

    sub dropfilereference {
            my ($self, $fileid) = @_;
            $self->{delete_fileuseage}->execute($fileid);
    }

    sub getindex {
            my ($self, $symname, $releaseid) = @_;
            my ($rows, @ret);

            $rows = $self->{indexes_select}->execute("$symname", "$releaseid");

            while ($rows- > 0) {
                    push(@ret, );
            }

            $self->{indexes_select}->finish();

            map { $$_ &&= $self->symname($$_) } @ret;

            return @ret;
    }

    sub getreference {
            my ($self, $symname, $releaseid) = @_;
            my ($rows, @ret);

            $rows = $self->{usage_select}->execute("$symname", "$releaseid");

            while ($rows- > 0) {
                    push(@ret, );
            }

            $self->{usage_select}->finish();

            return @ret;
    }

    # Indicate that this filerevision is part of this release
    sub release {
            my ($self, $fileid, $releaseid) = @_;

            my $rows = $self->{releases_select}->execute($fileid + 0, $releaseid);
            $self->{releases_select}->finish();

            unless ($rows > 0) {
                    $self->{releases_insert}->execute($fileid, $releaseid);
                    $self->{releases_insert}->finish();
            }
    }

    # If this file has not been indexed earlier return true.  Return false
    # if already indexed.
    sub toindex {
            my ($self, $fileid) = @_;
            my ($status);

            $self->{status_get}->execute($fileid);
            $status = $self->{status_get}->fetchrow_array();
            $self->{status_get}->finish();

            if (!defined($status)) {
                    $self->{status_insert}->execute($fileid + 0, 0);
            }

        return $status == 0;
    }

    sub setindexed {
            my ($self, $fileid) = @_;
            $self->{status_update}->execute(1, $fileid, 0);
    }

    sub setunindexed {
           my ($self, $fileid) = @_;
           $self->{status_update}->execute(0, $fileid, 2);
    }

    sub toreference {
            my ($self, $fileid) = @_;
            my ($status);

            $self->{status_get}->execute($fileid);
            $status = $self->{status_get}->fetchrow_array();
            $self->{status_get}->finish();

            return $status < 2;
    }

    sub setreferenced {
            my ($self, $fileid) = @_;
            $self->{status_update}->execute(2, $fileid, 1);
    }

    sub getdecid {
            my ($self, $lang, $string) = @_;

            my $rows = $self->{decl_select}->execute($lang, $string);
            $self->{decl_select}->finish();

            unless ($rows > 0) {
                    $self->{decl_insert}->execute($lang, $string);
            }

            $self->{decl_select}->execute($lang, $string);
            my $id = $self->{decl_select}->fetchrow_array();
            $self->{decl_select}->finish();

            return $id;
    }

    sub purgemissingfiles {
            my ($self, $releaseid, $files) = @_;
            my ($rows, @ret);
            my ($fileid, $filename);

            $rows = $self->{files_release_select}->execute($releaseid);

            while ($rows- > 0) {
                    ($fileid, $filename) =  $self->{files_release_select}->fetchrow_array;
                    if ($files->filemissing($filename, $releaseid)) {
                            $self->dropfileindex($fileid);
                            $self->dropfilereference($fileid);
                            print STDOUT "$filename no longer present…dropping references.\n";
                    }
            }

            $self->{files_release_select}->finish();
    }

    #
    # END: Functions missing from LXR::Index API Implementation
    #
       

     
  • Andre-Littoz
    Andre-Littoz
    2011-03-05

    There is a much simpler way of doing it.

    The change of $release to $releaseid is not enough. You must also change getindex to another function. The lines 52 and 89 in ident now read:

    Line 52:     my @refs = $index->symdeclarations($identifier, $releaseid);
    Line 89:     my @uses = $index->symreferences($identifier, $releaseid);

    That's all. No need to modify Mysql.pm nor the other storage access methods. This change is related to the DB architecture revamping.

    For a complete list of corrections and improvements, see my post under topic "Help on non-regression test". The title length was too short to advertise a call for non-regression tests.

    Regards,

    Pat

     
  • Andre-Littoz
    Andre-Littoz
    2011-11-22

    Unfortunately, I must close this topic because it is heavily polluted by spam. If you need information related to the above, please open a new topic.

    It seems the first topic on a publicly available forum is targeted by spam robots.

    ajl, LXR administrator