1 / 15

Part 5 Advanced topics in CGI/Perl

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.

bishop
Download Presentation

Part 5 Advanced topics in CGI/Perl

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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.

  3. 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.

  4. 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.)

  5. 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.)

  6. 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.

  7. Random assignment to conditions • To illustrate, consider the following example:

  8. 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.)

  9. Discussion of the code for experiment1.pl

  10. 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)

  11. 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]

  12. 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.

  13. 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.

  14. 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.)

More Related