| linux3 | revdiablo: well i am trying to include the code to connect to my database |
| f00li5h | linux3: you want to make a module full of stateless functions and then C< use > it revdiablo: meow |
| revdiablo | linux3: Okay, and what problem is that causing you? |
| linux3 | so i made a seperate file called dbconnect.pl and then in my index.pl file i did require "dbconnect.pl" |
| f00li5h | linux3: so you're changing from php... good for you |
| linux3 | and now perl throws out Global symbol "$dbconnect" requires explicit package name at ./index.pl line 17. Execution of ./index.pl aborted due to compilation errors f00li5h: never used PHP. perl is my first language |
| f00li5h | linux3: here's the thing, it's far far easier to use an ORM like dbix::class or Class::db |
| revdiablo | linux3: Each file has its own set of lexical variables |
| f00li5h | linux3: odd, including ramdom scripts is something i've only ever seen in php.. |
| revdiablo | linux3: You have to declare '$dbconnect' in the lexical scope you use it |
| linux3 | f00li5h: well i read one chapter on it. lol |
| f00li5h | oh, i see |
| linux3 | revdiablo: so i should declare it and then in the section where it is included it will have its value changed? |
| revdiablo | linux3: Nope |
| f00li5h | linux3: check out http://search.cpan.org/author/BLBLACK/DBIx-Class-0.07006/lib/DBIx/Class.pm |
| revdiablo | linux3: Make your connect function return the new connection, then from the caller you can put it in any variable you want |
| f00li5h | linux3: if you just require bits and pieces, you'll get namespaces keeping things private |
| linux3 | f00li5h: yeah thats pretty much what im doing but its causing problems just cause the variables aren't in the same scope |
| f00li5h | linux3: my $database = DbConnect::get_connection(); |
| linux3 | and programming confuses me gotta get better at it |
| revdiablo | linux3: Learn or hire. =) |
| f00li5h | right |
| linux3 | thats why im making this pointless website |
| f00li5h | revdiablo: the dude is trying to learn |
| revdiablo | f00li5h: I can see that. Just wanted to put that out there. |
| f00li5h | linux3: i have a pointless website on which i do silly perl things too |
| linux3 | lol f00li5h: yeah mine is going to be the modradio if i ever get it done |
| revdiablo | linux3: Files having separate scopes is a very good thing |
| linux3 | i just get discouraged easily cause i never seem to get any farther |
| f00li5h | linux3: i'm not sure what a "modradio" is linux3: further |
| linux3 | ahh its complicated. you can check it out kinda at http://rpmmaker.net/modradio/ of course what im working on is in the http://rpmmaker.net/modradio-dev/ directory |