For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > August 2007 > Create Unique Message-ID









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Create Unique Message-ID
yig

2007-06-23, 3:59 am

Hi,
I've scoured google for this, and have found lots of possible solutions,
but none seems to work.

I'm trying to create a unique Message-ID that will go in the top of a
Usenet post. So obviously, each ID has to be unique, and I did this once
before, but can't remember how. I think I did my $id = `date`; or
something and then when it came to creating the header, it was
$message_id=$id, "@yahoo.fr" or something.

The problem is that `date`generates the date in .. well, in the wrong
format. I need it in like say just seconds. So I can have unique IDs like
"9283736663616@yahoo.fr" or something.

Help!


Mumia W.

2007-06-23, 3:59 am

On 06/22/2007 05:45 AM, yig wrote:
> Hi,
> I've scoured google for this, and have found lots of possible solutions,
> but none seems to work.
>
> I'm trying to create a unique Message-ID that will go in the top of a
> Usenet post. So obviously, each ID has to be unique, and I did this once
> before, but can't remember how. I think I did my $id = `date`; or
> something and then when it came to creating the header, it was
> $message_id=$id, "@yahoo.fr" or something.
>
> The problem is that `date`generates the date in .. well, in the wrong
> format. I need it in like say just seconds. So I can have unique IDs like
> "9283736663616@yahoo.fr" or something.
>
> Help!
>
>


I don't think you should use @yahoo.fr unless you're the company Yahoo
in France.

Anyway, Perl's time() function returns the time in seconds since an epoch.

#!/usr/bin/perl
print time() . '@mydomian.example.com';


__HTH__

yig

2007-06-23, 3:59 am

Mumia W. <paduille.4061.mumia.w+nospam@earthlink.net> wrote:
> On 06/22/2007 05:45 AM, yig wrote:
[color=darkred]
> I don't think you should use @yahoo.fr unless you're the company Yahoo
> in France.


You're quite right, of course. My bad.
[color=darkred]
> Anyway, Perl's time() function returns the time in seconds since an epoch.
>
> #!/usr/bin/perl
> print time() . '@mydomian.example.com';

It does: many thanks.
Joe Smith

2007-06-23, 3:59 am

yig wrote:

> I'm trying to create a unique Message-ID that will go in the top of a
> Usenet post. So obviously, each ID has to be unique,


I would use an ID that includes the time, includes a counter (in case more
than one message per second), includes the process-ID (in case multiple
instances running at the same time), and includes the host name (required).

my $hostname = 'yahoo-fr.example.com';
for (my $count = 0;; ++$count) {
my $message_id = time() . ".$count.$$.$domain";
send_message($message_id);
}

-Joe
Dr.Ruud

2007-06-23, 10:02 pm

Joe Smith schreef:
> yig:


>
> I would use an ID that includes the time, includes a counter (in case
> more than one message per second), includes the process-ID (in case
> multiple instances running at the same time), and includes the host
> name (required).
>
> my $hostname = 'yahoo-fr.example.com';
> for (my $count = 0;; ++$count) {
> my $message_id = time() . ".$count.$$.$domain";
> send_message($message_id);
> }


ITYM: my $message_id = time() . ".$count.$$\@$hostname";

You could reset $count when time() has changed.

my $hostname = 'yahoo-fr.example.com';

my $time = time;

my $count = 0;

for my $msg (@messages) {
++$count;
$msg->message_id( qq{$time.$count.$$\@$hostname} );
if ( (my $t = time) != $time ) {
$time = $t;
$count = 0;
}
}

--
Affijn, Ruud

"Gewoon is een tijger."

Mopo8

2007-06-26, 3:09 pm

Jessica Simpson , Panties sliding down a perfectly round ass!

http://www.theillegalsite.com/Media...mv?clip=1673286



funny music satire video free funny video funny police video deer hunting funny video funny video clip for email
http://635-funny-video.info/funny-j...ture-video.html http://635-funny-video.info/funny-v...lip-online.html http://635-funny-video.info/free-on...unny-video.html http://635-funny-video.info/funny-video-clip-joke.html http://635-funny-video.info/XXXXing...shit-video.html
Abanerteddick

2007-07-09, 7:15 pm

Heather Locklear , Pornstar MPGS!
http://www.starpapertube.com/MediaPlayer?movie=148803

Pamela Anderson extreme masturbation!
http://www.starpapertube.com/WatchMovie?q=148803

Ashlee Simpson With Busty Boobs Teasing & Posing!
http://www.starpapertube.com/Watch?movie=148803

Nikki Cox shows arse!
http://www.starpapertube.com/Play?clip=148803

Britney Spears wearing black stockings and lace panties!
http://www.starpapertube.com/WatchMovie?q=148803
Styriaght

2007-08-22, 11:15 am

Laetitia Casta undressing!

http://www.digitalzenart.com/Watch?id=726071
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com