Aion-Format

 view release on metacpan or  search on metacpan

lib/Aion/Format.pm  view on Meta::CPAN

	Any others...
	
	<!----------- The work itself --------------->
	This book text!
	<!------------------------------------------->
	};
	
	$s =~ $re;
	my $result = {%+};
	$result # --> {author_link => "/to/book/link", author_name => "A. Alis", title => "Grivus campf"}

=head2 num ($number)

Adds separators between digits of a number.

	num +0         # => 0
	num -1000.3    # => -1 000.3

The default separator is a non-breaking space. Set the separator and decimal point the same way:

	num [1000, "#"]         		# => 1#000
	num [-1000.3003003, "_", ","]   # => -1_000,3003003

See also C<Number::Format>.

=head2 rim ($number)

Converts positive integers to B<Roman numerals>.

	rim 0       # => N
	rim 4       # => IV
	rim 6       # => VI
	rim 50      # => L
	rim 49      # => XLIX
	rim 505     # => DV

B<Roman numerals> after 1000:

	rim 49_000      # => XLIX M
	rim 49_000_000  # => XLIX M M
	rim 49_009_555  # => XLIX IX DLV

See also:

=over

=item * L<Roman> is a simple converter.

=item * L<Math::Roman> is another converter.

=item * L<Convert::Number::Roman> has an OOP interface.

=item * L<Number::Convert::Roman> – another OOP interface.

=item * L<Text::Roman> converts standard and milharic Roman numerals.

=item * L<Roman::Unicode> uses the numbers ↁ (5000), ↂ (1000) and so on.

=item * L<Acme::Roman> adds support for Roman numerals in Perl code (C<< I + II -E<gt> III >>), but only uses the C<+>, C<-> and C<*> operators.

=item * L<Date::Roman> is an object-oriented Perl extension for handling Roman-style dates but with Arabic numerals (id 3,702).

=item * L<DateTime::Format::Roman> - Roman date formatter, but with Arabic numerals (5 Kal Jun 2003).

=back

=head2 round ($number, $decimal)

Rounds a number to the specified decimal place.

	round 1.234567, 2  # -> 1.23
	round 1.235567, 2  # -> 1.24

=head2 sinterval ($interval)

Creates human-readable spacing.

The width of the result is 12 characters.

	sinterval  6666.6666 	# => 01:51:06.667
	sinterval  6.6666 		# => 00:00:06.667
	sinterval  .333 		# => 0.33300000 s
	sinterval  .000_33 		# => 0.3300000 ms
	sinterval  .000_000_33 	# => 0.330000 mks

=head2 sround ($number, $digits)

Leaves C<$digits> digits after the last zero (the 0 itself is ignored).

By default C<$digits> is 2.

	sround 10.11        # -> 10
	sround 12.11        # -> 12
	sround 100.11       # -> 100
	sround 133.11       # -> 133
	sround 0.00012      # -> 0.00012
	sround 1.2345       # -> 1.2
	sround 1.2345, 3    # -> 1.23

=head2 trans ($s)

Transliterates Russian text, leaving only Latin letters and dashes.

	trans "Мир во всём Мире!"  # => mir-vo-vsjom-mire

=head2 transliterate ($s)

Transliterates Russian text.

	transliterate "Мир во всём Мире!"  # => Mir vo vsjom Mire!

=head2 trapperr (&block)

Trap for B<STDERR>.

If there is an error in the block, C<STDOUT> is restored, but the output in the block is lost.

	trapperr { print STDERR "Stars: ✨" }  # => Stars: ✨

See also C<IO::Capture::Stderr>.



( run in 2.188 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )