#!/usr/bin/perl -T use strict; use CGI qw/:standard/; my $useragent = $ENV{'HTTP_USER_AGENT'}; print header, start_html('User Agent Example'); if ($useragent =~ /Firefox/) { print p("You are visiting with a Firefox browser"); } elsif ($useragent =~ /MSIE/) ...
#!/usr/bin/perl -T use strict; use CGI qw/:standard/; my $retrievedcookie1 = cookie('testcookie'); my $retrievedcookie2 = cookie('secondcookie'); print header, start_html, p("You sent a couple cookies and their values were $retrievedcookie1 ...
#!/usr/bin/perl -T use strict; use CGI qw/:standard/; my $cookie1 = cookie(-name=>'testcookie',value=>'testcookievalue',expires=>'+7d'); my $cookie2 = cookie(-name=>'secondcookie',value=>'secondcookievalue',➥ expires=>'+1d'); print header (-cookie=>[$cookie1,$cookie2]), start_html('CGI Cookie Test'), p("You've received a cookie\n"), end_html; exit;
#!/usr/bin/perl -T use strict; use CGI qw/:standard/; my $cookie = cookie(-name=>'testcookie',value=>'testcookievalue',-expires=>'+7d'); print header (-cookie=>$cookie), start_html('CGI Cookie Test'), p("You've received a cookie\n"), end_html; exit;
#!/usr/bin/perl -T use strict; use CGI qw/:standard/; my $retrievedcookie = cookie('testcookie'); print header, start_html, p("You sent a cookie and its value was $retrievedcookie\n"), end_html; exit;
#!/usr/bin/perl -T use strict; use CGI qw/:standard/; my $cookie = cookie(-name=>'testcookie',-value=>'testvalue'); print header (-cookie=>$cookie); print "You've received a cookie\n"; exit;