Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 12th, 2000, 02:21 PM
yoshi yoshi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 108 yoshi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via ICQ to yoshi
Hello,

I am attempting to create a message-board type script. Is there a way a script can save messages (like in a board), without using a database (like mySQL)?

Thanks!
yoshi http://www.datera.com
Comments on this post
Gran Roguismo agrees!

Reply With Quote
  #2  
Old April 13th, 2000, 12:40 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
Hi,

probably you may save your messages in a flat file.That is the easy way to save the messages with out a database.




------------------
SR -
shiju.dreamcenter.net

Reply With Quote
  #3  
Old April 13th, 2000, 07:23 PM
yoshi yoshi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 108 yoshi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via ICQ to yoshi
Thanks.. could you describe to me how placing data into a text file is done, and how to read from it?

yoshi http://www.datera.com

Reply With Quote
  #4  
Old April 14th, 2000, 07:20 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
Hello yoshi,

just i write a very small example for flatfile.here i am adding 3 field values in to the database.

fields are separated by "|" deliminator.

modify this code according to your requirment.


#!/usr/bin/perl

$firstname="Shiju";
$lastname="Thomas";
$msg="messgae goes here";


$database="database.txt";

#flatfile name

#####--- Add a record to the flatfile -###
$record=join("|",$firstname,$lastname,$msg);


#using join for putting "|" deliminator between the fields.

unless(-e $database){
#check whether database is existing or not
#if not existing then,create and add a record to it

open(DB,">$database") | | die "Error creating database $!n";

#open the database
}else{
#database is already their.
#append the records to existing database.

open(DB,">>$database") | | die "Error opening database $!n";

}
print DB "$recordn";
#print the records to the flatfile.
close(DB);

print "Record Addedn";


##########- Reading from the flatfile-#############


open(DB,$database) | | die "opening the database $!n";
#open database for reading the data from it.

while(<DB> ){
#use a while loop for reading whole data from the
#database.
#assain all record to an array

@data=<DB>;

}

foreach $data(@data){
#read from the array
#remove "|" deliminator and separate the field

($firstname,$lastname,$msg)=split(/|/,$data);

print "First Name: $firstnamen";
print "Last Name: $lastnamen";
print "Message : $msgn";
}

close(DB);


tell me if u have any problem with this..


Good Luck!!




------------------
SR -
shiju.dreamcenter.net

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > how a message-board is done?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway