| |
| |
| |
|
Page: 1 2 3 4 5 6
Comments:
<0> yeah. Namespaces? who needs em. GOTO? MUST HAVE! <1> heh <1> I think they'll have namespaces in PHP6 <0> goto is the epitomy of spaghetti code <2> Shadda goto _is_ useful if used correctly <2> however, knowing _when_ to use goto needs a lot of experience <3> when i do rand(5); i get something like: 4.2684... how do i get it as an integer? i mean 4 at this time <4> Shadda: don't exaggerate. when you have the choice and you can use it only slightly, it can be useful. <5> Shadda: so they are going the "lets ignore all the mistakes people have made and repeat them all"? :) <0> ofer0, I'm talking to the devs right now...Derick himself said php had no use for namespaces <6> fgxi: int(rand 5) <7> My favorite PHP ``feature'': all functions have global scope. *all*. Even ones defined inside other functions. Even ones created via create_function <1> goto is good for one thing: "Just another Perl hacker," in a very obfucscated way <7> Shadda: PHP doesn't. Only competent developers use namespaces. PHP has no competent developers. <1> Maybe Larry created it for this purpose. <4> Hanji: ie, lack of lexical binding
<7> (users, that is. It's possible its maintainers are competent and just very, very, tragically, confused) <6> ofer0: Don't forget goto's usefulness in AUTOLOAD <2> heh <8> is anyone using Cl***::DBI with PostgreSQL under mod_perl? <5> revdiablo: but that is a completely goto <0> Hanji, bit arrogant to choose one language over all others. I never thought of programming as a religious debate, I guess <3> thnx <7> Shadda: I don't pick one language over all others <9> Shadda: I don't think you should choose any one language, I just think you shouldn't choose PHP in most cases <1> Shadda, So you probably won't consider yourself as a geek, do you? <6> Khisanth: Hey, I didn't name it <0> I do perl, php, python, C, C# (now), plus a plethora of those pesky little client side languages <7> Shadda: I am very much a believed in using the right tool for the right job <7> However, I feel that PHP is *never*, or damn near almost never, the right tool, for any job. <4> Hanji: yeah, it's just that it's always perl <1> Hanji, we are just arguing what is the right tool in most cases. <0> wtf am I doing..arguing over language preference in #perl :D <4> hehehehe ;p <0> ok, I'm gonna go do something constructive <9> if you really need a reason to not use PHP just read this from time to time: http://www.php.net/ChangeLog-4.php#4.4.2 <9> notice all the security fixes <6> Shadda: Who's arguing? I thought we were dancing! <10> how can i read from a file? <1> arubin, heh :) <6> cyberwarrior: perldoc perlopentut <11> The perldoc for perlopentut - Perl open() tutorial is at http://perldoc.perl.org/perlopentut.html <10> open(READ,filename.txt); <1> cyberwarrior, open( R, 'filename' ); while ( my $line = <R> ) { something with $line? } <9> cyberwarrior: I suggest starting from the beginning, 'filename.txt' should be a string literal <1> don't forget to close() the file descriptor after you finish <10> i wanna read the first line from a file and print it to the screen <12> hi, does it exist "interface" in perl oo like the java interfaces ? <13> how do you write to stdin of a command and read from its stdout using the same file handle and no temporary files? <10> so open(READ,filename.txt); print "" <6> ofer0: I like using lexical filehandles so they close themselves <5> J4nus: no <12> ok <6> cyberwarrior: No, you're missing important details. <1> revdiablo, yeah, it's probably better <5> J4nus: of course that is just an abstraction <12> so I have to use a abstract cl*** <12> with all the routines abstract <6> cyberwarrior: The filename needs to be quoted. You need to actually read from the filehandle before you can print any of it. <1> ofcourse you have to check if open() returned true. <13> it looks like it's possible to open "| command |" but I can't figure how to get input <5> no, you just have to not care :) <10> open(READ.something.txt) || die "message"; <1> When talking to the filesystem or the web, you should always check for the return value. for example: open() or die( "open() ( $! )" ); <12> I want to do a interace "INPUT_FLOW" (with open(), read(), close() and a interface "OUTPUT_FLOW" open(), write(), close() <9> cyberwarrior: again, your file name should be a string literal in this case <6> fredE: Nope <5> fredE: IPC::Open2 <6> fredE: You need to use IPC::Open2 for that. <14> cyberwarrior, use 'or' instead of || there <0> cyberwarrior, 'foo.txt' <12> because my program has a lots on inputs and outputs <1> sniz, he can use || if he wants.. <10> i am reading the opentut <12> so i can use the polymorphisme in my program.. <6> cyberwarrior: Are you paying attention to us or just trying random things? <1> sniz, it will work the same
<10> revdiablo, i am reading the opentut <6> ofer0: But || will be problematic if someone later removes the parentheses <14> || has higher precedence <1> sniz, it's not like $var = open() || die(); that way you should really use "or" <6> ofer0: It's safer to stick with 'or' <12> Khisanth: what do you advise me ? <5> revdiablo: if they do then they should know wtf they are doing! <1> revdiablo, yeah, you're right. <5> I get the feeling that giving you advice will give me a headache ... <6> Khisanth: 'If' and 'should' being the key words =) <6> At least we can try to get people to cargo cult in safer ways <10> open(READ,"<foo.txt") || die "Can't Open"; <5> revdiablo: better to have stuff blow up in their face if they are going to cargo cult <6> Khisanth: Except open || die doesn't blow up in their face <1> cyberwarrior, the "<" and the double quotes are unnecessary <10> but i want to print the content of the file to the screen <10> arubin, i am learning this from Learning PERL <9> cyberwarrior: it seems like you missed a few things <1> cyberwarrior, here's a little trick: print while ( <> ); <1> that's it. one-line program :) <1> It is almost simillar to the "cat" program in linux <5> revdiablo: then fix it so it does! :) <6> ofer0: perl -pe '' # Even shorter <6> =) <1> if you want it in a full format: while ( my $line = <ARGV> ) { print $line } <9> who thought it was a good idea to have two of each logical operator anyways? <15> perl -pe0 #WINNER <6> arubin: I think we know the answer to that <16> yo revchamuco, Botje, Khisanth <1> revdiablo, heh, nice trick:P <5> arubin: knowing that there will be three of each ... <6> Hey there amnesiac <15> hello amnesiac! <16> how's everything going on Saturday? <5> for string, numeric, logical :) <1> perl -MLWP::Simple -e 'getprint( "http://ilunix.org/myfiles/ip.php" ); print "\n"' <1> Try this :P <15> *switch <1> Botje, what does it do? <6> It adds a newline to your prints <1> oh yeah <1> I forgot <6> I pretty much automatically type perl -le for my oneliners <1> ofer@nettux:~$ perl -MLWP::Simple -l -e 'getprint( "http://ilunix.org/myfiles/ip.php" );' <1> 62.219.110.81ofer@nettux:~$ <1> well, it doesn't work here. <15> perl -MLWP::Simple -l -e 'print get("http://ilunix.org/myfiles/ip.php" );' <15> looks like getprint doesn't use print somehow >_< <1> yeap, probably <1> but we can still use it <1> perl -MLWP::Simple -le 'print get( "http://ilunix.org/myfiles/ip.php" );' <6> Actually, getprint specifically unsets $\ <6> Those sneaky devils <15> bastards. <8> is anyone using Cl***::DBI with PostgreSQL under mod_perl? <5> polls are usually useless :) <8> hmm...ok <8> I have a problem with Cl***::DBI and PostgreSQL. It seems to be a common one and I even found a solution, but I can't apply it. I'm such a loser. :) <8> Solution is described at: http://wiki.cl***-dbi.com/wiki/Using_with_mod_perl <10> do i need to add the path for the file? <10> i mean like /home/me/Perl/filename <1> what do you mean? <10> like <1> oh <1> yeah you can use <1> filename.bla <1> and /bla/bla/bla/../bla../../../bla/file.name <10> $file="pathtofile/file <10> ok <1> whatever you want <1> BWT
Return to
#perl or Go to some related
logs:
abe xnor
#linux kubuntu dapper missing eth0 #openssh #gaim #python #linux #css printer-service-error, red hat
#linux
|
|