in reply to Re: Re: new to oop (problem with my object)
in thread new to oop (problem with my object)

ahhh! i appreciate you guys looking at it..the printing of the html is actually working well now.. the 'fatalsToBrowser' told me what btrott was telling me about my mis-named method calls....it also appears as though i need to dereference my hash? I'm getting Table=HASH(0x100da2e8)->value when it does the following print: print "$table->value\n";
  • Comment on Re: Re: Re: new to oop (problem with my object)

Replies are listed 'Best First'.
Re: Re: Re: Re: new to oop (problem with my object)
by Fastolfe (Vicar) on Nov 17, 2000 at 02:52 UTC
    $table->value is a method call, not a variable. Thus, you can't interpolate it in a string like you can $hashref->{key}.
semi final script --
by dryland (Initiate) on Nov 17, 2000 at 03:31 UTC
    thanks for the help, if anyone cares:
    package Table; # # # Generic HTML Table Object # # sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = {}; $self->{TABLE_OPEN} = undef; $self->{TABLE_CLOSE} = undef; $self->{ROW_OPEN} = undef; $self->{ROW_CLOSE} = undef; $self->{COL_OPEN} = undef; $self->{COL_CLOSE} = undef; $self->{NAME} = undef; $self->{VALUE} = undef; bless ($self, $class); return $self; } ################################################# sub table_open { my $self = shift; if (@_) { $self->{TABLE_OPEN} = shift } return print "<table $self->{TABLE_OPEN}>\n"; } sub table_close { my $self = shift; if (@_) { $self->{TABLE_CLOSE} = shift } return print "</table>\n"; } sub row_open { my $self = shift; if (@_) { $self->{ROW_OPEN} = shift } return print "\t<tr $self->{ROW_OPEN}>\n"; } sub row_close { my $self = shift; if (@_) { $self->{ROW_CLOSE} = shift } return print "\t</tr>\n"; } sub col_open { my $self = shift; if (@_) { $self->{COL_OPEN} = shift } return print "\t\t<td $self->{COL_OPEN}>\n"; } sub col_close { my $self = shift; if (@_) { $self->{COL_CLOSE} = shift } return print "\t\t</td>\n"; } sub name { my $self = shift; if (@_) { $self->{NAME} = shift } return print "\t\t\t$self->{NAME}\n"; } sub value { my $self = shift; if (@_) { $self->{VALUE} = shift } return print "\t\t\t$self->{VALUE}\n"; } 1; ################################################ # script i'm using to interface #!/usr/bin/perl -w use CGI::Carp 'fatalsToBrowser'; use strict; use Web; # my web processing module use Table; my ($website) = 'dev.merchantonline.com'; my ($i) = undef; $|=1; &parse(); # parse html post/get using the Web module &check_referer($website); # check refering url using the Web module &check_required('test'); # check required fields using the Web module print "Content-type:text/html\n\n"; print "<html>\n<body>\n"; print "test = " . $in{'test'} . "<br><br>\n"; my($table) = new Table(); $table->table_open('width=500'); foreach $i (sort keys %in){ $table->row_open(); $table->col_open(); $table->name($i); $table->col_close; $table->col_open; $table->value($in{$i}); $table->col_close; $table->row_close; } $table->table_close; print "got here\n"; exit;