:ATTR(:default<> problem

M

mmccaws2

Hi

I'm learning to use Class::Std and I am trying to figure out the
Attributes options. I've successfullly used function statements
in :default<int(rand(5))>. but I was trying to insert a phrase
in :default<'phrase'>; that was generated and saved in a variable.
However it doesn't seem to work


package Site::Text;
use strict:
use Class::Std;
my @phrase_choices = qw( "Top of the Morn" "Gid-ay" "Hang in there"
"Keep Trucking");
my $phrase = $phrase_choices[int(rand($phrase_choices))];

%greeting_of:
ATTR:)init_arg<phrase>, :get<phrase>, :set<phrase>, :default<"$phrase">);

am I going to have to use START or BUILD or am I missing something in
the coding?

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,796
Messages
2,569,645
Members
45,362
Latest member
OrderTrimKetoBoost

Latest Threads

Top