part 5 advanced topics in cgi/perl

15
Part 5 Advanced topics in CGI/Perl Psychological Science on the Internet: Designing Web-Based Experiments From the Ground Up R. Chris Fraley | AMASS 2006

Upload: bishop

Post on 07-Jan-2016

34 views

Category:

Documents


0 download

DESCRIPTION

Part 5 Advanced topics in CGI/Perl. Psychological Science on the Internet: Designing Web-Based Experiments From the Ground Up R. Chris Fraley | AMASS 2006. Using Perl/CGI to deliver the original page AND process the data. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Part 5 Advanced topics in CGI/Perl

Part 5Advanced topics in CGI/Perl

Psychological Science on the Internet:Designing Web-Based Experiments From the Ground Up

R. Chris Fraley | AMASS 2006

Page 2: Part 5 Advanced topics in CGI/Perl

Using Perl/CGI to deliver the original page AND process the data

• One of the nice things about Perl is that you can simply paste your HTML code into the print " " ; statements to deliver HTML code to the user.

• This suggests that, in addition to using a Perl script to provide your user with feedback, you can use the script to administer the questionnaire itself.

Page 3: Part 5 Advanced topics in CGI/Perl

Using Perl/CGI to deliver the original page AND process the data

• Why might you want to do this?

• By using a Perl/CGI script to control the flow of information, you can randomize the order of questions, randomly assign people to conditions, or implement complex branching structures.

Page 4: Part 5 Advanced topics in CGI/Perl

An illustration: self-esteem2.pl

• A discussion of self-esteem2.pl.

• This script accomplishes everything that the combination of self-esteem.htm (an HTML file) and self-esteem-savedata.pl (a CGI/Perl) file did, but does it all in the context of a single CGI script. Try it here: http://aps2005.netfirms.com/cgi-bin/self-esteem2.pl

• The code for self-esteem2.pl can be viewed (and downloaded) as a text file at the following location:http://web-research-design.net/APS2005/files/self-esteem2.pl

• (Save it on your own computer, modify it as needed, and then transfer it to the cgi-bin directory of your Netfirms account.)

Page 5: Part 5 Advanced topics in CGI/Perl

Randomizing the items: self-esteem3.pl

• A discussion of self-esteem3.pl. • (You can try the script at

http://www.aps2005.netfirms.com/cgi-bin/self-esteem3.pl)

• This script randomizes the order in which the self-esteem questions are presented.

• This general method can be used for randomly assigning people to conditions in a within-subjects design.

• The code for self-esteem3.pl can be viewed (and downloaded) as a text file at the following location:

http://web-research-design.net/APS2005/files/self-esteem3.pl

• (Save it on your own computer, modify it as needed, and then transfer it to the cgi-bin directory of your Netfirms account.)

Page 6: Part 5 Advanced topics in CGI/Perl

Random assignment to conditions

• The basic randomization code that we used to randomize the order of items can also be used to randomize the conditions to which a person is assigned in a web-based experiment.

Page 7: Part 5 Advanced topics in CGI/Perl

Random assignment to conditions

• To illustrate, consider the following example:

Page 8: Part 5 Advanced topics in CGI/Perl

• You can participate in this brief experiment at the following web site:

• http://www.aps2005.netfirms.com/cgi-bin/experiment1.pl

• Moreover, you can download the code from here:http://web-research-design.net/APS2005/files/

experiment1.pl

• (Save it on your own computer, modify it as needed, and then transfer it to the cgi-bin directory of your Netfirms account.)

Page 9: Part 5 Advanced topics in CGI/Perl
Page 10: Part 5 Advanced topics in CGI/Perl

• Discussion of the code for experiment1.pl

Page 11: Part 5 Advanced topics in CGI/Perl

Another way to implement random assignment

• Another way to implement random assignment is to create an introductory Perl/CGI page that provides the informed consent information and randomly determines which web page the user will be directed to when he or she clicks the button to begin the study.

• To see an example of this, visit the following URL: http://aps2005.netfirms.com/cgi-bin/experiment2.pl

• (The code can be copied from this URL: http://web-research-design.net/APS2005/files/experiment2.pl)

Page 12: Part 5 Advanced topics in CGI/Perl

Another way to implement random assignment

• Why is this valuable?

• If you don’t want to get too caught up in the programming aspect of Perl/CGI, you can simply create separate web pages for each condition of your study and allow a single Perl script to determine which one the user will get to see.

• [a discussion of the experiment2.pl code]

Page 13: Part 5 Advanced topics in CGI/Perl

Presenting items/stimuli on separate pages

• In many cases you may wish to present items/stimuli on separate pages.

• This presents a minor problem. Namely, the relationship between the subject’s computer and the web server is said to be “stateless.” There is no on-going relationship between the two.

Page 14: Part 5 Advanced topics in CGI/Perl

Presenting items on separate pages

• One way around this problem is to use “hidden tags” to pass along previously collected information from one page to the next.

• This happens behind the scenes, so the subject’s experience is a continuous one, despite the fact that the true relationship between the subject and the server is not.

Page 15: Part 5 Advanced topics in CGI/Perl

self-esteem4.pl

• You can participate in a demonstration at the following web site:

• http://www.aps2005.netfirms.com/cgi-bin/self-esteem4.pl

• Moreover, you can download the code from here:http://web-research-design.net/APS2005/files/self-

esteem4.pl

• (Save it on your own computer, modify it as needed, and then transfer it to the cgi-bin directory of your Netfirms account.)