Sponsored Content
Top Forums Shell Programming and Scripting Creating a captcha with amazon node .htaccess" Post 302951186 by Don Cragun on Monday 3rd of August 2015 07:08:57 PM
Old 08-03-2015
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

creating an .htaccess file

I don't know anything about Unix but I have to create a htaccess file and a htpasswd file. I have instructions that tell me to "create an htaccess file using the vi editor" How do I get into the directory that should be password protected and how do I start creating the htaccess file? If I can... (5 Replies)
Discussion started by: WhitneyMay
5 Replies

2. Virtualization and Cloud Computing

CEP as a Service (CEPaaS) with MapReduce on Amazon EC2 and Amazon S3

Tim Bass 11-25-2008 01:02 PM Just as I was starting to worry that complex event processing community has been captured by RDBMS pirates off the coast of Somalia, I rediscovered a new core blackboard architecture component, Hadoop. Hadoop is a framework for building applications on large... (0 Replies)
Discussion started by: Linux Bot
0 Replies

3. Virtualization and Cloud Computing

Creating VirtualBox-Image as "harddisk" by shell-script

Hello, I'm trying to create a VirtualBox "harddisk" and put an dd-image into it. This image shoudn't work as a virtual maschine, I just want to be able to mount it to an folder. How can I do this with an shell script? Sebi ---------- Post updated at 10:36 AM ---------- Previous update... (0 Replies)
Discussion started by: Sebi0815
0 Replies

4. Shell Programming and Scripting

Creating a Shortcut (to just type "l" but it runs "ls -lah")

How do I create shortcuts? For example: I just want to type one key "l" and have it output the command of "ls -lah" I believe it's creating a file called l with 755 permissions but I'm not sure where to put the file. *if it matters, I'm on a shared hosting web server using cPanel with... (2 Replies)
Discussion started by: ijustsawmars
2 Replies

5. Shell Programming and Scripting

mv command to include files beginning with "." (like .htaccess)

Hi, how can I get the mv command to include files beginning with . (such as .htaccess)? Right now when I mv a directory the .htaccess file is missing and I need to do this on a lot of directories, so there's a lot of wordpress permalinks that don't work anymore because the .htaccess file wasn't... (5 Replies)
Discussion started by: vanessafan99
5 Replies

6. Programming

"make" fails on the first .f90 file it encounters: not creating .o files

i may be asking way too much here but i am not a programmer and not sure where to to turn. i have a program that i am trying to "make". but the compiler i am supposed to use gets nowhere. there are a bunch of .f90 files that are being processed as follows but it doesn't get past the first one: ... (1 Reply)
Discussion started by: crimso
1 Replies

7. Homework & Coursework Questions

Need help creating shell script with output that has 2014 calendar and 2 text items from a"fortune"

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am required to create a bash shell script with either emacs or vi. It must include the year 2014 calendar on... (9 Replies)
Discussion started by: dandanhelpmeman
9 Replies
HTML::FormHandler::Manual::Catalyst(3pm)		User Contributed Perl Documentation		  HTML::FormHandler::Manual::Catalyst(3pm)

