What do people think about move_to() creating the directory to the file
that it will spurt rather than generating an error?
sub move_to {
my ($self, $to) = @_;
make_path dirname($to); # Something like this?
spurt $self->{content}, $to;
return $self;
}
Or what about doing it in spurt()?
sub spurt {
my ($content, $path) = @_;
make_path dirname($path); # Something like this?
croak qq{Can't open file "$path": $!} unless open my $file, '>', $path;
croak qq{Can't write to file "$path": $!} unless defined
$file->syswrite($content); return $content; }
What might be the harm in creating the path automatically rather than croaking
because the path isn't there?
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.