Solved

How to print an object and its arguments

Posted on 2006-07-12
1
185 Views
Last Modified: 2013-12-25
An HTML form sends input to this cgi program.  I would like to know how to print the value of
one or all of the cookie's values out of the object.  At present it outputs a blank string if cookies are enabled, but generates a server error indicating:

"uninitialized value in concatenation or string" at the line indicated.





#!/usr/bin/perl -wT
#
#

use strict;
use lib '/Volumes/mojo/toppweb/ttest/squid/squidperl';
use CGI qw( :standard);
use CGI::Cookie;

use constant SOURCE_CGI => "/tsquid/ctest2.html";

chomp (my $inval = param("cart_id") );
my $q= new CGI;

my $kookie = $q->cookie(-name => "tcooky",
                  -value => $inval,
                  -path  => "mt1.stanford.edu",
                   );

                              
if ( $inval )  {
#   print $q->redirect( SOURCE_CGI );
  print
        $q->header( -type => "text/html", -expires => "-1d" ),                  
        $q->start_html("Cookie Enabled"),
        $q->h1("Cookies Enabled [" . $q->cookie('tcooky') ."]"),           <--- error occurs here
       $q->p( "Your browser IS accepting cookies ",
       $q->a( { -href => SOURCE_CGI }, "Return" ),
       "."
       ),
       $q->end_html;



} else {
  print
        $q->header( -type => "text/html", -expires => "-1d" ),                   
        $q->start_html('Cookie Disabled'),
        $q->h1("Cookies Disabled " ),
       $q->p( "Your browser is not accepting cookies. ",
       $q->a( { -href => SOURCE_CGI }, "Return" ),
       "."
       ),
       $q->end_html;
}
exit (0);




0
Comment
Question by:gmanpert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
Perl_Diver earned 500 total points
ID: 17093020
you define a cookie but never read or write a cookie. The CGI module can handle the cookies, you don't need to also use CGI::Cookie. See if this helps you:

http://perldoc.perl.org/CGI.html#HTTP-COOKIES
0

Featured Post

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question