Re: [exim] Exim Webmin Module.

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Todd Lyons
日付:  
To: Grant Peel
CC: exim-users
題目: Re: [exim] Exim Webmin Module.
On Mon, Jan 16, 2012 at 6:15 AM, Grant Peel <gpeel@???> wrote:
> Hi all,
>
> The perl code below has is a file from a Webmin module used to interface with Exim, show stats manage queue etc. The issue is that the date does not decode properly. The code is quite old, and I have been hacking at it for weeks trying to get it to work correctly. I have attempted to contact the original developer, but suspect his email is not been checked.


The code works fine in my limited testing.

> I am posting to this list thinking perhaps some of you may have some expierence with the base62 encoding, and hopefully perl!
>
> If anyone would like to take a shot at it ....
>
> Example
> 1RkkUB-000CAI-Ce        is being decoded a s:         Sat Apr 23 16:10:52 2005
> which is not correct.


Probably because you're passing the whole message id string to the
function instead of just the portion which is the datetime. Observe,
using your data:

$ perl test.pl 1RkkUB-000CAI-Ce
Starting with 1RkkUB-000CAI-Ce
Reduced to 1RkkUB
Seconds since Jan 1 1970: 1326235687
Tue Jan 10 14:48:07 2012
Tue Jan 10 22:48:07 2012

You have to strip all the extra cruft after and including the first
dash. Only the first 6 characters are significant for time
calculation.


Experiment with this:

#!/usr/bin/perl
use strict;
use warnings;

my $id = shift() || '1Rmrv2-0001v1-T6';
print "Starting with $id\n";
my $tm;
($tm = $id) =~ s/^([0-9a-zA-Z]{6})-[0-9a-zA-Z]{6}-[0-9a-zA-Z]{2}$/$1/ ?
print "Reduced to $tm\n" :
die ("Not proper format of message ID");
print "Extracted time portion: $id\n";

my $seconds = base62_to_decimal($id);
print "Seconds since Jan 1 1970: $seconds\n";
print scalar localtime($seconds),"\n";
print scalar gmtime($seconds),"\n";

...Todd
--
SOPA: Any attempt to [use legal means to] reverse technological
advances is doomed.  --Leo Leporte