Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Catalyst Help once again

by code-ninja (Scribe)
on Apr 28, 2013 at 09:33 UTC ( [id://1031046]=perlquestion: print w/replies, xml ) Need Help??

code-ninja has asked for the wisdom of the Perl Monks concerning the following question:

Hi again monks, I'm back with another Catalyst related doubt. Well, since my last post here I've learned Catalyst and recalled quite much about all the things I forgot about Perl (yippee!). The Catalyst app I'm working on now has a Login controller, a signup controller and even an upload controller and the best thing is, I coded them myself after understanding stuff from that Catalyst book.

The good thing is I'm stuck again. What my application does is, after logging in a user, asks them if they want to upload a file or view all files that are present on the server. I used Catalyst::Request::Upload plugin for letting the user upload a file. Now, when I list all the files, I want the user to be able to click on the name of the file and the browser should open the "Download File" dialogue box. I tried using Catalyst::Plugin::Static::Simple but I can't seem to figure it out. :/ :(.

Will any monk be kind enough to present me a step-by-step crash course on how to use C::P::S::S? Or a better question is, since I learn faster by examples, can any monk point me to a complete example that uses C::P::S::S? I did google about it, but it still is unclear.

PS: No, I'm not allowing the user to view ALL files on the server, just the files I put in the application_root/static/temp directory.

Replies are listed 'Best First'.
Re: Catalyst Help once again (MANIFEST)
by Anonymous Monk on Apr 29, 2013 at 09:02 UTC

    I tried using Catalyst::Plugin::Static::Simple but I can't seem to figure it out. :/ :(.

    What did you try?

    Will any monk be kind enough to present me a step-by-step crash course on how to use C::P::S::S? Or a better question is, since I learn faster by examples, can any monk point me to a complete example that uses C::P::S::S? I did google about it, but it still is unclear.

    :) All the best code has examples ready to run in MANIFEST, speaking of "best code", "better best" code even has them in examples directory with short/meaningful/clear to understand variable/subnames, and "super best" code even has complete example in SYNOPSIS

    So, it seem you should use

    MyApp->config( static => { ## include_path => [ ## MyApp->config->{root}.'/static', ## ], ## or dirs => [ ## qr{^static}, 'static', ], }, );

    Then you save your files in MyApp->config->{root}.'/static/temp/fileXXX.jpg'

    and you generate links /yourapp/static/temp/fileXXX.jpg so C'P'S'S will search MyApp->config->{root}.'/static/ for temp/fileXXX.jpg

    All that is left to turn on debug , test it, and tweak ignore*/mime....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1031046]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (None)
    As of 2024-04-25 00:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found