Minor changes & fixes

This commit is contained in:
Yorhel 2025-04-23 16:12:39 +02:00
parent 8096de7497
commit 13271fa413
3 changed files with 8 additions and 11 deletions

5
FU.pm
View file

@ -694,7 +694,6 @@ sub json {
$FU::REQ->{json} ||= eval {
FU::Util::json_parse($FU::REQ->{body}, utf8 => 1)
} || fu->error(400, "JSON parse error: $@");
return $FU::REQ->{json} if !@_;
_getfield $FU::REQ->{json}, @_;
}
@ -945,7 +944,7 @@ __END__
=head1 NAME
FU - Framework Ultimatum: A Lean and Efficient Zero-Dependency Web Framework.
FU - A Lean and Efficient Zero-Dependency Web Framework.
=head1 EXPERIMENTAL
@ -1481,8 +1480,6 @@ Encode C<$data> as JSON (using C<json_format> in L<FU::Util>), set an
appropriate C<Content-Type> header and send it to the client. Calls C<<
fu->done >>.
I<TODO:> Support schema-based normalization.
=item fu->send_file($root, $path)
If a file identified by C<"$root/$path"> exists, set that as response and call

View file

@ -4,7 +4,7 @@ use v5.36;
use experimental 'for_list';
use FU;
use FU::XMLWriter ':html5_', 'fragment', 'xml_escape';
use Time::HiRes 'time';
use Time::HiRes 'time', 'clock_gettime', 'CLOCK_MONOTONIC';
use POSIX 'strftime';
sub fmtts { strftime '%Y-%m-%d %H:%M:%S UTC', gmtime shift }
@ -15,7 +15,8 @@ sub loc_($loc) {
br_ if $_;
my $l = $loc->[$_];
my $f = $_ == $#$loc ? '(main)' : $loc->[$_+1][3];
txt_ "$l->[1]:$l->[2] $f";
$f = "$l->[0]::$f" if $f !~ /^\Q$l->[0]/;
txt_ "$f @ $l->[1]:$l->[2]";
}
}
@ -35,7 +36,7 @@ my @tabs = (
tr_ sub { td_ 'Path'; td_ fu->path };
tr_ sub { td_ 'Query'; td_ fu->query };
tr_ sub { td_ 'Client IP'; td_ fu->ip };
tr_ sub { td_ 'Received'; td_ fmtts $FU::REQ->{trace_start} };
tr_ sub { td_ 'Received'; td_ fmtts(time - (($FU::REQ->{trace_end}||clock_gettime(CLOCK_MONOTONIC)) - $FU::REQ->{trace_start})) };
};
h2_ 'Headers';
table_ sub {

View file

@ -1,7 +1,7 @@
# FU - Framework Ultimatum: A Lean and Efficient Zero-Dependency Web Framework
# FU - A Lean and Efficient Zero-Dependency Web Framework
FU is a web development framework for Perl and a collection of handy utility
modules.
FU (Framework Ultimatum) is a web development framework for Perl and a
collection of handy utility modules.
*Contributing:* Refer to my [contribution guidelines](https://dev.yorhel.nl/contributing).
@ -23,7 +23,6 @@ Things that may or may not happen:
- FU::JSON - JSON::{XS,PP,etc}-compatible wrapper around FU::Util's JSON functions? I prolly won't need this myself, but could be handy.
- FU::DBI - DBI wrapper with a FU::Pg-like API, for easier integration into FU.
- FU::Mailer - Simple sendmail wrapper
# License