:ATTR(:default<> problem

Discussion in 'Perl Misc' started by mmccaws2, Feb 26, 2007.

  1. mmccaws2

    mmccaws2 Guest

    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
    mmccaws2, Feb 26, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. NULL
    Replies:
    0
    Views:
    338
  2. Ben Giddings

    "attr" like functions

    Ben Giddings, Jun 26, 2004, in forum: Ruby
    Replies:
    2
    Views:
    81
    Lennon Day-Reynolds
    Jun 28, 2004
  3. T. Onoma

    Attr; and Moving Namespaces

    T. Onoma, Aug 23, 2004, in forum: Ruby
    Replies:
    5
    Views:
    85
    Pit Capitain
    Aug 25, 2004
  4. Sam Roberts
    Replies:
    3
    Views:
    140
    Sam Roberts
    Nov 14, 2004
  5. Jadeja Tripal
    Replies:
    5
    Views:
    173
    Ben Morrow
    Oct 8, 2004
Loading...

Share This Page