Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Read/write file in CGI Perl

by mr_mischief (Monsignor)
on May 06, 2014 at 14:42 UTC ( [id://1085193]=note: print w/replies, xml ) Need Help??


in reply to Read/write file in CGI Perl

It will be very difficult to complete the code without seeing it in its current form. However, I can offer hints.

If you read the HTML or XHTML documentation it will make clear that a form field can have an initial value set. If you are using a JavaScript library like jQuery or YUI your JavaScript library has a way to set these through the DOM, or you can do it with JavaScript directly. You can also have your Perl code dynamically write the HTML with the values already set. Some modules, such as CGI have ways to do that, as do the frameworks and toolkits for web work.

As for opening and reading a file, there's open and then many ways to read. The readline ( '<>' ) is a good way to read a file. One might also use a structured file via XML like with the XML::Simple or XML::Twig modules; via CSV; via JSON, YAML, or INI, or using dbm.

One could also use a database via the DBI or a similar module (DBI). You could then use a database backend like SQLite, DBD::mysql, DBD::Pg. or many others (DBD). There are database-like interfaces between the DBI and files like DBD::CSV or DBD::RAM if you want, but a real database may be better in the long run.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1085193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-26 05:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found