Hi all,
Cant seam to find anything on the board already about this so thought Id make a new post.
Is there some way I can check that the user using my API passing in a reference to an object rather than the object itself;
for examlple I want to throw an error if they do this
$class1 = new Foo;
$class2 = new Bar;
$bar->alter_foo($class1);
but not when they do this..
$class1 = new Foo;
$class2 = new Bar;
$bar->alter_foo(&$class1);
The alter_foo function withing class Bar adds things into Foo object and returns true/false for success.
I know in perl you can do
if (! ref($blah) ) {
..do stuff
}
No biggie if I cant do it 🙂