Yes, that solves the problem. I'll post the original code on the pdl-porters list now, because it's Cholesky factorization code that I'd like to contribute to PDL. The niceslice syntax considerably improves the readability over the previous string-based slice syntax.
Thanks, Steve -----Original Message----- From: Craig DeForest [mailto:[EMAIL PROTECTED] Sent: Thursday, November 29, 2007 10:38 AM To: Steve Chapel Cc: Craig DeForest; 'Jarle Brinchmann'; [email protected] Subject: Re: [Perldl] Can't call method "nslice" on unblessed reference Nah, no need to post the original, I think. I believe the problem is that you're using the null-method syntax to call your sub ref. The "$subref-> (@args)" syntax is standard Perl but gets overloaded by NiceSlice -- constructs of that form get changed to "$subref->nslice(@args)" by a source filter. If you change your sub call to "&{$s}($x)" I believe it will work better. On Nov 29, 2007, at 8:27 AM, Steve Chapel wrote: > Sigh. This is the problem with reduced testcases. When I post them, > I get > asked "why did you write the code like that"? In my original code, > I define > a subroutine and call it just in the code I show. When I do not use > slices, > I do not get an error and get the expected results. When I do use > slices, I > do get the error. I reduced the code to the testcase I posted. > > I suppose I could post the original code. > > Steve > > > -----Original Message----- > From: Jarle Brinchmann [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 29, 2007 9:46 AM > To: Steve Chapel > Cc: [email protected] > Subject: Re: [Perldl] Can't call method "nslice" on unblessed > reference > > Hi Steve > >> my $s = sub { 1; }; >> my $x = sum($a->slice("0:0,1")); >> $s->($x); > > It isn't clear to me what you intend to do here - $s is reference to a > subroutine so -> cannot act on this (which is why you get the error). > What is the intention with the code? > > Cheers, > Jarle. > > > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