NAME
HTML::FormHandler::Manual::Catalyst - using HFH forms in Catalyst VERSION
version 0.40013 SYNOPSIS
Manual Index This part of the FormHandler Manual describes the use of the HTML::FormHandler package in Catalyst controllers. See the other FormHandler documentation at HTML::FormHandler::Manual, or the base class at HTML::FormHandler. DESCRIPTION
Although HTML::FormHandler can be used in any Perl web application, module, or script, one of its most common uses is in Catalyst applications. Using a form takes only a few lines of code, so it's not necessary to have a Catalyst base controller, although you could make a base controller for FormHandler if you're doing more than the basics. A Controller Example The following example uses chained dispatching. The 'form' method is called by both the create and edit actions. package BookDB::Controller::Borrower; use Moose; BEGIN { extends 'Catalyst::Controller' } sub borrower_base : Chained PathPart('borrower') CaptureArgs(0) { } sub list : Chained('borrower_base') PathPart('list') Args(0) { my ( $self, $c ) = @_; my $borrowers = [ $c->model('DB::Borrower')->all ]; my @columns = ( 'name', 'email' ); $c->stash( borrowers => $borrowers, columns => @columns, template => 'borrower/list.tt' ); } sub add : Chained('borrower_base') PathPart('add') Args(0) { my ( $self, $c ) = @_; # Create the empty borrower row for the form $c->stash( borrower => $c->model('DB::Borrower')->new_result({}) ); return $self->form($c); } sub item : Chained('borrower_base') PathPart('') CaptureArgs(1) { my ( $self, $c, $borrower_id ) = @_; $c->stash( borrower => $c->model('DB::Borrower')->find($borrower_id) ); } sub edit : Chained('item') PathPart('edit') Args(0) { my ( $self, $c ) = @_; return $self->form($c); } sub form { my ( $self, $c ) = @_; my $form = BookDB::Form::Borrower->new; $c->stash( form => $form, template => 'borrower/form.tt' ); return unless $form->process( item => $c->stash->{borrower}, params => $c->req->parameters ); $c->res->redirect( $c->uri_for($self->action_for('list')) ); } sub delete : Chained('item') PathPart('delete') Args(0) { my ( $self, $c ) = @_; $c->stash->{borrower}->delete; $c->res->redirect( $c->uri_for($c->action_for('list')) ); } 1; Another way to set up your form If you are setting the schema or other form attributes (such as the user_id, or other attributes) on your form you could create a base controller that would set these in the form on each call using Catalyst::Component::InstancePerContext, or set them in a base Chained method. sub book_base : Chained PathPart('book') CaptureArgs(0) { my ( $self, $c ) = @_; my $form = MyApp::Form->new; $form->schema( $c->model('DB')->schema ); $form->params( $c->req->parameters ); $form->user_id( $c->user->id ); $c->stash( form => $form ); } Then you could just pass in the item_id when the form is processed. return unless $c->stash->{form}->process( item_id => $id ); Putting a form in a Moose attribute You can also put your form in a Moose attribute in the controller. package MyApp::Controller::Book; use Moose; BEGIN { extends 'Catalyst::Controller'; } use MyApp::Form::Book; has 'edit_form' => ( isa => 'MyApp::Form::Book', is => 'rw', lazy => 1, default => sub { MyApp::Form::Book->new } ); Then you can process the form in your actions with "$self->edit_form->process( params => $c->req->body_parameters );" or "my $result = $self->edit_form->run( params => $c->req->body_parameters );". Using HTML::FillInForm If you want to use HTML::FillInForm to fill in values instead of doing it in directly in a template using either the field or the form 'fif' methods, you can use Catalyst::View::FillInForm on your view class: package MyApp::View::TT; use Moose; with 'Catalyst::View::FillInForm'; .... 1; and set the 'fif' hash in the 'fillinform' stash variable: $self->form->process( ... ); $c->stash( fillinform => $self->form->fif ); return unless $form->validated; When the 'fillinform' stash variable is set, HTML::FillInForm will automatically be used by your view to fill in the form values. This can be very helpful when you want to build your forms by hand, or when you have legacy forms that you're just trying to hook up to FormHandler. The Catalyst context FormHandler has a 'ctx' attribute that can be used to set the Catalyst context (or anything you want, really). But if you can avoid passing in the context, you should do so, because you're mixing up your MVC and it makes it much more difficult to test your forms. But if you need to do it, you can: my $form = MyApp::Form->new( ctx => $c ); Usually you should prefer to add new attributes to your form: package MyApp::Form; use HTML::FormHandler::Moose; extends 'HTML::FormHandler'; has 'user_id' => ( is => 'rw' ); has 'hostname' => ( is => 'rw' ); has 'captcha_store' => ( is => 'rw' ); .... 1; Then just pass the attributes in on new: my $form => MyApp::Form->new( user_id => $c->user->id, hostname => $c->req->host, captcha_store => $c->{session}->{captcha} ); Or set them using accessors: $form->user_id( $c->user->id ); $form->hostname( $c->req->host ); $form->captcha_store( $c->{session}->{captcha} ); Then you can access these attributes in your form validation methods: sub validate_selection { my ( $self, $field ) = @_; if( $field->value eq 'something' && $self->hostname eq 'something_else' ) { $field->add_error("some error message" ); } } AUTHOR
FormHandler Contributors - see HTML::FormHandler COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Gerda Shank. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-25 HTML::FormHandler::Manual::Catalyst(3pm)
All times are GMT -4. The time now is 11:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy