Home Page   #javascript  #perl  #c  #openmoko  #php  #ruby-lang  #apache  #cisco  #java  #mysql   Wallpapers Girl
Reliable $1 Web Hosting by 3iX

Channels


#perl

15 October 2007


Total 32 pages. You are browsing page 1/32.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last

--- Log opened Mon Oct 15 00:00:18 2007
00:00 <****> whatsup rindolf?
00:02 <****> i'd pay double for a battery with the same general characteristics as a LI-Ion except it could charge in < 5 minutes
00:02 <****> perhaps triple, even
00:02 <****> jdv79: I'm fine.
00:02 <****> jdv79: sorted out my inbox.
00:03 <****> must of been daunting
00:06 <****> heya
00:06 <****> how can i calculate the string size in bytes?
00:06 <****> jole: bytes or chars?
00:07 <****> bytes
00:07 <****> length($str) is chars
00:07 <****> make sure that chars == bytes for $str
00:08 <****> then length Just Works(tm)
00:08 <****> or use bytes and length will report in bytes
00:08 <****> jdv79: no, wrong
00:08 <****> 'use bytes' is evil
00:08 * idiotben sends lots and lots of spam to rindolf... sorted out you say!? I'll fix that
00:08 <****> wrong?
00:08 <****> mauke, can you give me a simple example?
00:09 <****> jdv79: what's up with you?
00:09 <****> besides your dislike of it, how is it wrong?
00:09 <****> eval: my $str = "jole"; length $str
00:09 <****> mauke: 4
00:09 <****> is this bytes?
00:09 <****> Yes
00:09 <****> nothing is bytes
00:09 <****> each char is 1 byte?
00:09 <****> that's only true for some charsets
00:09 <****> be careful of that
00:09 <****> bytes only matter when interacting with the outside world
00:10 <****> and in that case you better specify the encoding you want to use
00:10 <****> he said he wants bytes - the way to get bytes is some incarnation of the bytes pragma
00:10 <****> no, it isn't
00:10 <****> why not?
00:10 <****> 'use bytes' gives you a random view of the perl internals
00:10 <****> that doesn't really help when you need to do something specific
00:11 <****>
00:11 <****> i disagree, its worked for me in the past
00:11 <****> doesn't mean it's not broken
00:12 <****> rindolf: trying to get a dist tested enough for CPAN
00:12 <****> if its broken shouldn't it be fixed instead of worked around?
00:13 <****> then fix it
00:13 <****> preaction_++
00:13 <****> eval: my $str = substr("\xff\x{1234}", 0, 1); print length $str; use bytes; print length $str; ""
00:13 <****> mauke: 12''
00:13 <****> PURR =^_^=
00:13 <****> jdv79: the concept is broken
00:13 <****> Hi pkrumins
00:14 <****> eval: my $str = substr("\xff\x{1234}", 0, 1); [ length $str, do { use bytes; length $str } ] # better
00:14 <****> mauke: [1,2]
00:14 <****> eval: my $str = substr("\xff\x{34}", 0, 1); [ length $str, do { use bytes; length $str } ]
00:14 <****> mauke: [1,1]
00:15 <****> eval: substr("\xff\x{1234}", 0, 1);
00:15 <****> Zoffix: 30188: Use of uninitialized value in pattern match (m//) at /usr/share/perl/5.8/utf8_heavy.pl line 211.30188: Use of uninitialized value in scalar assignment at /usr/share/perl/5.8/utf8_heavy.pl line 227.30188: Use of uninitialized value in "\x{ff}"
00:16 <****>:[
00:16 <****> jdv79: which dist?
00:18 <****> mine. i actually don't have a god name for it yet:( its currently called Test::JDV as a placeholder but I'm thinkin' about Test::ByContract.
00:18 <****> *good
00:18 <****> hi rindolf
00:19 <****> rindolf, just launched: http://picurls.com
00:19 <****> In general, one is much better off if one avoids the use of "bytes::" or "use bytes" completely.
00:19 <****> pkrumins: yes, I saw.
00:20 <****> It is a sign that something more fundamental is wrong in your program: you're mixing byte and character semantics, which theoretically isn't even possible. (Of course, Perl makes the impossible merely hard.)
00:20 <****> Juerd, you lovely voice of sanity
00:20 <****> sanity has no place here!:)
00:21 <****> http://www.youtube.com/watch?v=NIfl2o44zb0
00:21 <****> mauke: What do you mean by that? :)
00:21 <****>
00:21 <****> Zoffix: That is fixed in 5.10
00:21 <****> how do I call bash functions from perl?
00:22 <****> sweet, Acme::LOLCAT
00:23 <****> Zoffix: In the next Perl release, that paragraph says: Note the characters: if the EXPR is in Unicode, you will get the number of characters, not the number of bytes. To get the length of the internal string in bytes, use bytes::length(EXPR), see bytes. Note that the internal encoding is variable, and the number of bytes usually meaningless. To get the number of bytes that the string would have when encoded as UTF-8, use length(Encoding::encode_utf8(EXPR)).
00:23 <****> level1_, system qw'bash -c', 'expr'
00:23 <****> Zoffix: So *not* bytes::length!
00:23 <****> quick, someone hack that into the bot
00:23 <****> weirdo: cool, does that require a module? (ie, use system?)
00:23 <****> no
00:23 <****>ping($host, 10); shouldn't the timeout then be 10 seconds?
00:24 <****> nollan, ref $c
00:24 <****> it returns directly
00:24 <****> Juerd, why does length(Encoding::encode_utf8(EXPR)) return bytes and not characters?
00:25 <****> it returns characters, but those characters are bytes
00:25 <****> I don't understand. maybe I should read what Encoding is. :)
00:25 <****> (I thought it was Encode:: at first)
00:26 <****> oh. isn't it supposed to be Encode::?
00:27 <****> probably..
00:27 <****> I still don't get what "characters are bytes" means, though. UTF-8 is not one char = one byte.
00:27 <****> it is, actually
00:27 <****> :-)
00:28 <****> Characters can be encoded to bytes. Maybe that's what's meant.
00:28 <****> to me, "char" is an element of a string in Perl
00:28 <****> wolverian: encode_utf8 returns a byte string.
00:28 <****> a "byte" is something that's communicated over IO channels
00:28 <****> Juerd, ah. thanks.
00:29 <****> wolverian: And in a byte string, 1 byte = 1 character.
00:29 <****> wolverian: Note that "byte string" and "text string, internally encoded as iso-8859-1" are technically exactly the same thing, but theoretically radically different.
00:30 <****> To me, "char" is a word that should always be avoided, because "char" abbreviated exactly like that, means "byte" in C.
00:30 <****> I guess utf8 is one byte = one character, as long as your bytes are variable length..
00:30 <****> If you must abbreviate, use chr, which corresponds to Perl's chr function, which of course does Unicode.


Total 32 pages. You are browsing page 1/32.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last


Tutti i nuovi CAP Italiani. Come ottenere il database completo