paperlined.org
dev > perl
document updated 12 years ago, on Feb 20, 2012

Ways to quickly pretty-print ALL information that's within a type.

DateTime

print $obj->datetime;

Example output:

2011-09-07T19:20:19


print $obj->strftime("%F %r");

Example output:

2011-09-07 07:20:19 PM

DateTime::Duration

print Dumper { $obj->deltas };

Example output:

$VAR1 = {
          'seconds' => 49,
          'minutes' => 466,
          'nanoseconds' => 0,
          'days' => 3,
          'months' => 0
        };


Or, normalized:     ("We cannot convert between these units, because there is no fixed conversion between the two units")

print DateTime::Format::Duration->new(pattern => "%p %F %r", normalise => 1)->format_duration($obj);

Example output:

+ 0000-00-03 08:14:36

HTTP::Cookies

print $cookie_jar->as_string;

Example output:

Set-Cookie3: ASP.NET_SessionId=m0fqx155kdo20svot0dqczy3; path="/"; domain=citrix.domain.com; path_spec; secure; discard; HttpOnly; version=0
Set-Cookie3: NSC_XJ_10.0.40.69_443_mcwjq=44531629378b; path="/"; domain=citrix.domain.com; path_spec; discard; version=0
Set-Cookie3: WINGDevice="\"\""; path="/Citrix/XenApp/"; domain=citrix.domain.com; path_spec; secure; expires="2013-02-20 19:01:30Z"; HttpOnly; version=0
Set-Cookie3: WINGSession="\"\""; path="/Citrix/XenApp/"; domain=citrix.domain.com; path_spec; secure; discard; HttpOnly; version=0