Skip to content

Instantly share code, notes, and snippets.

@frioux
Created August 26, 2011 04:46
Show Gist options
  • Save frioux/1172717 to your computer and use it in GitHub Desktop.
Save frioux/1172717 to your computer and use it in GitHub Desktop.
Why even being in #p5p is not worth my time
< frew> does anyone think that it would be worthwhile to implement a pure perl implementation of the various POSIX functions that are fallbacks?
< frew> it seems like it would mostly be SMOP and it would really help at least me :-)
< frew> (win32 boo)
<@LeoNerd> Which functions did you have in mind?
< frew> well I just ran into WEXITSTATUS
<@Steve_p> That was done, wasn't it?
< frew> and I had an issue with the date formatting a while ago
<@LeoNerd> strftime?
<+purl> hmmm... strftime is in POSIX.pm or possibly *very* useful for formatting dates or %Y%m%d is what you want
< frew> yessir
<+dipsy> strftime is implemented in terms of the local strftime(3), so if it isn't documented, you ain't got it
<@LeoNerd> Yeah.. things like strftime are nontrivial to write in Perl
< frew> why?
<+dipsy> because
<@LeoNerd> Mostly for not having a full locale set of day names, month names,...
< frew> oooh
< frew> good point
<+purl> nice and sharp
< frew> hadn't even thoguht of that
<@LeoNerd> purl: Shutup
<+purl> I Can't take the *LOUD BOOMING SILENCE!*
<@Steve_p> purl++ # appropriate to the conversation
<@LeoNerd> The various numeric formats are simple enough, it's the locale-aware ones that become harder
< frew> right
< frew> I just think for simple stuff it would be worthwhile
< frew> and WEXITSTATUS is an example of those
<@LeoNerd> I'm not sure I agree... Is there a platform that -actually- lacks strftime?
< frew> win32 :-)
< frew> I only mention issues I have actually run into
<@LeoNerd> Hrmm
<@Steve_p> win32 has strftime
<@LeoNerd> Yah.. I thought it did :)
<@LeoNerd> also, Time::Piece embeds one
>>> frew digs up test failure to show humans
<@LeoNerd> So if all else fails, you can use the one from there
<@Steve_p> http://msdn.microsoft.com/en-us/library/fe06s4ak(v=vs.71).aspx
<+dipsy> [ strftime, wcsftime (CRT) ]
<@LeoNerd> Bah. I really dislike functions of this form
<@LeoNerd> The one true way is C99's snprintf()
< frew> http://cpantesters.org/cpan/report/d70d0a9a-6cd5-1014-bc2a-f0569855645b
<+dipsy> [ CPAN Testers Reports: Report for Log-Sprintf-0.001000 ]
<@LeoNerd> returning 0 on buffer overflow is not helpful; it leads to nlogn behaviou
< frew> Steve_p: see link
<@Steve_p> Available date formats do vary from OS to OS.
<@Steve_p> What works on Linux might not work on Mac OS X and Win32
<@LeoNerd> Ahhh... No strptime, it would appear :/
< frew> well, that one returned ' ' for YYYY-MM-DD HH:MM:SS
<@LeoNerd> ?
<@LeoNerd> That's not a strftime format
< frew> LeoNerd: the link
<+purl> well, the link is that people always say 'use hashes instead'
< frew> well
<@Steve_p> MM twice?
<@LeoNerd> That too :)
< frew> I imagine neither of you are compilers and know what I mean
<@Steve_p> Do you want help or not?
<@chip> Time::Piece is the new hotness?
<@LeoNerd> chip: Eh... dunno.
<@LeoNerd> It's been core a while, and every time I want to suggest adding strptime to POSIX, people point out it's already in Time::Piece
< frew> Steve_p: no, I don't need help as this was fixed for me a *long* time ago
==> frew was kicked from #p5p by Steve_p (frew)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment