Page 1 of 1

Macro Subroutine help.

Posted: 28 Jul 2011, 09:49
by kabayongtao
I'm having problem with with writing subroutines.

I want to get the output of time() in perl. From subroutine, I am able to return the value to the macros calling it, but I can't store the value into a variable.

Code: Select all

#this is working
sub working{
	return $timeSnapShot;
}

macro test{
	log @eval(working)
}
#output: 1311864408 

Code: Select all

#this is not working
sub notworking{
	$timeSnapShot= $time();       
	return $timeSnapShot;
}

macro test{
	log @eval(notworking)
}
#output: [macro] test error: error in 0: @eval(notworking) failed


In the mean time, I'll just use the predefined variable $.time in macros.

Re: Macro Subroutine help.

Posted: 22 Sep 2011, 08:39
by Mortimal

Code: Select all

$timeSnapShot= time();
no?