[rt-users] Custom Conditions
Andy Harrison
ah30 at harrisonfamily.com
Fri Mar 5 08:33:39 EST 2004
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Fri, 05 Mar 2004 13:22:51 +0000, Matthew Cheale wrote
Subject: "Re: [rt-users] Custom Conditions"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> The trouble being that without a definitive list of objects and their
> methods it makes it tricky to use...
That's putting it mildly. :)
Here's a trick I got from one of the saints.
I was using it in a template to see what was available.
Template Content:
{
require '/tmp/Symbol/Methods.pm';
print "::::\n";
foreach ( Symbol::Methods::probesym( ref $Ticket ) ) { print; print "\n"; }
print "::::\n";
}
Then you could do: my $Transactions = $Ticket->Transactions and ref
$Transactions to see the next level.
# cat /tmp/Symbol/Methods.pm
package Symbol::Methods;
sub probesym {
my $pkg = shift || 'main';
my $seen = shift || { };
my @subs;
foreach my $class ( @{ $pkg . '::ISA' } ) {
push @subs, probesym($class, $seen)
unless $seen{$class}++;
}
push @subs,
grep UNIVERSAL::can( $pkg, $_ ),
values %{ $pkg . '::' };
@subs;
}
1;
--
Andy Harrison
(full headers for details)
More information about the rt-users
mailing list