Tags:
create new tag
, view all tags

Question

Is there any way to get from a HASH() value to the actual value of some meta data in a plugin Perl module?

This code: my $status = $meta->get( 'FIELD', 'Status' );

Returns a string "HASH(0x...)" that is presumably a look-up into a metadata store.

Or maybe there is a better way to get form field data from a topic in a plugin? The documentation on access to metadata is a bit sketchy.

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Linux
Web server: Apache
Perl version: 5.8.6
Client OS: Windows XP SP2
Web Browser: Firefox
Categories: Plugins

-- TWikiGuest - 19 Sep 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

The result of that call is a hash containing the information for the field "status". This information has the following fields:

  • name - the name of the field
  • attributes - Any special attributes as declared in the form definition ("H" for hidden, etc)
  • title - How it's displayed, usually the same as name
  • value - the actual value of the field

So, if you need the value of a form field, what you need to do is:

my $field = $meta->get( 'FIELD', 'Status' );
my $status = $field->{value};

Each kind of META has its own structure. The best way to learn it is to see the topic txt file.

-- RafaelAlvarez - 19 Sep 2007

See docs at TWikiMetaData.

-- PeterThoeny - 26 Sep 2007

 
Change status to:
Topic revision: r4 - 2007-09-26 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.