Christian Hansen
Recent Actions
-
Posted Reading UTF-8 at GB/s to Christian Hansen
-
Posted Time::Str - Time Zones and Leap Seconds to Christian Hansen
-
Commented on Installing Bit::Vector on Debian 13 (Trixie)
Thanks for sharing! Can I ask how you managed to get such nice formatting on blogs.perl.org? Whenever I try to include a code block, it seems to be limited to 67 characters and the lines get cut off....
-
Commented on Introducing Time::Str
That sounds worth exploring further. Would you mind filing an issue on GitHub so we can track it? p5-time-str....
-
Posted Introducing Time::Str to Christian Hansen
-
Posted Faster UTF-8 Validation to Christian Hansen
A while back, I received a pull request suggesting that I update the performance comparison with Encode.pm in my module,
Unicode::UTF8. When I originally wroteUnicode::UTF8,… -
Commented on Happy sharing
The API and code look excellent, great work!...
-
Commented on Lingua::* - From 17 to 61 Languages: Resurrecting and Modernizing PetaMem's Number Conversion Suite
I took a look at Lingua::SWE::Word2Num, and the documentation states that the input text must be UTF-8 encoded. That feels like an awkward API, does it really expect raw UTF-8 code units instead of native Perl strings? From the SYNOPSIS:...
-
Commented on Websockets in Catalyst
Nicely done! Informative and well put together....
-
Commented on Supercharge Event Loops with Thread::Subs
Perl’s ithreads work by cloning the entire interpreter for each new thread, which is significantly more expensive than using fork() with copy-on-write. It’s also crucial to carefully review all module dependencies before adopting ithreads, as many CPAN modules are neither...
-
Commented on Test2/Test::Builder Update from the QAH
These are fundamental concepts in any R&D, why should we be different?...
-
Commented on Test2/Test::Builder Update from the QAH
1) If it ain't broke, don't fix it! 2) Opt-in not opt-out! 3) Don't punish upstream authors/maintainers for your new fancy framework! Opt-in not Opt-out! -- chansen...
-
Commented on A Date with CPAN, Part 2: Target First, Aim Afterwards
First, I would like to apology for my first message, it came out a lot harsher than I intended! Just because Time::Piece is in core doesn't mean it's stable! Time::Piece has several quirks: Time::Piece->strptime() parses any given string as being...
-
Commented on A Date with CPAN, Part 2: Target First, Aim Afterwards
BTW, there is a reason for ISO 8601 and why Time::Moment implements it ;) -- chansen...
-
Commented on A Date with CPAN, Part 2: Target First, Aim Afterwards
You cannot parse an arbitrary date or date with time without heuristics, you have declared that you intend to use Date::Parse and Time::ParseDate to parse your dates, both of those modules uses heuristics. How do you intend to deal with...
-
Commented on A Date with CPAN, Part 1: State of the Union
Time::Moment doesn't have an explicit method for truncating, but you can truncate to day by calling the method ->at_midnight. You can also truncate to other calendar components by chaining the ->at_midnight call with a ->with_day_of_xxxx method call. Examples: $tm =...
-
Posted Calculating U.S Federal holidays with Time::Moment to Christian Hansen
… -
Posted Simple and efficient formatting of relative date/time using Time::Moment to Christian Hansen
#!/usr/bin/perl use warnings; use Carp qw[]; use Time::Moment 0.19 qw[]; sub YEAR () { 365.2425 } sub MONTH () { YEAR / 12 } sub DAY () { 1 } sub HOUR () { DAY / 24 } sub MINUTE () { HOUR / 60 } sub SECOND () { MINU… -
Commented on Time::Moment vs DateTime
And the benchmark:...
-
Commented on Time::Moment vs DateTime
Time::Moment only use gettimeofday(2) and localtime(3) to compute the difference. I did consider to add Panda::Date until I reviewed the source code. Your code isn't thread safe and you require 5.18 to compile it, and your naïve implementation of a...
-
Posted Let's talk about Time::Moment and round-trip of strings to Christian Hansen
In my previous blog post I wrote a lot more about Time::Moment, than appeared in the post (could have been my mistake due to a preview and error and a…
-
Commented on Time::Moment vs DateTime
I'm not sure what you are asking, if you think I didn't try to improve the performance of DateTime.pm, you think wrong (look at the changelog or ask Dave Rolsky). Time::Moment can never be "backwards" comparability with DateTime.pm due to...
-
Commented on A bit more about Time::Moment
While it would be technically possible, it would make the API confusing and fragile IMHO. I intend to add a Duration object (Time::Moment::Duration). $duration = $tm1->minus($tm2); $tm2 = $tm1->plus($duration); $tm2 = $tm1->minus($duration); $duration = $tm1 - $tm2; $tm2 = $tm1...
-
Commented on A bit more about Time::Moment
LOL, somewhere this blogpost got choped =(...
-
Posted A bit more about Time::Moment to Christian Hansen
In my previous blog post I mentioned the bottlenecks of DateTime and why I had to develop Time::Moment and it's underlying c library,
-
Commented on Time::Moment vs DateTime
I'm glad you like c-dt, Time::Moment only uses a fraction of the API povided by c-dt. As you might have seen c-dt provides calculation of easter (western/orthodox), efficient business day calculations and weekday calculations and a bit more. c-dt is...
-
Commented on Time::Moment vs DateTime
Thanks, I'll consider adding Class::Date and Panda::Date to the benchmark....
-
Commented on Time::Moment vs DateTime
Time::Moment represents an unambiguous point in time, but it's not fully time zone aware. If you have a local time (a point in time with an offset) you may need to use a time zone if you intend to perform...
-
Posted Time::Moment vs DateTime to Christian Hansen
In December last year released the first version of Time::Moment. I don't foresee any major changes in Time::Moment 0.16 API, so in next release I'll remove the "early preview release" notice in the description. I have been using 0.16 in…
-
Commented on YAPC::Asia Tokyo 2013: Fighting Legacy Code
If my URL::Encode::XS makes a difference you should try Unicode::UTF8 (also my module), it makes a huge difference in my deployments. -- chansen...
Comment Threads
-
john napiorkowski commented on
Websockets in Catalyst
Instead of reaching into $env, you want want to look at the -> io_fh method in Catalyst::Request. We added this and some other PSGI 'jailbreak' features to Catalyst about 13 years ago. Sadly the Advent site is gone but the articles remain on github:
https://github.com/perl-catalyst/2013-Advent-Staging/tree/master/1to4-Nonblocking-Streaming/eg
-
Nerdvana commented on
Websockets in Catalyst
Wow, indeed I missed this. To be fair, the mechanism of not writing the response as a side effect of accessing an attribute on the Request object is a bit unintuitive and undocumented... but if I had grepped the source for 'websocket' I would have found
```
# Support skipping finalize for psgix.io style 'jailbreak'. Used to support
# stuff like cometd and websockets
if($c->request->_has_io_fh) {
$c->log_response;
return;
}
```I remember digging through the source code in 2019 and finding that finalize_body and _build_write_fh w…
-
Dean commented on
Installing Bit::Vector on Debian 13 (Trixie)
just inline css
-
Mohawk commented on
Happy sharing
For interoperating between PDL and Buffer, there is a (for now still undocumented) new method,
new_around_datasv, which is also zero-copy:
my $pdl = PDL->new_around_datasv(0+$buf->as_scalar);
$pdl->set_datatype(double->enum);
$pdl->setdims([10000]);
$pdl->set_donttouchdata;
printf "mean=%.4f stddev=%.4f\n", $pdl->stats;
-
JJ Atria commented on
Installing Bit::Vector on Debian 13 (Trixie)
This unblocked me at $work this morning. Thanks for the write-up!
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.