# Copyright (c) 2002-2008 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: MIMEParser.pm,v 2.3 2008/01/25 22:40:21 nagler Exp $ package Bivio::Ext::MIMEParser; use strict; use base 'MIME::Parser'; # C simplifies instantiation of MIME::Parser for # in core interfaces. our($VERSION) = sprintf('%d.%02d', q$Revision: 2.3 $ =~ /\d+/g); # This avoids warning messages when MIME::Parser initializes. # The related Mail::Field class doesn't initialize nicely, and issues # warnings which shouldn't be caught by Bivio::IO::Alert and Bivio::Die. BEGIN { local($SIG{__WARN__}); local($SIG{__DIE__}); eval('use MIME::Parser ()'); } sub new { # (proto) : Ext.MIMEParser # Creates and configures for in core parsing. my($self) = shift->SUPER::new(@_); $self->output_to_core(1); $self->tmp_to_core(1); $self->use_inner_files(1); return $self; } sub parse_data { # (proto, string_ref) : MIME.Entity # Calls L and then I with I if called statically. # Otherwise, simply calls parse_data. my($proto) = shift; return (ref($proto) ? $proto : $proto->new)->SUPER::parse_data(@_); } 1;