The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Writing to attributes from perl scripts

Contributed by: Michael Schomer
This tip is valid for: Both BeOS and Haiku

If you’re running a BeOS web server other than PoorMan (i.e., one that does CGI) and want to be able to extract attributes from BFS files, see the TrackerBase page on this site. What that page doesn’t tell you is how to create attributes from your perl scripts.

Once you’ve got Tom Spindler’s Be::Attribute perl module installed, use the syntax:

Be::Attribute::WriteAttr(node, attr, what, type, howbig);

For example, if you want to change the attribute of a certain email file called “emailfilename,” your script might look something like this:

 use Be::Attribute; $MailNode = Be::Attribute::GetBNode("/boot/home/mail/in/emailfilename"); Be::Attribute::WriteAttr($MailNode, "MAIL:status", "New", "String", "50"); 

Posted in Scripting


(comments are closed).