Any chance the following update to Mojo::ByteStream->split would be
accepted?

sub split {
  my ($self, $pattern, $limit) = @_;
  return Mojo::Collection->new(map { $self->new($_) } split $pattern,
$$self, $limit//0);
}


My reason for needing this is that I need to parse a file into columns and
some of the columns at the end of a line are empty and being discarded.

$ perldoc -f split

            If LIMIT is omitted (or, equivalently, zero), then it is usually
            treated as if it were instead negative but with the exception
that
            *trailing empty fields are stripped* (empty leading fields are
            always preserved); if all fields are empty, then all fields are
            considered to be trailing (and are thus stripped in this case).
            Thus, the following:

                print join(':', split(',', 'a,b,c,,,')), "\n";

            produces the output 'a:b:c', but the following:

                *print join(':', split(',', 'a,b,c,,,', -1)), "\n";*

            *produces the output 'a:b:c:::'.*

I need to be able to get that last bold, and therefore need to pass -1 as
the limit.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to