[ic] perl code overview?

cfm@maine.com cfm@maine.com
Tue, 6 Feb 2001 10:34:46 -0500


On Tue, Feb 06, 2001 at 06:40:45AM -0800, johny brabo wrote:
> Hello all,
> 
> I'm starting to think it would be best for me to
> struggle myself troughout interchanges perl code.
> 
> Do you have an overview of the program's structure,
> because at the moment it's like a monolitic block to
> me.

Start with Interpolate.pm and work out from there.  You'll
get into Data.pm and Util.pm right away and other modules
as you need to.  Don't start with bin/minivend or it will
likely make no sense.

I've attached something that will dump your session and show
much of the data structure.

-- 

Christopher F. Miller, Publisher                             cfm@maine.com
MaineStreet Communications, Inc         208 Portland Road, Gray, ME  04039
1.207.657.5078                                       http://www.maine.com/
Content management, electronic commerce, internet integration, Debian linux


#!/usr/bin/perl
# sessiondump.html
# rev 2000-12-21, cfm for perl 5.6 ref
[tag op=header]
Content-Type: text/plain
[/tag]
[realperl]
{
    my(@OUT,@foo,$i,$test,$what);	
    @foo=["Vend::",''];
    $i=0;
    while($what = shift @foo) {
	my($x);
	$test = $what->[0];
	unless($what->[0] =~ /->/ || $what->[0] !~ /::$/) {
	    for (sort keys %{eval "*$what->[0]"}) {
		unshift @foo, ["$what->[0]$_",$what->[1].'	'];
	    }	
	}
	$what->[0]=~s/::$//;
	$x=eval "\$$what->[0]";
	push @OUT, qq`$what->[1]$what->[0] - ${\(eval "\$$what->[0]")}\n`;
	
	if(ref($x) eq "HASH") {
	    for(sort keys %{$x}) {
		unshift @foo, ["$what->[0]\->{'$_'}","$what->[1]	"];
	    }
	    next;
	}
	if(ref($x) eq "ARRAY") {
	    for(my $i = 0; $i < @{$x}; $i++) {
		unshift @foo, ["$what->[0]\->[$i]","$what->[1]	"];
	    }
	    next;
	}
    }
    return join '',@OUT;
}
[/realperl]