seekperlwisdom has asked for the wisdom of the Perl Monks concerning the following question:
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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PerlOO what i am doing???
by tobyink (Canon) on Aug 12, 2012 at 07:08 UTC | |
by Anonymous Monk on Aug 12, 2012 at 09:04 UTC | |
| |
|
Re: PerlOO what i am doing???
by xyzzy (Pilgrim) on Aug 12, 2012 at 00:37 UTC | |
by seekperlwisdom (Acolyte) on Aug 13, 2012 at 09:20 UTC | |
by xyzzy (Pilgrim) on Aug 13, 2012 at 19:49 UTC | |
|
Re: PerlOO what i am doing???
by xyzzy (Pilgrim) on Aug 12, 2012 at 01:23 UTC | |
| |
|
Re: PerlOO what i am doing???
by chacham (Prior) on Aug 12, 2012 at 20:32 UTC |