All pastes #111194 Raw Edit

Stuff

public text v1 · immutable
·published 2006-08-02 06:38 UTC
rendered paste body
package Processor::Time;

use strict;
use warnings;

sub new { return bless {}; }

sub process {
    my($self, $hash) = @_;
  
    local $_ = $hash->{message};
    
    #Is this input for us?
    return undef unless /^!time\s*/;

    # Slurp up the args
    s/^!time\s*//;
    my @args = split /\s/;

    # Return help if it was requested, otherwise return GMT time.
    return "Usage: !time [timezone]"
	if defined($args[0]) && $args[0] =~ /help/i;
    return scalar gmtime(time);
}

1;