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

Channels


#perl

08 November 2007


Total 27 pages. You are browsing page 2/27.

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

00:52 <****> Josh43: no, it's perl code, not a string, :)
00:53 <****> i thought the () was for clarity?
00:53 <****> like my ($test) = 'blah'; is not list context.
00:54 <****> eval: sub f { wantarray } my ($test) = f(); $test # or is it?
00:54 <****> pravus: 1
00:54 <****> bpalmer: right?
00:54 <****> initself: see pravus's eval
00:55 <****> (he beat me to it, because I had to check to make sure that eval { } would work with wantarray :) )
00:56 <****> bpalmer: what about in my example above? is my analysis correct?
00:57 <****> initself: my ($test) = "blah"; is the same as my ($test) = ("blah")
00:57 <****> the parens on the lhs force the rhs to be in list context.
00:58 <****> meow
00:58 <****> great, that fixed it
00:58 <****> bpalmer: maybe I am abusing the phrase 'list context'.
00:58 <****> that's how my ($test,$test2) = ("blah", "squeak", "meow"); works
00:58 <****> thanks initself and everyone who helped
00:58 <****>ymd(); }" :)
00:59 <****>fetchrow_array) << $cluster is not going to store every element of the array within itself?
00:59 <****> Josh43: that's better, :)
00:59 <****> dkr: Thank you for your help :)
00:59 <****> initself: no. It's going to take the first element of the list and store it in $cluster
00:59 <****> $cluster is going to store the first thing returned and throw the rest away
00:59 <****> then throw away all the rest.
00:59 <****> context is determined by the left side of = not the right
00:59 <****> bpalmer: ok, then *that's* what I meant.
01:00 <****> initself: i got confused because I do only PHP were we do $item = db_result, then $item['id']
01:00 <****> ok. Then you phrased it badly; it's definitely list context, but the left-hand list is shorter than the right-hand list.
01:00 <****> fireangel: and I got confused because of the definition of 'list context'.
01:00 <****> bpalmer: excellent.
01:00 <****> works perfectly now, thanks again
01:00 <****> cool
01:01 <****> i wish i had actual work to do at my job
01:01 <****> im gonna go pee
01:01 * bpalmer wonders whether a fetchrow_dwim built on Contextual::Return is the answer to mankind's sins.
01:02 <****> bpalmer: no
01:04 <****> not for the faint at heart: http://havenworks.com/
01:04 <****> hmm
01:05 <****> initself: thank-you
01:05 <****> --help. I have added sub main::HELP_MESSAGE() {#my print out valid options code} to my code but it is never executed if an invalid option is entered. Can someone help me out. I am trying to figure it out from http://search.cpan.org/~nwclark/perl-5.8.8/lib/Getopt/Std.pm. Thanks
01:05 <****> iFatman's url is at http://xrl.us/9e69
01:06 <****> iFatman: are you using getopts?
01:06 <****> oh, wait
01:06 <****> iFatman: twat does your code look like?
01:06 <****> you're not going to get --help to work with that
01:07 <****> Getopt::Std
01:07 <****> getopt::long is what you want.
01:08 <****> maybe Getopt::Std is insane enough to let you specify '-:'
01:08 <****> you *can* do it with Getopt::Std...
01:08 <****> mauke: i think so
01:08 <****> then you can check ${"opt_-"} eq "help"
01:09 <****> Just use Getopt::Long. you won't need to trick it into doing what you want.
01:09 <****> I guess what i am after is for sub main::HELP_MESSAGE() to be called automatically if getopt detects an invalid option. I thought that is what it did (but i am a newbie so struggled to understnad a lot of the description on cpan)
01:10 <****> add Pod::Usage for good measure and you don't even have to write it twice.
01:10 <****> iFatman: getopt treats all options as valid, that's why I asked whether you used getopts
01:11 <****> mauke: but if i enter an invalid option that is not specified i get an error reported to screen, so it seems it can tell invalid options...
01:11 <****> iFatman: i typically do: getopts('a:b:c:def') or usage(); # usage() then exit()s
01:11 <****> really? hmm.
01:12 <****> pravus: not sure what usage means, looking it up on web now...
01:12 <****> getopt() should allow all options
01:12 <****> iFatman: that's my version of your HELP_MESSAGE()
01:12 <****> iFatman: doesn't happen here
01:12 <****> $ perl -MGetopt::Std -wle 'getopt("x")' -- -speng
01:12 <****> and why oh why did they name it getopts() instead of getopt() ?
01:12 <****> i would have thought getopt() would act more like the unistd getopt()
01:14 <****> trust is hard to come by in these times
01:18 <****> core: UNIVERSAL::HealthCare
01:18 <****> Daveman: Module UNIVERSAL::HealthCare does not appear to be in core. Perhaps capitalization matters or try using the 'cpan' command to search for it.
01:18 <****> heh, yeah... =[
01:18 <****> bravo pravus, that works. My new code is as follows: getopts($commandlineoptionlist, \%inputArgs_h) or HELP_MESSAGE(); If an incorrect option is entered, or if the command line--help is entered it executes the code in HELP_MESSAGE. thanks everyone
01:20 <****> iFatman: the fact that '--help' works is kind of a side effect. you really might want to look over Getopt::Long and see if that is a better fit.
01:20 <****> hello all, i know this is probably a simple question, but how do I execute an external script from perl and wait for it to finish?
01:20 <****> jimbojw: maybe system()? do you need to save the output from the command?
01:21 <****> um, not really - it may be nice in the future to do something with it
01:21 <****> but for now I'll be happy to synchronously kick off a call to an external script multiple times with different arguments
01:21 <****> and ignore the output
01:21 <****> start with system(), then
01:22 <****> thanks pravus - I think system() is what I require - if I want the output, I'll just append it to a log file as part of the command
01:23 <****> jimbojw: you can capture the output in perl using `` or qx// or open() with special parameters or ...
01:26 * CPAN upload: XML-Bare-0.23 by CODECHILD
01:38 <****> thanks again - l8r
01:40 <****>send("serverpass:someoper:somepassword"); ? i mean, is there any special irc-related command for this?
01:41 <****> perlbot: irc?
01:41 <****> fooing: read the RFC .. ?
01:42 <****> But I think you'll find it's an extension to the RFC and you'll need to read the docs for your particular server
01:42 <****> or when in doubt, sniff some traffic.
01:43 <****> hmm
01:43 <****> RFC does not help much
01:44 <****> fooing: /server is something your client does--it probably parses that out itself and maps it to the appropriate commands
01:45 <****> fooing: look at the OPER and PASS commands in RFC1459
01:46 <****>]]
01:47 <****> fooing: Though perhaps you should look for a module (POE::Component::IRC comes to mind) instead of implementing the protocol yourself.
01:50 <****> jagerman, i know about POE
01:51 <****> but the question is how do i send the extra data to the server, the string i told before
01:51 <****> With POE?
01:51 <****> with or without
01:52 <****> fooing: PoCo-IRC has an oper() command
01:52 <****> fooing: otherwise, you follow the protocol spec
01:53 <****> pravus: oper() command == /oper user pass you mean?
01:53 <****> fooing: basically. /oper is a client command that should map to the OPER protocol command
01:54 <****> PoCo-IRC's oper() will send the OPER command for you


Total 27 pages. You are browsing page 2/27.

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


Tutti i nuovi CAP Italiani. Come ottenere il database completo