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:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old August 26th, 2000, 05:20 AM
d0g1e
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
My previous post didn't make much sense when i read it afterwards, so i rewrote it:

What i need is a script that reads a file, searches for a & and takes the first word which comes after it and puts that word in a variable.
Example:

(This is part of the template)
<img src="&ImageLogoLocation">

After script is run a variable should contain
the string: ImageLogoLocation

Thanks in advance

Reply With Quote
  #2  
Old August 26th, 2000, 11:57 AM
scream scream is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 441 scream User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 59 m 38 sec
Reputation Power: 9
Send a message via ICQ to scream
I can't really help you, but the "Perl Cookbook" from O'Reily is a great book with practical perl examples. If you want to make a great $40.00 investment I would suggest this book. It has information on template parsing.

Reply With Quote
  #3  
Old August 26th, 2000, 01:26 PM
kudinov kudinov is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 19 kudinov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I can suggest general aproach.
1. You need define rule for parsing your template. And use appropriated mechanism to seaching positions for substitutions and making it (If you have decided to seach '&' as start position what will define the end of string for substitution, this is the full name of variable).
2. Read template, look for strings for substitution, fill out requred position.
(You can use Hash, database, etc for storing and getting desired value of desired variable)
3. Print to stdout (in your case clients webpage) the strings with concatanating of initial static contents and filled by values variables.
Hope it helps.
One of other general aproachs is to invite somebody to write script.


Reply With Quote
  #4  
Old August 26th, 2000, 03:22 PM
d0g1e
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Thanks for your ideas. I think i'll look into perl regular expression tutorials URL

Reply With Quote
  #5  
Old October 20th, 2000, 05:26 AM
carlos carlos is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 11 carlos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Try the HTML::Template module.


<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by d0g1e:
Thanks for your ideas. I think i'll look into perl regular expression tutorials [/quote]


Reply With Quote
  #6  
Old October 21st, 2000, 12:39 AM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 9
I like the way everybody dodged the question there
for <img src="&ImageLogoLocation">:

if($string=~m/&(.*?)"/){$var=$1}
print $var;

Would print "ImageLogoLocation"

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > template parsing


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