Skip to content

Commit

Permalink
- Added the FileHandle .printlnf() method.
Browse files Browse the repository at this point in the history
Also aliased as `.sayf()`.

Example:

	STDERR.sayf("Value: %04d", 42)
  • Loading branch information
trizen committed Oct 4, 2024
1 parent 1c900b5 commit 0d9ec08
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Sidef/Types/Glob/FileHandle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions lib/Sidef/Types/Glob/FileHandle.pod
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,16 @@ Aliases: I<println>

=cut

=head2 sayf

self.sayf(format, *args)

Returns the

Aliases: I<printlnf>

=cut

=head2 seek

self.seek(pos, whence)
Expand Down

0 comments on commit 0d9ec08

Please sign in to comment.