[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] session dump
On Sun, Apr 01, 2001 at 03:02:31PM -0700, johny brabo wrote:
> Some time ago I got a perl file from
> Christopher F. Miller that should dump my session
> and show much of my data structure.
> http://developer.akopia.com/archive/interchange-users/2001/msg01215.html
>
> I am now working on this, but I can't get this to
> work.
> using it as an interchange page doesn't work nor does
> running it as a standalone perl script.
> What should I do?
>
> thanks.
It's not going to do anything as standalone.
I attached another version below sig. It's probably the ref().
Something about perl5.6 and ref() is catching my old
bad habits probably. Works for us.
cfm
>
> the code:
>
> #!/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]
>
--
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
[tag op=header]
Content-Type: text/plain
[/tag]
[embed]
{
my @OUT;
my @foo = ["Vend::",''];
my $what;
my $i =0;
my $test;
while($what = shift @foo) {
$test = $what->[0];
unless($what->[0] =~ /->/ || $what->[0] !~ /::$/) {
foreach (sort keys %{eval "*$what->[0]"}) {
unshift @foo, ["$what->[0]$_",$what->[1].' '];
}
}
$what->[0] =~ s/::$//;
my $x = eval "\$$what->[0]";
push @OUT, qq`$what->[1]$what->[0] - ${\(eval "\$$what->[0]")}\n`;
my $ref = ref $x;
if($ref && $x =~ /\AHASH/) {
foreach (sort keys %{$x}) {
unshift @foo, ["$what->[0]\->{'$_'}","$what->[1] "];
}
next;
}
if($ref =~ /ARRAY/) {
for (my $i = 0; $i < @{$x}; $i++) {
unshift @foo, ["$what->[0]\->[$i]","$what->[1] "];
}
next;
}
}
# foreach (@OUT) {
#return $_;
# $_ =~ s/(.)/sprintf("&%03d;", ord($1))/ge;
#}
return join '', @OUT;
}
[/embed]
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users