Hi,
In my script, I get a connection established with the db. I then want to send the connection to another sub but it seems not to happen.
Can it not be done in the same way as any other value is passable from sub to sub?
second file:
The error msg says:
Can't call method "prepare" on an undefined value at header_control.pl line 313.
Can someone please show me a tutorial or give an explantion for what I have done wrongly.
I may just be in one of my 'lets make this more efficient' moods which makes me run around in circles.
bazz
In my script, I get a connection established with the db. I then want to send the connection to another sub but it seems not to happen.
Can it not be done in the same way as any other value is passable from sub to sub?
Code:
sub db_connect { my $business_id = '123'; my $connect = connect_to_db(); # connection established require 'header_control.pl'; # locate headers and footers module header($business_id,$connect); }
Code:
header { my ($business_id,$connect) = @_; business_id value can be used connect value isn't there. }
Can't call method "prepare" on an undefined value at header_control.pl line 313.
Can someone please show me a tutorial or give an explantion for what I have done wrongly.
I may just be in one of my 'lets make this more efficient' moods which makes me run around in circles.
bazz
Edit:
Blimey, sorry. I was looking at the wrong place
It's working now.
Blimey, sorry. I was looking at the wrong place
