MOJO::Archive
use MOJO::Archive;
my $archive = MOJO::Archive->new(-List => \%list);
Archive interface to a simple tied hash archiving system for messages saved in Mojo Mail
my $archive = MOJO::Archive ->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}; } }
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
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.
my $entries = $archive -> get_archive_entries();
this will give you a refernce to an array that has the keys to your entries there.
my $subject = get_archive_subject($key);
gets the subject of the given $key
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.
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'
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
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
print $archive -> make_search_form();
this prints out the correct HTML form to make for your archives.
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;
}
my $message = get_archive_message($key);
gets the message of the given $key
my $format = get_archive_format($key);
gets the format of the given $key
gets the subject of the given $key
changes the archive's subject (yo)
$archive -> set_archive_message($message);
changes the archive's message (yo)
$archive -> set_archive_format($format);
changes the archive's format (yo)
$archive -> set_archive_info($subject, $message, $format);
changes the archive's info (yo)
delete_archive($key);
deletes the archive entry.
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 ALL ASTROMEN!
Copyright (c) 1999 - 2002 Justin Simoni (justin@skazat.com) http://skazat.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.