<div>I am new to Catalyst, but have been successful at creating simple DBIC CRUD apps. Now, I am trying something different... I want to use an Archive::Tar::File object as a model. I have created my model as:</div>
<div> </div>
<div>package LogManager::Model::Tar;</div>
<div>
<p>use strict;<br>use warnings;<br>use base 'Catalyst::Model::Factory';</p>
<p>__PACKAGE__->config(<br> class => 'Archive::Tar::File',<br> constructor => 'new',<br>);</p>
<p>1;<br><br>The Archive::Tar::File constructor (new) requires a filename be passed e.g., new( file => $path ). In a controller, I have tried:</p>
<p>sub view : Local {<br> my ( $self, $c, $file ) = @_;</p>
<p> LogManager->config->{'Model::Tar'} = {<br> class => 'Archive::Tar::File',<br> args => {<br> file => "c:\\temp\\logs\\$file",<br> },<br> };
<br> my $tarball = $c->model('LogManager::Tar'); <br> if( $tarball ) {<br> my @items = $tarball->get_files;<br> $c->stash->{items} = @items;<br> }<br> else {<br> $c->stash->{error_msg} = "Couldn't instantiate LogManager::Tar model";
<br> }<br> $c->stash->{template} = 'log/view.tt2';<br>}<br></p>
<p>The server started without error, and I called it with <u>"</u><a href="http://localhost:3000/log/view/WEBCGI.usgap002.20071020093500.tar">http://localhost:3000/log/view/WEBCGI.usgap002.20071020093500.tar</a>"
</p>
<p>I have, unsuccessfully, tried several other scenarios, but all I get is an undefined object, resulting in $c->stash->{error_msg} being set to "Couldn't instantiate LogManager::Tar model". Any pointers in the right direction are greatly appreciated.
</p>
<p>BTW, Catalyst is and awesome framework!</p>
<p>Thanks,<br>Mike Peck<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:mpeck@pobox.com" target="_blank">mpeck@pobox.com</a></p></div>