Plugin written/modified dates in PerlScript --HELP!!--

Posted by 1of10 on Mon 30 Sep 2002 12:11 PM — 6 posts, 27,291 views.

Canada #0
I've been building a plugin info script, similar to the ones provided by Nick, in PerlScript. It's primarily an aid to me to help get used to making plugins.

I'm having problems retrieving the written on and last modified date values. Below is a list of the formats attempted, and the whacky results returned.

$world->getPluginInfo($x,14)
Win32::OLE::Variant=SCALAR(0x1e0d20c)

${$world->getPluginInfo($x,14)}
31496000

I thought the second would be seconds, but when I put the value in localtime(), it returns Thu Dec 31 04:54:24 1970. Is this some obscure seconds since ... specific to the language the plugin engine assumes...or...? I'm completely lost here.
Canada #1
A closer inspection revealed what I thought was a decrementing number, to which I tried halfing the number before subtracting time(). This returned a timestamp a few months off of the real timestamp, but still not correct.

A little later on, with a friend poking through the code as well, it was discovered it's not really decrementing, but randomly(?) jumping back and forth.

Is the date returned for written and last modified an object/object reference? This is getting into areas I have not been yet, and I'm still confused... My friend is anxious to know what the solution is, as am I, so I can complete my plugin information plugin. It's quite detailed...
Australia Forum Administrator #2
I can't really reproduce this. The following code:

$world->note ($world->GetPluginInfo ("4ea415972d64ffe602170f89", 13));

(when used with plugin "Idle_Message" which has an ID of "4ea415972d64ffe602170f89" displays this:

8/29/02 8:44:25 AM

However it might be worth commenting that if the date modified (14) is not provided you get an error because you get a null date returned.


Canada #3
I'm not quite sure how you managed to get an actual date from that. I'm using exactly the same code...

This is what I have in my script:

$world->note("Written: " . $world->getPluginInfo($item,13)); # reference
$world->note("Written: " . ${$world->getPluginInfo($item,13)}); # dereferenced value
$world->note("Written: " . localtime($world->getPluginInfo($item,13))); # as seconds since
$world->note("");
$world->note("Modified: " . ${$world->getPluginInfo($item,14)});
$world->note("Modified: " . localtime($world->getPluginInfo($item,14)));

And this is what I get:

Written: Win32::OLE::Variant=SCALAR(0x443c858)
Written: 71500508
Written: Fri Apr  7 20:17:08 1972

Modified: 71500404
Modified: Fri Apr  7 20:17:20 1972

The two times are very different in the plugin itself:

   date_written="2002-09-30 02:34"
   date_modified="2002-10-03 03:37"

And yet the returned values are never very far apart, almost like the values themselves are a pointer. Sometimes they change when executing the plugin a few seconds later, even though no change has been made to anything.

Extra Info:
------------
- $item contains the current plugin ID, retrieved in a foreach loop.
- Using ActivePerl v5.6.1 Build 633.
- Using MUclient 3.26.

Entire plugin may be downloaded from my webserver at:
http://fr.1of10.net/nx01/
The part I'm having problems with begins on line 202, with the first "written" note shown above.
Amended on Thu 03 Oct 2002 08:01 PM by 1of10
Australia Forum Administrator #4
The problem is the concatenation of the strings. When you pass the date down to world.note the OLE conversion converts it to a string. However doing this:


$world->note ("Written: " . $world->GetPluginInfo ("636a1df5adb9fb54adb38d8b", 13));


gives ...


Written: Win32::OLE::Variant=SCALAR(0x12c2828)


One workaround is to send them as different strings, like this:


$world->tell ("Written: ");
$world->note ($world->GetPluginInfo ("636a1df5adb9fb54adb38d8b", 13));


Or, you can let MUSHclient do the conversion for you, but setting and getting a variable, eg.


# convert time to a string
$world->setvariable ("x", $world->GetPluginInfo ("636a1df5adb9fb54adb38d8b", 13));

# get it back
$x = $world->getvariable ("x");

# display it
$world->note ("Written: $x");

Canada #5
Thank you!