@# 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



Comments:

<0> http://rafb.net/paste/results/EH9RXE21.html anyone know why Test::More is being run even when i dont run my script with the selftest arg ?
<1> The paste EH9RXE21 has been moved to: http://erxz.com/pb/731
<2> how do i negate this
<2> if ($resouce=~/icons/
<2> != doesnt work :(
<3> perldoc perlop
<1> The perldoc for perlop - Perl operators and precedence is at http://perldoc.perl.org/perlop.html
<3> look up =~
<2> perldoc all stuff sarkie really should know
<3> hm?
<3> you most certainly should not - hence you look it up when needed
<2> well that worked
<2> i daren't use strict; too many errors
<2> ha
<3> then i dare not help you with your code any more. too many pit falls.
<2> nah im doing it now :P



<2> Useless use of hash element in void context at OS.pl line 9. -> testlise{0};
<0> heh
<2> Global symbol "$minutes" requires explicit package name at OS.pl line 35.
<2> i have about a 100 of these
<2> is it because im using Globabl Variables :)
<4> triplah: still here?
<4> triplah: use Test::More is a compile-time directive.
<4> triplah: you should use require and import instead.
<0> rindolf: ok thanks :D
<5> (good afternoon|goede middag)
<6> fleh
<7> "JYDawg" at 161.85.127.153 pasted "Building a return hash according to function arguments" (20 lines, 476B) at http://sial.org/pbot/16243
<5> anybody know how to get this to work (see paste)?
<8> Why do homework ***ignments have to be so useless?
<7> "Sarkie" at 80.4.224.6 pasted "Accessing different parts of list" (27 lines, 970B) at http://sial.org/pbot/16244
<2> If they weren't they'd get paid for teaching them
<5> Yaakov it's the lesson
<8> JYDawg: It is much too abstract.
<2> Can someone show me how to output the different parts of the list
<8> JYDawg: Perl is a PRACTICAL language, ***ignments should be PRACTICAL problems.
<8> Stuff like that is WRONG.
<5> Yaakov: well, besides you opinion, it damp handy, when e.g. returning database queries
<5> s/damp/damn/
<2> anyone?
<5> in the end I just want the results in a way I can use, not re-masage it again when I should be able to dao that from the get-go
<8> JYDawg: In perl, we use DBI which does all of that for you.
<8> JYDawg: In an advanced perl course, more abstraction may be sensible, but if you don't know how to do THAT, you aren't ready for advanced perl. Anyway, good luck with the ***ignment, there are a lot of printed references that can help.
<9> mmm DBI
<8> JYDawg: I think The Perl Cookbook might be instructive.
<8> JYDawg: By the way, if you have a more pointed question concerning a putative solution, I might be able to help.
<8> OK! Back later...
<5> so nobody has a clue ...
<10> hmm... anyone who have seen examples on how to use fork/thread in perl ?
<10> what i need to do is to fire up a couple of childs and then sit and wait until they are done with its work and then continue execution in the main script
<11> why would i be getting ^M 's written into my file, when i do print FileToWriteTo "a " . $number . " b " . $number . "c\n";
<11> giving me
<12> Apachez: It works like in C, mostly. Are you familiar with that?
<11> a 1^M b 1^M c
<12> tamp4x: What OS are you using?
<11> linux
<12> Oh, your $number has the ^M on it.
<2> use SVG::Template::Graph; If i want to use this package how do i install it in cpan?
<11> is it because i did a chop, how can i remove the ^M
<11> i think someone copy and pasted it from an excel file
<10> Roderick depends...
<10> but should i use the fork or the threads implementation in perl 5.8 ?
<10> i have heard ppl claiming that fork is faster and safer to use ?
<12> Oh, I see. Well, fork is certainly a safe choice, if you don't need the extra abilities threads give you.
<10> all i need is the performance :P
<10> i dont need queue stuff and all that
<12> Well, if it's really important, the only thing to do is to benchmark it.
<10> just fire up say 10 childs, wait for them to complete and then go on...
<12> (Though usually it isn't really important.)
<12> Why does it need to be so fast?
<10> well not slow at least :P
<12> Unless you're doing something really unusual, either one will be fast enough. Use whichever you are most comfortable with.
<10> to day i run some sql queries in a loop which means if each query takes 3 seconds on a slow machine and there are 10 queries then the total time is 10x3seconds = 30 seconds
<10> i was hoping i could somehow easily fork/thread each query and wait for them to comlete and that way reducing the total time from 30 seconds to like 3-5 seconds
<10> the end result will run in apache and modperl
<10> so i guess i should start with the fork one ?
<12> Possibly. You'll also need to set up multiple database connections, so factor that in. Plus with some DBDs sharing a DBI across fork or even a thread can be problematic.



<10> yeah i know i need one connection per child
<10> and the result will be stored in a table on the database so im safe of the results between the childs and parent
<10> but i have failed to find examples on google how to use fork for example
<10> i dont need those advanced signaling back and forth...
<12> Yes, I'd suggest starting with the fork one, with mod_perl already in the mix I wouldn't want to complicate it with threads if I didn't have to.
<10> one method would be to write my child function in its own perlscript and then run system("perlscript.pl argvdata &");
<10> but that will make the "parent" to continue execution without waiting for the childs
<10> because my script will look in this resulttable on the db when it continues with execution
<10> and then it would be bad if not all childs has finished their work
<2> Ok I've used CPAN to install SVG but I would like to install this package SVG::Template::Graph; but it wont install it if i do install package name, any hints?
<12> for (1..$num_children) { my $pid = fork; if (!defined $pid) { die "can't fork: $!" } if (!$pid) { do_child_job(); exit(); } push @children, $pid } while (@children) { my $got = waitpid $_, 0; $got == $_ or die "waited for $pid, got $got"; }
<3> Sarkie: yes, correct the errors reported
<12> There might be a wrinkle about forking in mod_perl, and using exit(), though.
<3> or inform us of them
<12> s/while/for/
<10> tnx ill try that
<10> i ***ume i can have perl stuff instead of do_child_job() i mean it doesnt have to be a specific function call right ?
<12> Right, that was just a place holder.
<10> use Fork; or what do i need in the beginning of my script ?
<12> Nothing for what I wrote.
<10> ohhh
<10> thats sounds nice
<10> ill try that :)
<10> hopefully this will also work in activestate perl which i have on this windows box to test stuff :P
<12> I use Flying Crane Old School Core Style.
<12> Activestate does have fork() emulation (fork() is a Unix thing not present as such in Windows), but that's all I know.
<13> vfork or whatever it is called.
<10> anyway this should be fun :P
<12> Is Windows where it will be running eventually?
<10> nope unix
<13> milage will vary.
<10> err linux
<12> I'd suggest doing the development there as well, if you can.
<10> but i do the crashtestdummy tests on this windowsbox since it goes faster to write stuff and once the first "alpha" works i go on to the linuxbox
<10> i have only one linux box and thats in production :P
<12> You can run a second Apache for development, on a different port.
<10> its this cutie: http://www.tbg.nu/pics/tbgserver2.png
<10> earlier it spent its time in the kitchen for about 1-2 years http://www.tbg.nu/pics/tbgserver.png
<10> :P
<12> Apachez: Use CORE::exit rather than exit there. See http://modperlbook.org/html/ch10_02.html for more about forking in mod_perl.
<10> its modperl2
<10> so exit(0) should be safe i guess
<14> using perl is it possible to find out to which file a symlink points?
<15> kavelot: perldoc -f lstat <- i believe that does it
<1> The perldoc for lstat - is at http://perldoc.perl.org/functions/lstat.html
<14> cool, thanks
<12> I think you want readlink() rather than lstat().
<14> yeah! that worked
<14> thanks
<12> You're welcome.
<16> Remember of course that a symlink just contains text
<16> There's no guarantee it even points at any file at all
<10> Roderick: i have now implemented your code into mine
<10> and gets Waited for: , got: -1
<10> a print scalar(@children)."\n"; gives me 11 and not 10 as i expected
<12> The $pid should be $_. And you should be using strict, it would have caught that. But the real problem is the -1, it means either the fork emulation doesn't provide waitpid(), or that something else is waiting for the pids. The latter does make some sense, but you need to know if it's the former.
<10> hmm
<10> yup running strict
<12> Why didn't it choke on the $pid?
<10> and changed your $pid int _$ $got == $_ || &error("Waited for: ".$_.", got: ".$got);
<10> hang on i can extract this sample into a single textfile
<12> Ok.
<10> whats the syntax for that waitpid ?
<10> waitpid(var1, var2); ?
<17> perldoc -f waitpid
<1> The perldoc for waitpid - is at http://perldoc.perl.org/functions/waitpid.html
<17> READ.
<10> or should it be waitpid(var1),var2; ?
<10> i will :)
<10> now i got right scalar of @children
<10> i had done a my @children = (0); but i guess the correct is = ();
<17> yes ..
<4> Apachez: if you want to initialise an empty array then () is the right one.
<4> Apachez: if you do my(@children) it will also init @children to an empty array.


Name:

Comments:

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






Return to #perl
or
Go to some related logs:

#gentoo
Knoppix and Wireless Dell 1350 WLAN live
mysql 1064 42000 create sequence
atunnel ip
cdrecord-binary as root
drivver via
unrar unbuntu
#math
#perl
#proftpd



Home  |  disclaimer  |  contact  |  submit quotes