On Tue, 28 Feb 2012 09:05:36 -0500 (CST) Eugenio Duran Aroche <edu...@estudiantes.uci.cu> wrote:
> I need know how open, write and read files in Mason, I put this code and not > show nothing in the browser, neither can't write in the file Well, you are not checking whether your open() succeeded. Nor are you HTML-escaping your output. Not to mention the useless subject of your e-mail. I'm not even mentioning the HTML mail your client sends out. You probably aren't in the correct directory or your web server doesn't have the correct read permissions to the file. You might want to refer to a netiquette guide for the other problems. Anyway, as loth as I am to give ready solutions, I wrote a trivial program to function as a scratch pad some time ago: <%args> $text => undef </%args> <html> <head><title>Scratchpad</title></head> <body> <form action="" method="post"> <div> <textarea name="text" cols="80" rows="25"><% $text |h %></textarea> </div> <div><input type="submit" value="Save" accesskey="s"></div> </form> </body> </html> <%init> $r->content_type('text/html; charset=utf-8'); if ($text) { if (-e $fn) { rename($fn, "$fn.bak") or die "cannot rename"; } open my $fh, ">", $fn or die "cannot open for writing: $!"; print $fh $text or die "cannot write: $!"; close $fh; } else { my $fh; if (-e $fn) { open($fh, "<", $fn) or die "cannot read: $!"; local $/ = undef; $text = <$fh>; close $fh; } } </%init> <%once> my $fn = '/full/path/to/scratchpad.txt'; </%once> ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users