| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Comments:
<0> dammit you beat me to it <1> I'm actually just having a diet coke. <1> If you had a real v8 you would win. <2> Or if you drove a VW. <1> I drive a v4. <3> s/it/it's/ <4> ok, still no go <4> my $blessed = bless($self, $cl***); <4> $self->{'Commands'}->{'help'} = { '-information' => "Show help information.", '-function' => $self->printHelp }; <4> whats wrong with that? <5> looks ok <6> __Ace__: because $blessed is the object, not $self <4> -function point to ""
<4> ah <5> not sure if it will DWYM <4> nope it doesnt <2> It does, however, DWYTIT. <5> my $self = bless( {}, $cl*** ); <5> __Ace__: maybe you should create an accessor for $self->{'Commands'}->{'help'} <4> yea, just wanna create some "Core" commands.. which are there when creating the object with new <2> Yes, use huge modules to replace three lines of code you should know how to write. <7> __Ace__, uh... why the huge datastructure? why do you need a subref? <4> else I can always have another method like initCoreCommands, that would make it work <4> but I thought it would be nice to do it in the constructor <4> because the subref is called later <8> eh? <4> well, the sub that is <9> hobbs: that's cool and all, but I think I'm going to switch to emacs for now ;) <4> like in the pasted example <5> emacs-- <4> with "help" <1> woo yeah go hachi ! <4> its supposed to call printHelp within the modul <4> e <8> sub new { my $cl*** = shift; my $self = {}; bless($self, $cl***); $self->init(); return $self; } <5> perlbot: xy problem <10> They ask how to do X, but that's because they really want to do Y but think X will get them there and most of the time they are WRONG <0> hachi: heathen! <2> perlbot, status <5> __Ace__: what is Y? <2> perlbot, why do you have such a crappy name? <7> __Ace__, and why can't you use: my $obj = new MyCl***; $obj->printHelp; <5> Are you trying to add methods to the object at its creation time? <5> perlbot: emacs <10> see: vim <5> YES <8> perlbot: vim <10> http://vi-improved.org or http://mamchenkov.net/wordpress/2004/05/10/vim-for-perl-developers/ <8> heh <8> ooh, vim for perl devs :D <4> because the module is supposed to be a shell module. when you create this module you can add your own commands. and with that you add a ref to the sub u wanna have called when doing the command <5> w00t <8> __Ace__: see the sub i said earlier <1> __Ace__: why not subcl*** it then? <5> __Ace__: you're going to also take the name of the sub then ***ign it into the packages namespace <5> if you want to be able to call it like $self->printHelp <4> subcl*** means another cl***.. Im gonna use this from a perlscript.. <4> not a module that is :) <1> I'm just asking if there's a reason to *not* write a subcl*** <1> you may well have a good reason. I'm just curious. <4> ah <4> like: my $shell = new Shell(('search' => '-function' => \&doSearch, ...)); :) <4> $shell->startup(); <4> and then I can type search, and the sub I have defined there is called <5> __Ace__: that's doable. not sure if it's a great idea but it's doable <4> I think its rather cool.. but sure.. maybe there are better ways.. <4> actually: Shell->new(...); but anyway.. <4> :) <5> you'd need to do: *{"Shell::search"} = \&doSearch at some point, in a more variablecentric way <2> Use goto! <8> ew goto
<5> my $shell = new Shell( 'search' => { '-function' => \&doSearch } ); <11> use comefrom! <2> No, not ew. This is what it's for. <2> goto &foo, not goto FOO. <4> bennymack: ah, yea, thats what I meant :) <4> gotta love perl for the ease of these things ;) <4> hash and arrays are so powerfull really :) <5> for( my( $key, $val ) each %args ) { *{"Shell::$key"} = $val->{'-function'} } <5> or similar <11> HELLO MASQUE <2> Aloha, Yaakov. <11> Hello, dngor. <11> I seek lightheartedness. <12> HELLO YACKOFF <2> We need ignatz. <13> Indeed. <11> But real lightheartedness. <11> I mean, an actually lightening of the heart. <3> <11> use comefrom! -- Yelling "comesfrom" Yaakov <14> y0. I've been at work all day doing emergency software repairs on a machine with a flaky drive. My heart's not very light right now. <11> Unburdening... <11> Hello, tybalt89. <3> hi Yaakov <12> dngor: Rape them lal. <11> dngor: I can imagine that would be the case. <14> buu volunteers to be first! rock on! <11> Do you get "comp time"? <12> dngor: Can't rape the willing! <15> is there a linked list module somewhere or should in just write my own? <11> stuuf: search.cpan.org <12> stuuf: Good lord, why/ <14> I'll ask. <12> stuuf: Do you need one. <15> i want constant time removal in the middle of a list <13> . o ( "in constant time" ) <12> I think splice is fairly small actually <11> Hello, buu. <16> just use a hash <17> just do car/cdr stuff with a list, by hand <13> Why pray tell do you need constant-time removal? <11> Linked lists have applications, but I am not sure this is one of them. <15> the splice documentation doesn't seem to mention anything about complexity <13> Considering we don't know what the application *is*, that's a fair cop. <11> stuuf: Have you benchmarked splice and found it unacceptable? <3> <15> i want constant time removal in the middle of a list -- but do you *need* it? <16> there's an idea. <11> stuuf: Many times it turns out that what is there is good enough. <11> stuuf: but search.cpan.org would know if there is a module. <13> Premature optimization is the root of all evil. <11> s/all/some/ <0> I expect splice is O(n). But the constant on that is so small you should almost never care ;) <11> Hello, hobbs. <11> And of course, Hello, DrForr. <15> hmm <12> hobbs: I suspect hobbs is like o n/2 or something weird <3> semi-premature optimization is the square root of all evil. <11> s/all/some/ <0> buu: that's the same as N ;) <12> hobbs: =[ <13> And of course, premature ejaculat...oh. <15> does splicing things out in a foreach loop mess up the loop counter? <12> Probably <0> stuuf: it does Very Bad Things <12> hrm <12> eval: @x=0..10; splice (0,1),print $_; <18> buu: Error: Type of arg 1 to splice must be array (not constant item) at (eval 157) line 15, near "1)" <11> stuuf: how big is your list? <15> i want to iterate over a list of things, and possibly destroy some of them in the middle of the loop <17> so do a for (my $ctr...), and then decrement $ctr whenever you remove? <12> eval: @x=0..10; splice (@x,0,1),print $_ for @x; <18> buu: 0 2 4 6 8 10 <3> stuuf: then you want grep()
Return to
#perl or Go to some related
logs:
#web windows netwok cap
gentoo getting rid of kde-env #bash +sparc +ultra 5 +GUI +ubuntu the sum of 2 irrational numbers is irrational proof
linux pismo TAU module gstreamer package faad kubuntu #openssh #css
|
|