Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2004-01-03, 10:55 AM   #1
spacemanspiff
Where there's a will, I want to be in it.
 
spacemanspiff's Avatar
 
Join Date: Aug 2003
Location: Looz-e-anna
Posts: 1,015
Send a message via ICQ to spacemanspiff
perl help

Ok, I'm trying to learn a little perl programming. I have an include file that I use in a bunch of different folders, and I want to be able to replace it without uploading it to each folder individually.

I can locate all the files from the command line. Can a perl program do this? I want to:

1. locate all the files.
2. replace the old files with the new one.

I'm just hoping one of you scripting gurus can shorten the learning curve for me.

Thanks
SS
__________________
Submit your free sites to Free Sex Pics
spacemanspiff is offline   Reply With Quote
Old 2004-01-03, 02:57 PM   #2
amadman
I've been mad for fucking years, absolutely years, been over the edge for yonks....
 
amadman's Avatar
 
Join Date: Apr 2003
Location: padded room
Posts: 861
Hmmm.... You mean you have the same include file in a bunch of folders? If so then you may want to consider having 1 include file for all of the folders. Then when you need to make changes you only need to change the one.

Or am I totally confused about what you are asking?|rasta|
amadman is offline   Reply With Quote
Old 2004-01-03, 08:11 PM   #3
spacemanspiff
Where there's a will, I want to be in it.
 
spacemanspiff's Avatar
 
Join Date: Aug 2003
Location: Looz-e-anna
Posts: 1,015
Send a message via ICQ to spacemanspiff
Here's the way it's set up. I have the root folder, domain.com, that has an include file in it that's inserted on most of the html docs in the root. I also have a bunch of sub-folders, that need to have the same include file on the html docs in them. The way it's set up now, I have to upload the include file to all of the subfolders whenever I make a change to it.

I can (and probably will) upload the file to an aliased folder and change all the includes to virtual includes. I have a larger project I want to do, and this is the first step in learning to write programs.

More confused now?
__________________
Submit your free sites to Free Sex Pics
spacemanspiff is offline   Reply With Quote
Old 2004-01-03, 09:01 PM   #4
amadman
I've been mad for fucking years, absolutely years, been over the edge for yonks....
 
amadman's Avatar
 
Join Date: Apr 2003
Location: padded room
Posts: 861
Quote:
Originally posted by spacemanspiff

More confused now?
Yup...

But I think I got you. It sounds beyond me thought I am afraid.
amadman is offline   Reply With Quote
Old 2004-01-03, 09:14 PM   #5
spacemanspiff
Where there's a will, I want to be in it.
 
spacemanspiff's Avatar
 
Join Date: Aug 2003
Location: Looz-e-anna
Posts: 1,015
Send a message via ICQ to spacemanspiff
I guess the simplest way to say it is how do you search a directory for a specific file, then upload a new version wherever it's found.
__________________
Submit your free sites to Free Sex Pics
spacemanspiff is offline   Reply With Quote
Old 2004-01-04, 01:26 PM   #6
urb
All the way from Room 101
 
urb's Avatar
 
Join Date: Aug 2003
Posts: 3,557
Send a message via ICQ to urb
If the file you are looking to alter is the same for each location, like a banner and supporting code, you can use a simple include file which all the pages can be pointed at.

<!--#include virtual="/data/banner.html" -->

Then to update every page which is linked into the include, you just edit one file.

I'm not sure if that's what you were asking, so forgive me if you already know this.
__________________
urb is offline   Reply With Quote
Old 2004-01-04, 02:51 PM   #7
spacemanspiff
Where there's a will, I want to be in it.
 
spacemanspiff's Avatar
 
Join Date: Aug 2003
Location: Looz-e-anna
Posts: 1,015
Send a message via ICQ to spacemanspiff
That works fine Urb. I'll do it that way. I suppose that's what you were talking about too Madman. Learned something new about virtual includes. Thanks guys.

I would still like to know the best way to accomplisg my original goal. I don't need the exact code. Just a general outline would be great.
__________________
Submit your free sites to Free Sex Pics
spacemanspiff is offline   Reply With Quote
Old 2004-01-15, 02:11 AM   #8
vmp22
Heh Heh Heh! Lisa! Vampires are make believe, just like elves and gremlins and eskimos!
 
Join Date: Jan 2004
Posts: 72
i think i kinda understand what you're looking for....

if you are using PHP, the easiest way would be set the include_path directive in your php.ini file.

if you are using Perl, set the path where your include file is located into the Perl include array; for example, if your include file is called "include.pl" which is located in "/some/location/", in each Perl script, do this:

push @INC,'/some/location/';
use "include.pl";

Urb's suggestion about using the SSI include will work too

hope that helps a bit... unless i am completely wrong about what you're looking for
vmp22 is offline   Reply With Quote
Old 2004-01-15, 08:35 AM   #9
spacemanspiff
Where there's a will, I want to be in it.
 
spacemanspiff's Avatar
 
Join Date: Aug 2003
Location: Looz-e-anna
Posts: 1,015
Send a message via ICQ to spacemanspiff
It all helps vmp. Using the ssi is probably the correct way to do the job, and that's the way I ended up doing it. I wanted to do the search and replace method just to learn some perl. I learned enough doing that to modify another program that does some very useful things. I'm learning new stuff every day. It's really kind of fun.

Thanks again to all who helped.
__________________
Submit your free sites to Free Sex Pics
spacemanspiff is offline   Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:27 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc