CatalystX::CMS::File - template file class
use CatalystX::CMS::File; # longhand my $file = CatalystX::CMS::File->new( $path_to_file ); $file->fetch if $page->size; $file->content('hello world'); $file->title('super foo'); $file->write; $file->commit or die $file->errstr; # shorthand my $file = CatalystX::CMS::File->new( path => $path_to_file, title => 'super foo', content => 'hello world', ); eval { $file->save } or die $file->errstr; print "$file was saved\n";
CatalystX::CMS::File is the object model for the Template Toolkit files that make up the content system of your application. Each object represents a .tt file on the filesystem in a Subversion working directory. An object can be read, written, locked and unlocked on the filesystem. As a subclass of SVN::Class::File, the object can be interrogated for its history, added, deleted, committed or updated.
.tt
Create a new object.
Either form of new() may be used, but path is always required.
Reads the file from disk and parses the metadata attributes and content, thereafter accessible via the attrs() and content() methods.
Will croak if path() is false, empty or non-existent.
Returns true if the delegate file has ever been committed to the repository.
Writes attrs() and content() to file location in TT-compatible format.
Will croak on any error.
If the ignore_lock flag is true, write() will ignore any true value of locked(). Otherwise, will croak() if locked() is true.
Returns the size of the resulting file.
Acquires lock for user and writes files as a new page.
Calls write().
NOTE: This is not the same as the SVN::Class->update method! If you want that method, use the up() alias instead.
Will write() file, add() to the SVN workspace if necessary, and then call commit( message ).
Returns -1 if status() of file indicates no modification. Otherwise, returns commit() return value.
Pass a true for leave_lock to leave the lock file intact after the commit().
Pass an authorized username to have the commit() made with that credential.
Returns content() with all TT code wrapped in special XHTML tagset
<code class="tt">
This is to allow for such code to be escaped online or otherwise parsed with a XML parser.
Peter Karman, <karman@cpan.org>
<karman@cpan.org>
Please report any bugs or feature requests to bug-catalystx-cms@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-catalystx-cms@rt.cpan.org
The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.
http://www.msi.umn.edu/
Copyright 2008 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CatalystX::CMS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::CMS
CPAN shell
perl -MCPAN -e shell install CatalystX::CMS
For more information on module installation, please visit the detailed CPAN module installation guide.