I am trying to make a module for project. i am not blessing variable . though i am creating varibles in methods. It works fine i just want to know if anything is wrong with it. i need to add more methods and new variables to process. thankspackage christianDatabase; use strict; use warnings; use DBI; use Time::Piece::MySQL; my $timeNow = localtime; my $date = $timeNow->mysql_datetime; my $dbh = DBI->connect("dbi:mysql:christianDatabase", "xxxacctxxx" , " +xxxpassxxx") or die; sub new { my($class)= @_; bless{ },$class; } sub add_comment{ my($self, $comment, $username,) } sub make_comment_record{ } sub check_comment_record{ my($self, $MNid) = @_; $self->{_MNid} = $MNid; my $sql = "select MNref from comment_record where MNid=" . "\"$sel +f->{_MNid}\""; my $ccr = $dbh->prepare($sql); $ccr->execute() or die "$!"; my $cct = $ccr->fetchrow_array; return $cct; } sub add_new_news{#news Heading, full text, news photos, url my ($self, $newsHeading, $fullText, $NewsPhoto, $url) = @_; $self->{_news_heading} = $newsHeading; $self->{_news_text} = $fullText; $self->{_news_photo} = $NewsPhoto || ''; $self->{_news_url} = $url; my $newsid = &new_News(); my $sql = "insert into news (news_heading, full_text, news_photos, url, date, news +ID) values(\"$self->{_news_heading}\", \"$self->{_news_tex +t}\", \"$self->{_news_photo}\", \"$self->{_news_url}\", \"$date\", \" +$newsid\")"; print "\n\n$sql\n\n"; my $addNews = $dbh->prepare($sql); $addNews->execute() or die "$!"; return "News added"; }
In reply to PerlOO what i am doing??? by seekperlwisdom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |