MHonArc

 view release on metacpan or  search on metacpan

lib/mhopt.pl  view on Meta::CPAN


    ## Clear thread flag if genidx, must be explicitly set
    $THREAD = 0 if $IDXONLY;

    ##	Read resource file(s)
    ##	Look for resource in outdir unless existing according to
    ##  current value.
    foreach (@FMTFILE) {
        $_ = join($DIRSEP, $OUTDIR, $_) unless -e $_;
        &read_resource_file($_);
    }

    ## Set locale
    eval {
        require POSIX;
        if ($Lang) {
            POSIX::setlocale(&POSIX::LC_ALL, $Lang);
        } else {
            POSIX::setlocale(&POSIX::LC_ALL, '');
        }
    };
    if ($@ && $Lang) {
        warn qq/Warning: Setting locale appears to not be supported: $@\n/;
    }

    ##	Re-check readmail settings
    if (!$SCAN) {
        # If text encoding has been specified, change $MHeadCnvFunc.
        if (defined(readmail::load_textencoder())) {
            $MHeadCnvFunc = \&htmlize_enc_head;
        }
    }

    ## Check if extension for HTML files defined on the command-line
    $HtmlExt = $opt{'htmlext'} if defined($opt{'htmlext'});

    ## Other indexes resource files
    if (defined($opt{'otherindex'})) {
        my @array = ();
        local ($_);
        foreach (@{$opt{'otherindex'}}) {
            push(@array, split(/$PATHSEP/o, $_));
        }
        unshift(@OtherIdxs, @array);
    }

    ## Perl INC paths
    if (defined($opt{'perlinc'})) {
        my @array = ();
        local ($_);
        foreach (@{$opt{'perlinc'}}) {
            push(@array, split(/$PATHSEP/o, $_));
        }
        unshift(@PerlINC, @array);
    }

    @OtherIdxs = remove_dups(\@OtherIdxs);
    @PerlINC   = remove_dups(\@PerlINC);
    unshift(@INC, @PerlINC);

    ## Set alternative prefs
    if (!$SCAN) {
        readmail::MAILset_alternative_prefs(@MIMEAltPrefs);
        $IsDefault{'MIMEALTPREFS'} = !scalar(@MIMEAltPrefs);
    }

    ## Get other command-line options
    $DBFILE = $opt{'dbfile'} if $opt{'dbfile'};    # Override db
    $DBPathName =
        OSis_absolute_path($DBFILE)
        ? $DBFILE
        : join($DIRSEP, $OUTDIR, $DBFILE);

    $DOCURL    = $opt{'docurl'}    if $opt{'docurl'};
    $FROM      = $opt{'msgsep'}    if $opt{'msgsep'};
    $IDXPREFIX = $opt{'idxprefix'} if $opt{'idxprefix'};
    $IDXSIZE   = $opt{'idxsize'}   if defined($opt{'idxsize'});
    $IDXSIZE *= -1 if $IDXSIZE < 0;
    $OUTDIR     = $opt{'outdir'}     if $opt{'outdir'};          # Override db
    $MAILTOURL  = $opt{'mailtourl'}  if $opt{'mailtourl'};
    $NewsUrl    = $opt{'newsurl'}    if $opt{'newsurl'};
    $MAXPGS     = $opt{'maxpgs'}     if defined($opt{'maxpgs'});
    $MAXPGS     = 0                  if $MAXPGS < 0;
    $MAXSIZE    = $opt{'maxsize'}    if defined($opt{'maxsize'});
    $MAXSIZE    = 0                  if $MAXSIZE < 0;
    $MHPATTERN  = $opt{'mhpattern'}  if $opt{'mhpattern'};
    $TIDXPREFIX = $opt{'tidxprefix'} if $opt{'tidxprefix'};
    $TITLE      = $opt{'title'}      if $opt{'title'};
    $TLEVELS    = $opt{'tlevels'}    if $opt{'tlevels'};
    $TTITLE     = $opt{'ttitle'}     if $opt{'ttitle'};
    $MsgPrefix = $opt{'msgprefix'} if defined($opt{'msgprefix'});
    $GzipExe   = $opt{'gzipexe'}   if $opt{'gzipexe'};
    $VarExp    = $opt{'varregex'}
        if $opt{'varregex'}
        && ($opt{'varregex'} =~ /\S/);
    $TSLICELEVELS  = $opt{'tslicelevels'}  if $opt{'tslicelevels'};
    $IconURLPrefix = $opt{'iconurlprefix'} if $opt{'iconurlprefix'};

    $IDXNAME =
           $opt{'idxfname'}
        || $IDXNAME
        || $ENV{'M2H_IDXFNAME'}
        || "maillist.$HtmlExt";
    $TIDXNAME =
           $opt{'tidxfname'}
        || $TIDXNAME
        || $ENV{'M2H_TIDXFNAME'}
        || "threads.$HtmlExt";

    $ExpireDate = $opt{'expiredate'} if $opt{'expiredate'};
    $ExpireTime = $opt{'expireage'}  if $opt{'expireage'};
    $ExpireTime *= -1 if $ExpireTime < 0;

    $GMTDateFmt   = $opt{'gmtdatefmt'}   if $opt{'gmtdatefmt'};
    $LocalDateFmt = $opt{'localdatefmt'} if $opt{'localdatefmt'};

    $AddressModify = $opt{'addressmodifycode'} if $opt{'addressmodifycode'};
    $SubArtRxp     = $opt{'subjectarticlerxp'} if $opt{'subjectarticlerxp'};
    $SubReplyRxp   = $opt{'subjectreplyrxp'}   if $opt{'subjectreplyrxp'};
    $SubStripCode  = $opt{'subjectstripcode'}  if $opt{'subjectstripcode'};
    $MsgExcFilter = $opt{'msgexcfilter'} if defined($opt{'msgexcfilter'});

    $NoSubjectTxt = $opt{'nosubjecttxt'} if $opt{'nosubjecttxt'};



( run in 2.456 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )