Ignore:
Timestamp:
Dec 14, 2004, 6:46:00 PM (17 years ago)
Author:
kake
Message:

Encapsulate config data in OpenGuides::Config.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/Utils.pm

    r586 r587  
    2424=head1 SYNOPSIS
    2525
    26   use CGI::Wiki;
    27   use Config::Tiny;
     26  use OpenGuide::Config;
    2827  use OpenGuides::Utils;
    2928
    30   my $config = Config::Tiny->read( "wiki.conf" );
     29  my $config = OpenGuides::Config->new( file => "wiki.conf" );
    3130  my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
    3231
     
    3736=item B<make_wiki_object>
    3837
    39   my $config = Config::Tiny->read( "wiki.conf" );
     38  my $config = OpenGuides::Config->new( file => "wiki.conf" );
    4039  my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
    4140
    42 Croaks unless a C<Config::Tiny> object is supplied.  Returns a
     41Croaks unless an C<OpenGuides::Config> object is supplied.  Returns a
    4342C<CGI::Wiki> object made from the given config file on success,
    4443croaks if any other error occurs.
     
    6766    my ($class, %args) = @_;
    6867    my $config = $args{config} or croak "No config param supplied";
    69     croak "config param isn't a Config::Tiny object"
    70         unless UNIVERSAL::isa( $config, "Config::Tiny" );
     68    croak "config param isn't an OpenGuides::Config object"
     69        unless UNIVERSAL::isa( $config, "OpenGuides::Config" );
    7170
    7271    # Require in the right database module.
    73     my $dbtype = $config->{_}->{dbtype};
     72    my $dbtype = $config->dbtype;
    7473
    7574    my %cgi_wiki_exts = (
     
    8584    # Make store.
    8685    my $store = $cgi_wiki_module->new(
    87         dbname => $config->{_}{dbname},
    88         dbuser => $config->{_}{dbuser},
    89         dbpass => $config->{_}{dbpass},
    90         dbhost => $config->{_}{dbhost},
     86        dbname => $config->dbname,
     87        dbuser => $config->dbuser,
     88        dbpass => $config->dbpass,
     89        dbhost => $config->dbhost,
    9190    );
    9291
    9392    # Make search.
    9493    my $search;
    95     if ( $config->{_}{use_plucene}
    96          && ( lc($config->{_}{use_plucene}) eq "y"
    97               || $config->{_}{use_plucene} == 1 )
     94    if ( $config->use_plucene
     95         && ( lc($config->use_plucene) eq "y"
     96              || $config->use_plucene == 1 )
    9897       ) {
    9998        require CGI::Wiki::Search::Plucene;
    10099        $search = CGI::Wiki::Search::Plucene->new(
    101                                        path => $config->{_}{indexing_directory}
     100                                       path => $config->indexing_directory,
    102101                                                 );
    103102    } else {
     
    105104        require Search::InvertedIndex::DB::DB_File_SplitHash;
    106105        my $indexdb = Search::InvertedIndex::DB::DB_File_SplitHash->new(
    107             -map_name  => $config->{_}{indexing_directory},
     106            -map_name  => $config->indexing_directory,
    108107            -lock_mode => "EX"
    109108        );
     
    112111
    113112    # Make formatter.
    114     my $script_name = $config->{_}->{script_name};
    115     my $search_url = $config->{_}->{script_url} . "supersearch.cgi";
     113    my $script_name = $config->script_name;
     114    my $search_url = $config->script_url . "supersearch.cgi";
    116115
    117116    my %macros = (
Note: See TracChangeset for help on using the changeset viewer.