passing blessed thingies as parameters

Wilson, Andrew (Belfast) Andrew.Wilson at trw.com
Fri Dec 28 04:04:37 CST 2001


Hi Liyang

> -----Original Message-----
> From: Liyang Hu [mailto:liyang at nerv.cx]
> Sent: 27 December 2001 23:48
> To: Belfast Perl Mongers
> Subject: passing blessed thingies as parameters
> 
> 
> How? I'm not even sure what to look up for this. Say I wanted to do
> something like this:
> 
> 	use Mail::Audit;
> [0]	sub foo($)
> 	{
> 	    $ma = shift();
> 	    $ma->accept(...yada...);
> 	}
> 	$mail = new Mail::Audit;
> 	foo($mail);
> 
> perl barfs on the $ma = shift() line. Obviously sub foo doesn't even
> know what it was passed, so I don't think $ma->accept()'s going to
> work either.

Can you define barfs for us?  what error message does it give you?
That looks to me (at first glance) like it should work and I'm
not sure what problem you're seeing.

cheers

Andrew



More information about the Belfast-pm mailing list