From b7188c192f6cbb37b98f52f5e829fdb487d881f5 Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Fri, 6 Dec 2024 17:43:31 +0100 Subject: [PATCH] Un-deprecate spurt method --- Changes | 3 ++- lib/Mojo/File.pm | 14 ++++++++------ lib/Mojolicious.pm | 4 +++- t/mojo/file.t | 5 +++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index fc6121d360..c6c375fc7c 100644 --- a/Changes +++ b/Changes @@ -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. diff --git a/lib/Mojo/File.pm b/lib/Mojo/File.pm index 5bfc9343c2..aa4ce500a5 100644 --- a/lib/Mojo/File.pm +++ b/lib/Mojo/File.pm @@ -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'); @@ -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()}) } @@ -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 that writes multiple chunks of bytes. + =head2 stat my $stat = $path->stat; diff --git a/lib/Mojolicious.pm b/lib/Mojolicious.pm index eaded13230..36012a0f64 100644 --- a/lib/Mojolicious.pm +++ b/lib/Mojolicious.pm @@ -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 { @@ -785,6 +785,8 @@ L. Every major release of L has a code name, these are the ones that have been used in the past. +10.0 C (U+1FACE) + 9.0, C (U+1F9C7) 8.0, C (U+1F9B9) diff --git a/t/mojo/file.t b/t/mojo/file.t index 5d5ce97a0d..0f62e30d51 100644 --- a/t/mojo/file.t +++ b/t/mojo/file.t @@ -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'; };