NAME

MOJO::MailingList::Archives


SYNOPSIS

use MOJO::MailingList::Archives;

        my $archive = MOJO::MailingList::Archives->new(-List => \%list);


DESCRIPTION

Archive interface to a simple tied hash archiving system for messages saved in Mojo Mail


SUBROUTINES

new
        my $archive = MOJO::MailingList::Archives->new(-List => \%list);

this wil tie the db hash and get you going with this whole gosh darn thing if it has a valid list, it will open up the archive and get to work on it.


=cut

sub new {

# the ``new'' function, wee my $that = shift; my $class = ref($that) || $that;

my $self = { _permitted => \%allowed, %allowed, };

bless $self, $class;

#we gots some stuff passed to this darn thing my %args = ( -List => undef, -Path => $ARCHIVES, @_, );

$list_ref = $args{-List}; $archive_name = $list_ref ->{list} || undef; $archive_path = $args{-Path};

$self -> _open_archive();

return $self;

}

#the ``autoload'' function sub AUTOLOAD { my $self = shift; my $type = ref($self) or croak ``$self is not an object''; my $name = $AUTOLOAD; $name =~ s/.*://; #strip fully qualifies portion unless (exists $self -> {_permitted} -> {$name}) { croak ``Can't access '$name' field in object of class $type''; }


    if(@_) { 
        return $self->{$name} = shift; 
    } else { 
        return $self->{$name}; 
    }
}
_open_archive
private function for this module, this is what actually does the opening.

get_available-archives
        my $array_ref = $archive -> get_available_archives();

this will return a reference to an array of a list of mojo lists that have archives available

archive_exists
        my $archive_exists = $archive -> archive_exists($archive);

this sees if an archive is there, returns 1 if you're gold, zero if its a stinker.

get_available_archive
        my $entries = $archive -> get_archive_entries();

this will give you a refernce to an array that has the keys to your entries there.

get_archive_subject
        my $subject = get_archive_subject($key);

gets the subject of the given $key

get_neighbors
        my ($prev, $next) = $archive -> get_neighbors();

this will tell you in the frame of reference of what message you're on, what the previous and next entry keys are.

create_index
        my ($begin, $stop) = $archive -> create_index($start);

This 'll tell you what to print on each archive index. something like, 'start on teh 40th message and end on the 50th'

create_index_nav
        print $archive -> create_index_nav($list_info{list}, $stopped_at);

creates a HTML table that looks like this:

                  <<Prev                      Next >>

at the bottom of each archive index

make_nav_table,
        print $archive -> make_nav_table(-Id => $id, -List => $list_info{list});

this will make a HTML table that has the previous message, the index and the next message like this:

<< My Previous Message |Archive Index| My Next Message

make_search_form
        print $archive -> make_search_form();

this prints out the correct HTML form to make for your archives.

zap_sig
        my $zapped = $archive -> zap_sig($unzapped);

This little subroutine takes a string and returns it, stopping when it reaches a double dash '--' usually this refers to where the message stops and the sig starts. It looks for the double dashes at the begining of the line.


=cut

sub zap_sig { my $self = shift; my $message = shift; my @msg_lines = split(/\n(?!\s)/, $message);

my $new_message = ``'';

foreach my $line(@msg_lines){ last if($line =~ m/^--$/); $new_message .= ``$line \n''; }

return $new_message;

}

get_archive_message
        my $message = get_archive_message($key);

gets the message of the given $key

get_archive_format
        my $format = get_archive_format($key);

gets the format of the given $key

get_archive_subject($key);
my $subject, $message, $format = $archive -> get_archive_subject($key);

gets the subject of the given $key

check_if_entry_exists;
see if an entry exists, returns 1 when its there, 0 if it aint

set_archive_subject();
$archive -> set_archive_subject($subject);

changes the archive's subject (yo)

set_archive_message();
        $archive -> set_archive_message($message);

changes the archive's message (yo)

set_archive_format
        $archive -> set_archive_format($format);

changes the archive's format (yo)

set_archive_info
        $archive -> set_archive_info($subject, $message, $format);

changes the archive's info (yo)

delete_archive
        delete_archive($key);

deletes the archive entry.

search_entries
        my $results = search_entries($keyword);

this is a funky subroutine that returns a refernce to an array of keys that has the $keyword in the subject or message, otherwise known as a ``search''?

DESTROY
        DESTROY ALL ASTROMEN!


COPYRIGHT

 Copyright (c) 1999 - 2003 Justin Simoni 
 me@justinsimoni.com
 http://justinsimoni.com 
 All rights reserved.
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.