[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [OSSTEST] ms-planner: add a flight summary html report
On Wed, 2014-04-30 at 17:21 +0100, Ian Jackson wrote: > Ian Campbell writes ("Re: [OSSTEST] ms-planner: add a flight summary html > report"): > > On Wed, 2014-04-30 at 16:44 +0100, Ian Jackson wrote: > > > This is rather a layering violation. Info is for the consumption of > > > humans. Perhaps the plan should have an explicit "flight.job" field. > > > > I was a bit more scared of touching the actual planner daemon... But ok. > > I think you can safely add new fields to the events, although the > existing planner daemon probably won't propagate them. "probably", fantastic ;-) > > > > + foreach my $job (sort { $inf->{Jobs}{$a}->{Start}->{Time} cmp > > > > $\ > > > inf->{Jobs}{$b}->{Start}->{Time} } keys %{ $inf->{Jobs} }) { > > > > > > You repeat the $inf->{Jobs}{$x}->{Start}->{Time} expression. Make it > > > an anonymous subref or something and this will become much clearer. > > > > You mean like: > > my $ta = sub { return $inf->{Jobs}{$a}->.... } > > my $tb = sub { return $inf->{Jobs}{$b}->.... } > > foreach ... (sort { $ta() cmp $tb() } keys ... ) { > > > > Or my $to = sub($) { my $it=shift; return $info-{Jobs}{$it}... } and > > $to($a) ? > > The latter. (Or a http://en.wikipedia.org/wiki/Schwartzian_transform > but that seems overkill.) Clever. But yes perhaps overkill... > Hrm, it turns out that some time in the last decade it became possible > to write local lexical subroutines that aren't coderefs. So try > sub sortkey { ... } > just before the sort. foreach my $foo(sub sortkey{} sort (keys %hash)) {} ? I don't think that can be what you meant. > > > How about > > > foreach my $se (qw(Start End)) { > > > ? > > > > OK. I never would have come up with that myself. > > Learn Common Lisp :-). Now I have two problems. ;-) Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |