
gorums
New User
Mar 11, 2010, 11:26 AM
Post #1 of 1
(955 views)
|
Assigning an object to a variable of instance of a class
|
Can't Post
|
|
Hola, people I have a great problem, since I do not speak Englishman am going to be concise. I have a class
package WacidCon; sub new { my($class, $type) = @_; bless { "DB" => undef, "DB_type" => $type, "DB_host" => undef, "DB_port" => undef, "DB_port" => undef, "DB_username" => undef, "lastSQL" => undef, "version" => undef, "sql_trace" => undef, }, $class; } sub wacidConnectMySql { my($self, $database, $host, $port, $username, $password) = @_; $self->{DB_name} = $database; $self->{DB_host} = $host; $self->{DB_port} = $port; $self->{DB_username} = $username; $datasource = "dbi:mysql:$database:$host:$port"; $self->{DB} = DBI->connect($datasource, $username, $password, { PrintError => 0}) || &snort_error(&text('alert_err_connect_mysql', '<font color="red">'.$DBI::errstr.'</font>')); print ref($self->{DB}); $self->{version} = $self->wacidDBGetVersionSchema; } Error: Function prepare not Defined $self->{DB}->prepare($sql); That I want to solve: To be able refenrenciar to the object returned by the function DBI -> connect () across a variable of instance(authority) defined with the anonymous hash by function new() Thank you .
|