FAQ
Hi,

I'm looking for a way to find the size of a DateTime::SpanSet, i.e. the
number of DateTime:Span objects in it.

I'm not looking for a DateTime::Duration object, as the size() method
returns.

Kind regards,
Andreas

Search Discussions

  • Metz, Bobby at Sep 4, 2013 at 4:56 pm
    I don't use this module, but check the docs on the as_list() method. The config example (copied below) should give you an idea on how to get the # of objects without the addition of any special methods required.

    my @dt_span = $set->as_list( span => $span );

    Bobby

    From: Andreas Isberg
    Sent: Monday, September 02, 2013 3:33 AM
    To: datetime@perl.org
    Subject: Determine size of a DateTime::SpanSet?

    Hi,

    I'm looking for a way to find the size of a DateTime::SpanSet, i.e. the number of DateTime:Span objects in it.

    I'm not looking for a DateTime::Duration object, as the size() method returns.

    Kind regards,
    Andreas
  • Flavio S. Glock at Sep 4, 2013 at 6:16 pm
    You can use as_list() to transform the SpanSet into a list of Spans, and
    then count the Spans:

       print "number of spans: ", scalar($s1->as_list);


    2013/9/2 Andreas Isberg <andreas@isberg.se>
    Hi,

    I'm looking for a way to find the size of a DateTime::SpanSet, i.e. the
    number of DateTime:Span objects in it.

    I'm not looking for a DateTime::Duration object, as the size() method
    returns.

    Kind regards,
    Andreas

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdatetime @
categoriesperl
postedSep 2, '13 at 10:32a
activeSep 4, '13 at 6:16p
posts3
users3
websitemetacpan.org...

People

Translate

site design / logo © 2019 Grokbase