CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Post deleted by appetitto

 



appetitto
Novice

Aug 15, 2012, 7:46 AM

Post #1 of 4 (17898 views)
Post deleted by appetitto

 


FishMonger
Veteran / Moderator

Aug 15, 2012, 8:30 AM

Post #2 of 4 (17892 views)
Re: [appetitto] Cannot update record in file with Dump module [In reply to] Can't Post

There are several very questionable aspects to your code. One is your use of eval.

You should add a couple print statements to the loop to see how it progresses thru the file.

The starting point would be to add these 2 pragmas and fix the issues that they point out.

Code
use strict; 
use warnings;


Can you post your data file so I can see what you're attempting to accomplish?


appetitto
Novice

Aug 15, 2012, 8:47 AM

Post #3 of 4 (17886 views)
Post deleted by appetitto [In reply to]

 


FishMonger
Veteran / Moderator

Aug 15, 2012, 9:02 AM

Post #4 of 4 (17881 views)
Re: [appetitto] Cannot update record in file with Dump module [In reply to] Can't Post

Those errors mean that you need to declare the vars, which is done with the 'my' keyword like you did on the other vars.

So, if I understand correctly, your data file is a config file containing vars that you need to use in the script. If so, then instead of reading in the file and using eval like that, you can load the file with a require or do statement.

Code
require $megalithFile;

or

Code
do $megalithFile;


However, a much better solution would be to use a standard config file and parse that file rather than executing code via eval. There are many config parser modules on cpan which make this task very easy and safe. Using eval like that is very insecure and dangerous.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives