Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I had a problem with the lastLogin field of user accounts when querying ADSI with Win32::OLE.

    The trick was to use Win32::OLE::Variant:

    use Win32::OLE::Variant;
    use Time::Local;

    #snipped for brevity

    my $unixtime = date2unix( Variant(VT_DATE, $object->Get("lastLogin")) );

    exit 0;

    sub date2unix {
      my $date = shift || return -11644473600;

      if ($date =~ /^([0-9]{2})\/([0-9]{2})\/([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/) {
         return timelocal($6,$5,$4,$1,$2-1,$3);
      }
    }

    If that helps at all.

    • Excellent. Doesn't work for all values, but works for most. I think I now owe you much beer :)

      A new version of Mail::Outlook out soon ;)