@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29



Comments:

<0> Yaakov: microperl SHOULD work.
<1> hello.
<1> i'm using DBI, but it seems like i've run into a problem: whenever a child-process dies, it brings down the connection to the mysql-server.
<1> any idea how i can prevent this from happening?
<2> I should know this... but
<2> I've got @ArrayOfKeys and @ArrayOfValues - what's the easiest way to make a %HashOfBoth
<3> anyone around who can help me with an inherentance question? I'm trying to inherit bit::vector, and getting nowhere
<4> @hash{@ArrayOfKeys} = @ArrayOfValues;
<5> fsweetser: Like use base 'Bit::Vector';?
<3> haven't tried use base, I'll have to check that out
<6> perldoc base
<7> base. To access this perldoc please type, at a command line, 'perldoc base'. You may also find it at http://perldoc.perl.org/base.html
<8> BinGOs, are you sure poe works nonblocking on windows ?
<3> okay, doesn't look like that'll actually help with my problem
<8> it says " # Do it the Win32 way. XXX This is incomplete." in the code
<9> janhaa: parent and child processes can NOT share the same DBI connection



<3> specifically, I'm trying to overload 'new', but still call the parent new
<10> eval: my %hash; @hash{qw(key1 key2 key3)} = qw(one two three); \%hash
<11> avarab: Return: {'key2' => 'two','key1' => 'one','key3' => 'three'}
<3> however, it keeps returning objects blessed as Bit::Vector, rather than my child cl***
<1> japhy, they can't ? :(
<10> This is very useful for turning a positional argument list into a hash
<5> fsweetser: Have a sub new, then call SUPER::new, and tidy everything up before you return
<12> ProN00b: yep. I've been looking through it just now.
<2> THanks tybalt89, I knew i was simple but i've not needed to do it for so long (c:
<9> janhaa: no, because precisely what you said. when the child dies, it closes the connection.
<8> BinGOs, also it uses that special code only on perl versions < 5.008, what does that mean, is it fixed on windows versions above that ?
<9> at least, I've never been able to make it work. ever.
<10> eval: my %hash; @hash{qw(sec min hour mday mon year wday yday isdst)} = localtime; \%hash
<11> avarab: Return: {'wday' => 1,'hour' => 8,'min' => 22,'isdst' => 1,'sec' => 31,'mon' => 4,'yday' => 134,'mday' => 15,'year' => 106}
<12> ProN00b: you would probably have to ask dngor for more detail.
<3> b0at: simply calling a base SUPER::new gives function not found; can you give me an example?
<6> fsweetser, my $cl*** = shift; $cl***->SUPER::new(@_); # perldoc perlboot. although if Bit::Vector::new was properly coded it'd bless the object into your child cl*** anyway
<7> perlboot - Perl OO tutorial for beginners. To access this perldoc please type, at a command line, 'perldoc perlboot'. You may also find it at http://perldoc.perl.org/perlboot.html
<3> okay, lemme give that a try
<13> I'm trying to remove some headers and footers from html pages on a server of mine. Strangely, they were added before <html> and after </html> :-). Anyway, I undef $/ and slurp the file into $contents.
<13> print $contents returns the expected file
<13> but
<13> $contents =~ /(.*)\<html\>/;
<14> "BinGOs" at 66.180.175.30 pasted "Non-blocking mode socket for Win32 ( from POE::Wheel::SocketFactory )" (61 lines) at http://erxz.com/pb/1253
<13> matches
<15> whats the proper way to capture this:
<13> but there is nothing in $1?
<16> This crapulator is going to take a lot of work to learn. It is jammed packed with crap.
<15> $s =~ /^$muser:(.*)$/ -> should be like, $s =~ /^$muser:(.*):.*$/
<3> wolverian: no joy - $cl***->SUPER returns an instance of Bit::Vector still, not my child cl***
<17> I have a bunch of files with names like I01.gif, I02.jpeg, I237.gif, etc, numbered from 01 to 684 with different extensions, and I need to find holes in the sequence
<17> I tried this, which should print the missing numbers (68 and 237)... but it also prints every even number up to 236, and then every odd number:
<17> perl -e 'for (1..684) { print "$_\n" unless -e glob (sprintf "I%02d.*", $_) }'
<15> i need to use a lookahead, as there may or may not be a second : in my string
<17> why is that?
<5> whizzer: You don't have to escape < and >. Split on </?html> and ensure that there are three scalars returned with the things you think should be there. And try not to parse HTML with regex.
<13> b0at: heh
<13> yeah.
<13> i just wanted to get everything before and after those tags. I had no intention of doing anything more complicated with html+regex
<5> Then splitting is all you need, anyway
<13> b0at: i'll try splitting
<13> b0at: thank you sir
<5> eval: join"|",split qr{</?html>},"foo <html> bar </html> baz"
<11> b0at: Return: foo | bar | baz
<13> b0at: then I will have to replace the </?html> tags when I'm done, right?
<5> eval: join"|",split qr{</?html>},"foo <html> bar </html> baz"
<11> b0at: Return: foo | bar | baz
<5> 9oops
<5> I meant to add parentheses around the pattern, which means it's returned in the results
<17> a simpler test case:
<17> touch 01 02 03 04 05 06 08 09 10
<17> perl -e 'for (1..10) { print "$_\n" unless -e glob (sprintf "%02d*", $_) }'
<17> that prints 2 4 6 7 9, while it should print just 7
<5> But yes
<17> can anybody test it?
<15> anyone know how to find $1 in a string that may be either a:b or a:b:c?
<15> (where $1 should be b)
<15> ive got it so i can match either the first or the second, but i cant figure out how to do both
<17> it seems that's glob that's causing the problem, since this prints just 7 as expected:
<17> perl -e 'for (1..10) { print "$_\n" unless -e sprintf "%02d", $_ }'
<5> _sho_: /foo:bar(:baz)?/ ?



