Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Begginings

I'm working for a client that asked me to build something he can use to inspect a catch-all mailbox at his ISP linux box. My client is an organized and clever half-techie that understands little about perl and a lot about linux. He is using Debian stable distro, with perl 5.6.1 and a bunch of libs that I've asked him to install for my use.

Mail::Box

I've choosen Mail::Box because of its stability and powerfull control and broad range of supported formats.

At development, everything goes fine, and Mail::Box::Manager uses Mail::Box::Maildir and Mail::Box::Message to create me an ideal world where all works as expected: messages go back and forth, and I can see and handle all requirements.

Production Hell

Things change a lot at production (I have little access to production, so please take it easy! -- this is a business requirement from my client). The same program that works at my development environment and performs quite well fails miserably when facing the 30_000 (yes, that's four zeros on the right hand) messages on a single maildir folder. My main problem is that I don't have a formal failure: Mail::Box just leave open() telling everybody that there is no messages at this maildir folder(?!?!). I'm really confused about this error and can't figure out a good way to tell if I'm missing something really important or just need a good afternoon of debugging Perl internals.

I've wrote the following code to try to expose the fail. Hope I've setted all erros at the maximum noise level. Comments and related cases are welcome. My client will make tests in one or two days, and I will have more information to complement this post then.

#!/usr/bin/perl use strict; use warnings; use Getopt::Long; use Pod::Usage; use Mail::Box::Manager; my $options; GetOptions( 'mail-folder=s' => \$options->{folder}, 'dump-subject=s' => \$options->{dumpfile}, ); pod2usage( -message => "$0: syntax error: pay attention!\n\n", -exitval => 1, -verbose => 1, # Give "Synopsis" and "Arguments" -filehandle => \*STDERR, ) unless( ( $options->{folder} and -d $options->{folder} ) # or # ( $options->{dumpfile} and -f $options->{dumpfile} ) ); my $manager = new Mail::Box::Manager; my $folder; eval{ $folder = $manager->open( folder => $options->{folder}, create => 0, access => 'r', type => 'maildir', expand => 'LAZY', log => 'DEBUG', # adds a lot of noise trace => 'DEBUG', # adds a lot of noise ); }; die "Error opening maildir [$options->{folder}]: '$@'\n\n" if $@; print qq{Folder [} . $folder->name . qq{] aberto com [} . scalar @$folder . qq{] mensagens.\n\n}; if( $options->{dumpfile} ){ open DUMP, '>', $options->{dumpfile} or pod2usage( -message => qq{Can't create dumpfile: $!\n\n}, -exitval => 2, -verbose => 1, -filehandle => \*STDERR ); print( DUMP $_->subject(), $/ ) foreach @$folder; close DUMP or die qq{Can't close(!?!) dumpfile $options->{dumpfile}\n\n}; } # fi eval{ $folder->close }; die "Error closing maildir [".$folder->name."]: '$@'.\n\n" if $@; __END__ =pod =head1 NAME mail-box-test - Simple test to see if Mail::Box::Maildir is working +correctly. =head1 SYNOPSIS perl mail-box-test --mail-folder='/path/to/mail/dir/' [--dump-subjec +t=/path/to/subjects.txt] =head1 ARGUMENTS =over 4 =item --mail-folder <FOLDER> Points to the maildir you want to use for testing. No maildir means test failure, so please choose a maildir to test. =item --dump-subject <DUMPFILE> Force dumping of subject lines of a maildir to a specified file on the disk. =back =head1 DESCRIPTION This script tests a Mail::Box resource usage under linux for a client. I'm facing a funny problem when trying to open maildirs with more than 21,000 messages in it: Mail::Box is telling me its opening the maildir correctly but no messages are found inside it. =head1 AUTHOR Luis Campos de Carvalho, a.k.a. Monsieur Champs. mailto: monsieur_champs [at] yahoo [dot] com [dot] br =cut

In reply to Mail::Box fails miserably when trying to open 30_000 messages maildir by monsieur_champs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-20 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found