All pastes #2131164 Raw Edit

Unnamed

public text v1 · immutable
#2131164 ·published 2012-03-22 18:48 UTC
rendered paste body
        @.months = <Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec> if @.months.elems == 0;
               
        my Str @whole_schedule =  
        (
            (
                (
                    ('MNTH=' X~ (@.months.elems == 0) ?? '' !! @.months)
                    X~
                    (';ORDN=' X~ (@.ordinal.elems == 0) ?? '' !! @.ordinal) 
                )
                X~
                (';MDAY=' X~ (@.monthdays.elems == 0) ?? '' !! @.monthdays)    
            )
            X~
            (';WDAY=' X~ (@.weekdays.elems == 0) ?? '' !! @.weekdays)  
        )
        X~
        (';TIME=' X~ (@.time.elems == 0) ?? '' !! @.time)                    
        ; 

        my %event_spec;
        my Int $index = 0;
        for @whole_schedule -> $event {
            my @event_data = split /';'/, $event;
            for @event_data -> $data {
                my (Str $type, Str $value) = split '=', $data;
                if $value ne '' {
                    my %ev;
                    %ev{$type} = $value;
                    %event_spec{$index} = %ev;
                    say $index ~ %ev.perl ~ "===>" ~ %event_spec.perl;
                } # This is a workaround until (%h<a><b> = x) is implemented on rakudo
            }
            $index++;
        }