Another thing to try - surround unshift stuff with BEGIN block:
BEGIN {
$installation_directory = "....";
use lib $installation_directory . "/lib";
use lib $installation_directory;
}
Yavor
On Wed, Mar 9, 2011 at 11:49, Yavor Nikolov <[email protected]> wrote:
> Hi Marcel,
>
> * use lib seems to require hardcoded paths.
> * I think there is something weird with your perl... What's the output of
> "perl -V"?
> * You can try with different perl setup (you can compile it yourself or
> just install from some package to alternative path).
>
> Regards,
> Yavor
>
>
> On Wed, Mar 9, 2011 at 11:37, Marcel Loose <[email protected]> wrote:
>
>> Hi Yavor,
>>
>> I tried your code.
>>
>> Option 1 appears to work (using Bugzilla 3.6, that is, because 3.4
>> doesn't have Bugzilla::Bug::is_open_state()).
>>
>> $ ./scmbug_test.pl
>> status = UNCONFIRMED, is_open = 1
>> status = NEW, is_open = 1
>> status = ASSIGNED, is_open = 1
>> status = REOPENED, is_open = 1
>> status = RESOLVED, is_open = 0
>> status = VERIFIED, is_open = 0
>> status = CLOSED, is_open = 0
>> end
>>
>>
>> Option 2 doesn't work for me:
>>
>> Undefined subroutine &Bugzilla::Field::get_legal_field_values called
>> at ./scmbug_test.pl line 22.
>>
>>
>> However, when I change the hardcoded path in option 1 with:
>>
>> use lib $installation_directory . "/lib";
>> use lib $installation_directory;
>>
>> I get an error message comparable to the one I got when I tried
>> Thorsten's first suggestion (use 'use lib' in Bugzilla.pm):
>>
>> Use of uninitialized value $installation_directory in concatenation (.)
>> or string at ./scmbug_test.pl line 11.
>> Empty compile time value given to use lib at ./scmbug_test.pl line 12
>> Use of uninitialized value in require
>> at /usr/lib/perl5/site_perl/5.10.0/DateTime/Locale/Base.pm line 8.
>> Undefined subroutine &Bugzilla::Field::get_legal_field_values called
>> at ./scmbug_test.pl line 22.
>>
>>
>> Now, I'm a Perl n00b, so I don't know how to get this to work, but it
>> must somehow be possible to feed 'use lib' a "composed" path name,
>> right?
>>
>> Cheers,
>> Marcel.
>>
>>
>> On Tue, 2011-03-08 at 15:14 +0200, Yavor Nikolov wrote:
>> > Why don't you first test something simpler to see if Bugzilla
>> > libraries are resolved successfully? E.g.:
>> >
>> > use warnings;
>> > use strict;
>> >
>> > my $installation_directory = "/your/bugzilla-root";
>> >
>> > chdir( "$installation_directory" );
>> >
>> > ## Option 1 - "use lib"
>> > #use lib "/your/bugzilla-root/lib";
>> > #use lib "/your/bugzilla-root";
>> >
>> > ## Option 2 - "unshift @INC"
>> > unshift @INC, $installation_directory . "/lib";
>> > unshift @INC, $installation_directory;
>> >
>> > eval "use Bugzilla";
>> >
>> > sub print_bugzilla_statuses
>> > {
>> > my $status_values =
>> > Bugzilla::Field::get_legal_field_values( 'bug_status' );
>> >
>> > foreach my $status ( @$status_values )
>> > {
>> > my $is_open = Bugzilla::Bug::is_open_state( $status );
>> > print( "status = $status, is_open = $is_open\n" );
>> > }
>> > }
>> >
>> >
>> > print_bugzilla_statuses();
>> >
>> > print( "end\n" );
>> >
>> >
>> > Regards,
>> > Yavor
>> >
>> >
>> > On Tue, Mar 8, 2011 at 14:37, Marcel Loose <[email protected]> wrote:
>> > On Mon, 2011-03-07 at 19:00 +0100, Thorsten Schöning wrote:
>> > > Guten Tag Marcel Loose,
>> > > am Montag, 7. März 2011 um 18:14 schrieben Sie:
>> > >
>> > > > It does. See my mail from earlier today (10h13) in which I
>> > provided the
>> > > > output of both @INC and $self. However, I think
>> > Cwd::getcwd() will give
>> > > > you the current working directory, and that's not what
>> > you're after.
>> > >
>> > > The following is one line above the alternative and looks
>> > like the
>> > > current working directory is set, therefore I tried to use
>> > it, if
>> > > $self won#t work for some reason.
>> > >
>> > > chdir $self->installation_directory();
>> > >
>> > > Mit freundlichen Grüßen,
>> > >
>> > > Thorsten Schöning
>> > >
>> >
>> >
>> > Hi Thorsten,
>> >
>> > If I recap:
>> >
>> > * @INC does get set correctly (see my yesterday's mail
>> > from
>> > 10:13), even in the untouched Scmbug 0.26.22 code.
>> > * None of the changes you suggest seem to work.
>> >
>> > That leaves the one solution the Kristis doesn't like:
>> >
>> > * set environment variable PERL5LIB in scmbug-server
>> >
>> > I guess this problem should be investigated further and maybe
>> > an issue
>> > should be opened for this in the Bug tracker. What do you
>> > think?
>> >
>> > Cheers,
>> > Marcel.
>> >
>> >
>> >
>> > _______________________________________________
>> > scmbug-users mailing list
>> > [email protected]
>> > http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users
>> >
>> >
>>
>>
>>
>>
>
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users