• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

This is needed to make use of the Plugin work area TWiki::Func::getWorkArea.

At the same time, move TWiki::Func::getWorkArea to section "Functions: File I/O"

-- PTh

On the first; no it isn't. All you need to read/write a file is well documented in the Camel book, man perlio and google perl open:

open(F, '<', TWiki::Func::getWorkArea().'/myfile.dat') || handle error;
local $/ = undef;
my $contents = <F>;
close(F);
and to write a file
open(F, '>', TWiki::Func::getWorkArea()."/myfile.dat") || handle error;
print F $contents;
close(F);
This is standard, basic perl and everyone needs to speak at least this much perl to write a plugin. The only possible reason for having them in the package is to save the plugin author a few lines of code that they need to know anyway. The functions add mystery to what is really a very basic operation. There are so many I/O modes just not covered; line by line input, write-append, binary modes, that it really isn't worth having an API, especially when that API isn't part of the core functionality, and doesn't fit with the rest of the package (which manipulates webs and topics, not files).

On the second, good point. I will do that. SVN 7600

CC

If you want to be able to support remote stores in the future then we'll need to provide saveFile and readFile.

MC

ah, but you're assuming that the Func module will survive as anything more than an old compatability layer. rather, proper abstraction through the Store object will provide what's needed.

WN

I did a large refactor on the Func.pm doc. At the same time un-deprecated readFile and saveFile with a big warning to use them only for Plugin work area. SVN 7606.

-- PTh

ItemTemplate
Summary Undeprecate TWiki::Func::readFile and TWiki::Func::saveFile
ReportedBy PeterThoeny
Codebase

AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins 7600
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2005-11-23 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback