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

Channels


#perl

09 November 2007


Total 36 pages. You are browsing page 5/36.

First :: Prev :: [...] [3] [4] [5] [6] [7] [...] :: Next :: Last

03:07 <****> mauke: hi, master. so, in map i cant execute more than 1 instruction
03:07 <****> sure you can
03:07 <****> from perldoc -f " @chars = map(chr, @nums);"
03:07 <****> map isn't a great way to solve that given perl's implementation. There are better ways.
03:08 <****> for two reasons: 1) map has special support for it and 2) anywhere you can have an expression you can have any kind of code
03:08 <****> how would i write a sub instead of chr?
03:08 <****> inline
03:08 <****> { blargh }
03:08 <****> with map, anyway. Normally you'd do sub { blargh }..
03:08 <****> first, if map didn't have special support, you'd simply use do { } to turn a block into an expression
03:08 <****> @strings = map do {foo; bar; baz}, @strings;
03:09 <****> but you can also write map { foo; bar; baz } @strings
03:09 <****> (note: no comma)
03:09 <****> mauke: ok, thanks. sorry for my dumbness
03:09 <****> you're not being dumb so far
03:10 <****> aye, you're doing better than most :)
03:11 <****> a maux and a mauke? that's worse than integral and initself.
03:11 <****> heh
03:12 <****> mst and msf...
03:13 <****> HINK
03:32 <****> I'm www::Mechanize submit()ing a form. But I keep getting a broken pipe. Does anybody know a reason for this? The content is about 80Kb.
03:32 <****> I'm wondering if the buffer is too small... or it's an OS issue.
03:32 <****> Not without seeing your code.
03:32 <****> It's not a buffer issue.
03:32 <****> if anybody has a second and can help me fix a regex problem http://pastebin.com/maa1a4f9 any help is apperciated
03:33 <****>message() says "Broken Pipe"
03:33 <****> fridgid: What's the problem.
03:33 <****> no, let's see all the code flight16
03:33 <****> its all in the pastebin, i got a regex thats set to match some, but on lines where it appears twice its messing up
03:33 <****> fridgid: what are you trying to do?
03:33 <****> and what's not working?
03:34 <****> http://pastebin.com/maa1a4f9
03:34 <****> its all in that
03:35 <****> I have isolated it so that it's working for the same site on a different page. You download a .csv file with custom columns based on what checkboxes you select. When I select a small number of columns in the .csv report, it works. But when I select too many, I get a broken pipe.
03:35 <****> That's why I thought that the broken pipe was happening when the content returned from submit becomes too large.
03:35 <****> i have a regex thats set to match i18n(xxx) and save it into $1, but on lines where there are two i18n(xxx) it doesn't make two statements, it just makes one, how can i make it match them both
03:35 <****> Broken pipe is probably what the server is saying.
03:35 <****> use the /g modifier, fridgid
03:35 <****> alester, I have 100s of lines parsing HTML for this site that isn't directly related to www::mechanize
03:36 <****> Maybe the timeout is too short...? But that would be a client decision, not server decision.
03:36 <****> It works fine in firefox.. :(
03:37 <****> alester, i believe thats half of it, its still not matching the first set correctly
03:37 <****> im trying to grab the xx out of i18n(xxx) but on lines there are two i18n(xxx), its returning xxx)...i18n(xxx
03:38 <****> fridgid: Her'es hte deal
03:38 <****> Perl's regexes are greedy by default.
03:38 <****> It's matching the longest string possible .
03:38 <****> so they do the largest match?
03:38 <****> Yes
03:38 <****> Yes.
03:38 <****> So,
03:38 <****> you have two solutions
03:38 <****> either:
03:38 <****> "[^"]+"
03:38 <****> which means
03:38 <****> negated char class
03:38 <****> "quote and then a number of things that are not quotes, and then a quote
03:38 <****> OR
03:39 <****> \([^)]+\)
03:39 <****> "(.*?)"
03:39 <****> ^ id on't get the one above
03:39 <****> alester, ah, actually, the brokenpipe is coming from syswrite.
03:39 <****> which is "quote followed by a parsimonious match followed by a quote"
03:39 <****> parsimonious = non-greedy
03:39 <****> parsimonious = shortest possible match
03:40 <****> fridgid: [^abc] matches any single character other than a, b, or c
03:40 <****> is that what the ? does?
03:40 <****> jagerman's makes no sense.
03:40 <****> Oh
03:40 <****> What's wrong with mine?
03:40 <****> The ? means "Make the thing before it parsimonious"
03:40 <****> he's not matching parens, he's matching double quotes
03:40 <****> Are you sure?
03:40 <****> ok, thats what i was looking for, i've been pouring over this damn o'reilly book tring to find that, i know i read it somewhere
03:41 <****> I saw something about i18n(xxx)
03:41 <****> jagerman, http://pastebin.com/maa1a4f9
03:41 <****> i'll see if i can't fix it
03:41 <****> Oh, I didn't see the paste.
03:41 <****> jagerman-- # for jumping into the middle
03:42 <****> ok new problem, now it only matches the first one per line
03:42 <****> even with /g?
03:43 <****> fridgid: You'll have to change your code around a bit, since you're running all this code for each match
03:43 <****> any advice?
03:43 <****> please, i want to delete from an array all elements that matches a regex
03:43 <****> grep
03:44 <****> maux: That means you want to keep the ones that don't match, right?
03:44 <****> alester: eys
03:44 <****> yes
03:44 <****> @a = grep { !/regex/ } @a;
03:44 <****> maux, @new = grep { !/foos/ } @foos.
03:44 <****> alester: easy
03:44 <****> with the parsimonious fix, everything works except for lines with double matches, only the first match shows
03:44 <****> tahnks
03:44 <****> fridgid: Do you need to replace the values in the original string?
03:44 <****> you're welcome.
03:44 <****> i don't believe i need to
03:44 <****> let's see your new code, fridgid
03:44 <****> k
03:45 <****> fridgid: Then you can do: while ($string =~ /match/g) { ... the code ... }
03:46 <****> http://pastebin.com/m553047be
03:46 <****> while ($line =~ /i18n...../g) {


Total 36 pages. You are browsing page 5/36.

First :: Prev :: [...] [3] [4] [5] [6] [7] [...] :: Next :: Last


Tutti i nuovi CAP Italiani. Come ottenere il database completo