<3> _sho_: (split(/:/))[1] ?
<17> however, I need to use glob
<15> so just move the : into the group?
<5> If it's optional...
<15> $s =~ /^$muser:(.*)(:.*)$/ <- doesnt quite do it
<5> It helps if you follow the example.
<5> Just split on :
<15> yeah, i thought about that. i really want to do it with a straight regex so i know how to do it in the future though
<15> thats why i asked about lookaheads :)
<17> silly me... I 'm calling glob in scalar context
<18> what's a quick way to get character and line count of a file within perl?
<19> `wc file`
<17> how do I check if an array returned by a function is empty?
<19> #$array==0?
<20> if(@array)
<19> err $#array==0?
<19> no
<17> without using a temporary variable, if possible
<12> no.
<20> it would be $#array==-1 anyways
<19> hmm what is $#array if the array is empty, -1?
<18> if(@array == 0)
<20> if(@array)
<12> unless(@array)
<17> there is no @array
<17> just a call to glob
<17> and if I force it into scalar context, it does a different thing
<17> so, no "unless glob" or such
<17> I could ***ign the result of glob to an array variable, but what if I want to make everything a single expression and not a block? is it possible?
<15> sigh
<15> i cant get this lookahead to work right
<15> maybe i just dunno how to read perlretut
<3> okay, Bit::Vector still isn't playing nice... if I'm trying to inherit Bit::Vector, and I overload new() and call $cl***->SUPER::new() from within in my child cl***, should that return an instance of the parent or child cl***?
<15> /$muser:(.*)(?:.*)$/ still sticks everything in $1
<21> fsweetser: It "should" return a reference to the child cl***, but if it doesn't (which is not that unlikely), you can rebless the reference.
<5> _sho_: Because * is greedy by default.
<5> But why don't you use what you know and just match [^:]*?
<17> is there a builtin function that will return the number of items in an array, interpreting its argument in array context?
<3> notwoggle: how would I do that? simply calling bless on the return errors out for me
<21> "errors" how?
<5> Teolupus: I think you mean list context, but still the question doesn't make sense.
<5> oops
<5> teh_LaC: ^ that was for you.
<3> notwoggle: errors out with 'Modification of a read-only value attempted at PPMask.pm line 23.' where 23 is where I call bless
<15> b0at, thats a stupid idea. thast like saying, why bother trying to learn or grow as an individual, just be happy where you are now
<17> b0at: 1) I need to call glob in list context, not scalar context; 2) I need to check if the list it returns is empty; 3) I want to do it in a single expression
<5> _sho_: Now you're being both dense an insulting. If your example wasn't representative of your problem, then don't use it and then tell us we're wrong.
<17> b0at: what do you suggest?
<5> teh_LaC: my ($foo) = glob(@args); gets it in list context
<17> b0at: so you're saying that it's impossible to do it in an expression? you have to use a full statement?
<22> hi
<5> One dirty way to feed a scalar context that value could be @{[...]}[0]
<23> I've a cl*** with a property called $_FILE -> undef, and a method which opens open($self->{_LOG} tha file, using _LOG as a filehandler. When I try "print $self->{_LOG}" I got "String found where operator expected". Could you help me pls? I'm new to perl, but experienced with C... To me this seems a pointer reference problem, but I don't know exacttly how should be done in perl.
<5> But there's bound to be something nicer
<17> I see... and I don't really want the value of the first item, I want the count of items
<5> use grep
<20> unless(@{ glob ... }) ? does unless(glob()) not work?
<4> print {$self->{_LOG}} ...;
<17> b0at: checking the docs now...
<17> pravus: no, unless(glob()) still calls glob in scalar context apparently
<23> tybalt89: It works now! Thank you...
<23> tybalt89: Could you explain me what we've done here?
<20> teh_LaC: what about unless(@{ glob }) ...
<18> what's the perl analog to bash for i in dir/*.foo; do ...?
<5> for my $file (<dir/*.foo>) { ... } is one way
<24> is glob("dir/*.foo") exactly the same ?
<17> pravus: still no go:
<17> perl -e 'for (1..10) { print "$_ " unless (@{glob (sprintf "%02d*", $_)}) }'
<17> 1 2 3 4 5 6 7 8 9 10
<24> unlink, you can use readdir and opendir function, it is better
<24> (the doc says "more secure")
<17> I don't see how I can use grep to count the items in a list, either :/
<15> i dont even see how lookaheads will work conditionally


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #perl
or
Go to some related logs:

#oe
gamserver fedora
index of / email_list
ubuntu install from dos
dapper proftpd connection refused
kdebase-meta unmerge
undefined symbol: cairo_xlib_surface_create_for_bitmap
#suse
#mysql
what use port 80 ubuntu



Home  |  disclaimer  |  contact  |  submit quotes