From 0d9ec0844bcba12bc2cf999cd480a70f48b9c6b5 Mon Sep 17 00:00:00 2001 From: trizen Date: Fri, 4 Oct 2024 10:32:07 +0300 Subject: [PATCH] - Added the FileHandle `.printlnf()` method. Also aliased as `.sayf()`. Example: STDERR.sayf("Value: %04d", 42) --- lib/Sidef/Types/Glob/FileHandle.pm | 7 +++++++ lib/Sidef/Types/Glob/FileHandle.pod | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/Sidef/Types/Glob/FileHandle.pm b/lib/Sidef/Types/Glob/FileHandle.pm index 37f58b8c..4006eeeb 100644 --- a/lib/Sidef/Types/Glob/FileHandle.pm +++ b/lib/Sidef/Types/Glob/FileHandle.pm @@ -113,6 +113,13 @@ package Sidef::Types::Glob::FileHandle { (CORE::printf {$self->{fh}} @args) ? (Sidef::Types::Bool::Bool::TRUE) : (Sidef::Types::Bool::Bool::FALSE); } + sub printlnf { + my ($self, $format, @args) = @_; + $self->printf("$format\n", @args); + } + + *sayf = \&printlnf; + sub iter { my ($self) = @_; Sidef::Types::Block::Block->new( diff --git a/lib/Sidef/Types/Glob/FileHandle.pod b/lib/Sidef/Types/Glob/FileHandle.pod index 3464504d..e5c018fd 100644 --- a/lib/Sidef/Types/Glob/FileHandle.pod +++ b/lib/Sidef/Types/Glob/FileHandle.pod @@ -290,6 +290,16 @@ Aliases: I =cut +=head2 sayf + + self.sayf(format, *args) + +Returns the + +Aliases: I + +=cut + =head2 seek self.seek(pos, whence)