Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kfly8 committed Aug 14, 2024
1 parent b8dcac4 commit 7c100c9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
4 changes: 2 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"abstract" : "It's new $module",
"abstract" : "assert keyword for Perl",
"author" : [
"kobaken <[email protected]>"
],
"dynamic_config" : 0,
"generated_by" : "Minilla/v3.1.24, CPAN::Meta::Converter version 2.150010",
"generated_by" : "Minilla/v3.1.25, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
[![Actions Status](https://github.com/kfly8/Syntax-Keyword-Assert/actions/workflows/test.yml/badge.svg)](https://github.com/kfly8/Syntax-Keyword-Assert/actions)
# NAME

Syntax::Keyword::Assert - It's new $module
Syntax::Keyword::Assert - assert keyword for Perl

# SYNOPSIS

use Syntax::Keyword::Assert;

sub hello($name) {
assert { defined $name };
say "Hello, $name!";
}

hello("Alice"); # => Hello, Alice!
hello(); # => Dies when STRICT_MODE is enabled

# DESCRIPTION

Syntax::Keyword::Assert is ...
This module provides a syntax plugin that introduces an **assert** keyword to Perl.
It dies when the block returns false and `STRICT` mode is enabled. When `STRICT` mode is disabled, the block is ignored at compile time. The syntax is simple, `assert BLOCK`.

`STRICT` mode is controlled by [Devel::StrictMode](https://metacpan.org/pod/Devel%3A%3AStrictMode).

# SEE ALSO

[PerlX::Assert](https://metacpan.org/pod/PerlX%3A%3AAssert), [Devel::Assert](https://metacpan.org/pod/Devel%3A%3AAssert), [Carp::Assert](https://metacpan.org/pod/Carp%3A%3AAssert)

# LICENSE

Expand Down
19 changes: 17 additions & 2 deletions lib/Syntax/Keyword/Assert.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,30 @@ __END__
=head1 NAME
Syntax::Keyword::Assert - It's new $module
Syntax::Keyword::Assert - assert keyword for Perl
=head1 SYNOPSIS
use Syntax::Keyword::Assert;
sub hello($name) {
assert { defined $name };
say "Hello, $name!";
}
hello("Alice"); # => Hello, Alice!
hello(); # => Dies when STRICT_MODE is enabled
=head1 DESCRIPTION
Syntax::Keyword::Assert is ...
This module provides a syntax plugin that introduces an B<assert> keyword to Perl.
It dies when the block returns false and C<STRICT> mode is enabled. When C<STRICT> mode is disabled, the block is ignored at compile time. The syntax is simple, C<assert BLOCK>.
C<STRICT> mode is controlled by L<Devel::StrictMode>.
=head1 SEE ALSO
L<PerlX::Assert>, L<Devel::Assert>, L<Carp::Assert>
=head1 LICENSE
Expand Down

0 comments on commit 7c100c9

Please sign in to comment.