Skip to content

Commit

Permalink
Un-deprecate spurt method
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 6, 2024
1 parent 2292890 commit b7188c1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

10.0 2024-12-26
- Code name "...", this is a major release.
- Code name "Moose", this is a major release.
- Un-deprecated the spurt method in Mojo::File, it is now an alternative to spew.
- Removed deprecated support for "'" package separators.
- Removed deprecated support for ?format=* parameter in favor of ?_format=* for content negotiation.
- Removed deprecated support for padded session cookies.
Expand Down
14 changes: 8 additions & 6 deletions lib/Mojo/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use File::stat ();
use File::Temp ();
use IO::File ();
use Mojo::Collection;
use Mojo::Util qw(decode deprecated encode);
use Mojo::Util qw(decode encode);

our @EXPORT_OK = ('curfile', 'path', 'tempdir', 'tempfile');

Expand Down Expand Up @@ -146,11 +146,7 @@ sub spew {
return $self;
}

# DEPRECATED!
sub spurt {
deprecated 'Mojo::File::spurt is deprecated in favor of Mojo::File::spew';
shift->spew(join '', @_);
}
sub spurt { shift->spew(join '', @_) }

sub stat { File::stat::stat(${shift()}) }

Expand Down Expand Up @@ -491,6 +487,12 @@ Read all data at once from the file. If an encoding is provided, an attempt will
Write all data at once to the file. If an encoding is provided, an attempt to encode the content will be made prior to
writing.
=head2 spurt
$path = $path->spurt(@bytes);
Alias for L</"spew"> that writes multiple chunks of bytes.
=head2 stat
my $stat = $path->stat;
Expand Down
4 changes: 3 additions & 1 deletion lib/Mojolicious.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ has types => sub { Mojolicious::Types->new };
has ua => sub { Mojo::UserAgent->new };
has validator => sub { Mojolicious::Validator->new };

our $CODENAME = '...';
our $CODENAME = 'Moose';
our $VERSION = '10.0';

sub BUILD_DYNAMIC {
Expand Down Expand Up @@ -785,6 +785,8 @@ L<https://opensource.org/licenses/OFL-1.1>.
Every major release of L<Mojolicious> has a code name, these are the ones that have been used in the past.
10.0 C<Moose> (U+1FACE)
9.0, C<Waffle> (U+1F9C7)
8.0, C<Supervillain> (U+1F9B9)
Expand Down
5 changes: 3 additions & 2 deletions t/mojo/file.t
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ subtest 'Temporary file' => sub {
my $file = tempfile(DIR => $dir);
my $path = "$file";
ok -f $path, 'file exists';
is $file->dirname, $dir, 'same directory';
is $file->spew('test')->slurp, 'test', 'right result';
is $file->dirname, $dir, 'same directory';
is $file->spew('test')->slurp, 'test', 'right result';
is $file->spurt('just', 'a', 'test', '123')->slurp, 'justatest123', 'right result';
undef $file;
ok !-f $path, 'file does not exist anymore';
};
Expand Down

0 comments on commit b7188c1

Please sign in to comment.