#!/usr/bin/perl
#use Mooix::Thing;
use Mooix::CallStack;

run sub {
	my $this=shift;
	%_=@_;
	my $stop_boundry=$_{stop_boundry};

	my @stack;
	my $stack = Mooix::CallStack::get()->next;
	while ($stack) {
		if ($stack->boundry) {
			last if $stop_boundry;
			push @stack, "-" x 40;
		}
		if (length $stack->method) {
			push @indexes, $stack->index;
			push @stack, [$stack->index, $stack->basemethod];
		}
		$stack=$stack->next;
	}

	my %indextoobj;
	foreach my $obj ($this->deindex(@indexes)) {
		$indextoobj{shift @indexes}=$obj;
	}
	
	my @ret;
	foreach (@stack) {
		if (ref $_) {
			push @ret, ($indextoobj{$_->[0]} ?  $indextoobj{$_->[0]} : "???").
				"->".$_->[1];
		}
		else {
			push @ret, $_;
		}
	}
	return @ret;
}
