[19829] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2024 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 27 18:10:33 2001

Date: Sat, 27 Oct 2001 15:10:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1004220614-v10-i2024@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 27 Oct 2001     Volume: 10 Number: 2024

Today's topics:
        how to set up a CGI on my webpage <spam@dsxs.net>
    Re: how to set up a CGI on my webpage <tony_curtis32@yahoo.com>
    Re: how to set up a CGI on my webpage (Mark Taylor)
    Re: how to set up a CGI on my webpage <spam@dsxs.net>
    Re: how to set up a CGI on my webpage (Mark Taylor)
    Re: how to set up a CGI on my webpage <spam@dsxs.net>
    Re: how to set up a CGI on my webpage <jeff@vpservices.com>
    Re: how to set up a CGI on my webpage (Mark Taylor)
    Re: how to set up a CGI on my webpage <spam@dsxs.net>
    Re: how to set up a CGI on my webpage (Mark Taylor)
    Re: how to set up a CGI on my webpage (Mark Taylor)
    Re: how to set up a CGI on my webpage <jeff@vpservices.com>
    Re: how to set up a CGI on my webpage <spam@dsxs.net>
    Re: how to set up a CGI on my webpage <spam@dsxs.net>
    Re: how to set up a CGI on my webpage <jeff@vpservices.com>
        multiple tag replacement within a string <leblanc@keyslapper.nospam.org>
    Re: multiple tag replacement within a string <jeff@vpservices.com>
        need help with files <hoss@chungk.com>
    Re: need help with files <jurgenex@hotmail.com>
    Re: need help (Jon Bell)
    Re: Newbie. <uri@sysarch.com>
        not working <adustipujo1@mediaone.net>
    Re: perl loozer <gellyfish@gellyfish.com>
    Re: perl loozer <joe+usenet@sunstarsys.com>
    Re: perl loozer <bart.lateur@skynet.be>
        printing html <hoss@chungk.com>
    Re: printing html (Mark Taylor)
    Re: printing html <jeff@vpservices.com>
    Re: printing html <hoss@chungk.com>
    Re: printing html <tony_curtis32@yahoo.com>
        Q: Proxytest? <awin@wros.de>
    Re: Q: Proxytest? <tony_curtis32@yahoo.com>
        study() question <mda@idatar.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 27 Oct 2001 20:06:04 +0200
From: "Steven Wüthrich" <spam@dsxs.net>
Subject: how to set up a CGI on my webpage
Message-Id: <3bdaf787$1_4@news.bluewin.ch>

Hi there,

ive been working with perl for several months now, and now id like to
put a cgi script on my website, just to test it...

id only like the script to print

Hello there

(  ;)) its only to test how the CGI thing between browser and Server works,
right!!! ;))

anyway, my script looks like this


#!/bin/perl

print "Hello there\n";



thats all!!
now, ive put this file into my CGI-bin on the server. how do i call the
script now? how do i make it execute itself?

its an easy question, so i hope to get an answer... thanks in advance,
anyway!


greets, steven




------------------------------

Date: Sat, 27 Oct 2001 13:13:08 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <87n12dt0i3.fsf@limey.hpcc.uh.edu>


[ deleted dead group comp.lang.perl ]

>> On Sat, 27 Oct 2001 20:06:04 +0200,
>> "Steven Wüthrich" <spam@dsxs.net> said:

> Hi there, ive been working with perl for several months
> now, and now id like to put a cgi script on my website,
> just to test it...

Off-topic (you'd be seeing the same problems no matter
what language you used to write the CGI program), try

    comp.infosystems.www.authoring.cgi

to see how to operate within a CGI environment.

Followup set.

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


------------------------------

Date: 27 Oct 2001 13:40:48 -0500
From: mtaylor@lrim.com (Mark Taylor)
Subject: Re: how to set up a CGI on my webpage
Message-Id: <Xns91478D6C132B4mtaylorlrimcom@128.242.171.114>

"Steven Wüthrich" <spam@dsxs.net> wrote in
<3bdaf787$1_4@news.bluewin.ch>: 

>Hi there,
>
>ive been working with perl for several months now, and now id like to
>put a cgi script on my website, just to test it...
>
>id only like the script to print
>
>Hello there
>
>(  ;)) its only to test how the CGI thing between browser and Server
>works, right!!! ;))
>
>anyway, my script looks like this
>
>
>#!/bin/perl
>
>print "Hello there\n";
>
>
>
>thats all!!
>now, ive put this file into my CGI-bin on the server. how do i call the
>script now? how do i make it execute itself?
>
>its an easy question, so i hope to get an answer... thanks in advance,
>anyway!
>
>
>greets, steven
>
>
>

Actually it will print to stdout, or in this case, the terminal window 
which you cannot see.

To print back to the browser you need to tell it to...

#!/bin/perl
print "Content-type:text/html\n\n";
print "Hello World!<BR>\n";



This assumes of course that perl is at /bin/perl on your system.
Execute it with http://yourdomain.com/cgi-bin/its_name.cgi

Be sure and upload it in ascii



Cheers,
Mark

______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net


------------------------------

Date: Sat, 27 Oct 2001 21:10:50 +0200
From: "Steven Wüthrich" <spam@dsxs.net>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <3bdb06b4$1_5@news.bluewin.ch>


"Mark Taylor" <mtaylor@lrim.com> schrieb im Newsbeitrag
news:Xns91478D6C132B4mtaylorlrimcom@128.242.171.114...

>
> Actually it will print to stdout, or in this case, the terminal window
> which you cannot see.
>
> To print back to the browser you need to tell it to...
>
> #!/bin/perl
> print "Content-type:text/html\n\n";
> print "Hello World!<BR>\n";
>
>
>
> This assumes of course that perl is at /bin/perl on your system.
> Execute it with http://yourdomain.com/cgi-bin/its_name.cgi
>
> Be sure and upload it in ascii
>
>
>
> Cheers,
> Mark
>
>
____________________________________________________________________________
__
> Posted Via Binaries.net = SPEED+RETENTION+COMPLETION =
http://www.binaries.net


Hi mark, thanks for replying.

oh sure, prints standart output is the screen, obviously.

Okay, ive tried it, but it still wont work.
in the html file main.htm
ive added the entry
 <!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi"-->

on www.kontent.de, my website provider, they told me that the absolute path
is /htdocs/www/cgi-bin/filename
my index.html, main.htm etc are all in the folder www!

my Perl script looks excactely the way you told me to
let it look.. ;))

#/bin/perl

print "Content-type:text/html\n\n";
print "Hello World!<BR>\n";

what could be wrong, what else can i check to
see whats not working properly!!

thanks already...
cheers, steven






------------------------------

Date: 27 Oct 2001 14:05:10 -0500
From: mtaylor@lrim.com (Mark Taylor)
Subject: Re: how to set up a CGI on my webpage
Message-Id: <Xns9147918DDA93Amtaylorlrimcom@128.242.171.114>

"Steven Wüthrich" <spam@dsxs.net> wrote in
<3bdb06b4$1_5@news.bluewin.ch>: 

>
>"Mark Taylor" <mtaylor@lrim.com> schrieb im Newsbeitrag
>news:Xns91478D6C132B4mtaylorlrimcom@128.242.171.114...
>
>>
>> Actually it will print to stdout, or in this case, the terminal window
>> which you cannot see.
>>
>> To print back to the browser you need to tell it to...
>>
>> #!/bin/perl
>> print "Content-type:text/html\n\n";
>> print "Hello World!<BR>\n";
>>
>>
>>
>> This assumes of course that perl is at /bin/perl on your system.
>> Execute it with http://yourdomain.com/cgi-bin/its_name.cgi
>>
>> Be sure and upload it in ascii
>>
>>
>>
>> Cheers,
>> Mark
>>
>>
>_________________________________________________________________________
>___ __
>> Posted Via Binaries.net = SPEED+RETENTION+COMPLETION =
>http://www.binaries.net
>
>
>Hi mark, thanks for replying.
>
>oh sure, prints standart output is the screen, obviously.
>
>Okay, ive tried it, but it still wont work.
>in the html file main.htm
>ive added the entry
> <!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi"-->
>
>on www.kontent.de, my website provider, they told me that the absolute
>path is /htdocs/www/cgi-bin/filename
>my index.html, main.htm etc are all in the folder www!
>
>my Perl script looks excactely the way you told me to
>let it look.. ;))
>
>#/bin/perl
>
>print "Content-type:text/html\n\n";
>print "Hello World!<BR>\n";
>
>what could be wrong, what else can i check to
>see whats not working properly!!
>
>thanks already...
>cheers, steven
>
>
>
>
>

You've switch gears...

<!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi"--> is not a simple cgi 
script to execute. Now your talking server side includes. The html file 
this is in needs to be an .shtml file and the server needs to be setup to 
allow ssi. 

Tackle one problem at a time. Will the Hello World! script run? Then will 
the server allow ssi?

Cheers
Mark
______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net


------------------------------

Date: Sat, 27 Oct 2001 21:25:06 +0200
From: "Steven Wüthrich" <spam@dsxs.net>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <3bdb0a0c$1_4@news.bluewin.ch>


"Mark Taylor" <mtaylor@lrim.com> schrieb im Newsbeitrag
news:Xns9147918DDA93Amtaylorlrimcom@128.242.171.114...
> "Steven Wüthrich" <spam@dsxs.net> wrote in
> <3bdb06b4$1_5@news.bluewin.ch>:
>
> >
> >"Mark Taylor" <mtaylor@lrim.com> schrieb im Newsbeitrag
> >news:Xns91478D6C132B4mtaylorlrimcom@128.242.171.114...
> >
> >>
> >> Actually it will print to stdout, or in this case, the terminal window
> >> which you cannot see.
> >>
> >> To print back to the browser you need to tell it to...
> >>
> >> #!/bin/perl
> >> print "Content-type:text/html\n\n";
> >> print "Hello World!<BR>\n";
> >>
> >>
> >>
> >> This assumes of course that perl is at /bin/perl on your system.
> >> Execute it with http://yourdomain.com/cgi-bin/its_name.cgi
> >>
> >> Be sure and upload it in ascii
> >>
> >>
> >>
> >> Cheers,
> >> Mark
> >>
> >>
> >_________________________________________________________________________
> >___ __
> >> Posted Via Binaries.net = SPEED+RETENTION+COMPLETION =
> >http://www.binaries.net
> >
> >
> >Hi mark, thanks for replying.
> >
> >oh sure, prints standart output is the screen, obviously.
> >
> >Okay, ive tried it, but it still wont work.
> >in the html file main.htm
> >ive added the entry
> > <!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi"-->
> >
> >on www.kontent.de, my website provider, they told me that the absolute
> >path is /htdocs/www/cgi-bin/filename
> >my index.html, main.htm etc are all in the folder www!
> >
> >my Perl script looks excactely the way you told me to
> >let it look.. ;))
> >
> >#/bin/perl
> >
> >print "Content-type:text/html\n\n";
> >print "Hello World!<BR>\n";
> >
> >what could be wrong, what else can i check to
> >see whats not working properly!!
> >
> >thanks already...
> >cheers, steven
> >
> >
> >
> >
> >
>
> You've switch gears...
>
> <!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi"--> is not a simple cgi
> script to execute. Now your talking server side includes. The html file
> this is in needs to be an .shtml file and the server needs to be setup to
> allow ssi.
>
> Tackle one problem at a time. Will the Hello World! script run? Then will
> the server allow ssi?


oh right... i didnt know this was SSI....
but what other entry do i put in my HTML file if not the above??


i really only want the script to start, which then prints the message...
how to i call the script from within the main.html??

regards, steven




------------------------------

Date: Sat, 27 Oct 2001 12:42:57 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <3BDB0E41.7DDC3C59@vpservices.com>

Mark Taylor wrote:
> 
> "Steven Wüthrich" <spam@dsxs.net> wrote in
> <3bdb06b4$1_5@news.bluewin.ch>:
> > ...
> <!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi"--> is not a simple cgi
> script to execute. Now your talking server side includes. The html file
> this is in needs to be an .shtml file and the server needs to be setup to
> allow ssi.
> 
> Tackle one problem at a time. 

Excellent advice.  And perhaps even more important, get information on
each part of the problem in the appropriate place.

> Will the Hello World! script run? 

That is a perl question, if the script will not run from the command
line you can ask about that in this newsgroup.

> Then will the server allow ssi?

That is not at all related to perl.  As several people have already
suggested, you need to ask about that in a server or ssi related
newsgroup.

-- 
Jeff



------------------------------

Date: 27 Oct 2001 14:33:53 -0500
From: mtaylor@lrim.com (Mark Taylor)
Subject: Re: how to set up a CGI on my webpage
Message-Id: <Xns9147966BE4AB0mtaylorlrimcom@128.242.171.114>

"Steven Wüthrich" <spam@dsxs.net> wrote in
<3bdb0a0c$1_4@news.bluewin.ch>: 


>
>oh right... i didnt know this was SSI....
>but what other entry do i put in my HTML file if not the above??
>
>
>i really only want the script to start, which then prints the message...
>how to i call the script from within the main.html??
>
>regards, steven
>
>
>

The entry itself appears to be fine at first glance..

rename your main.html to main.shtml

If it works then you know the server is setup to allow ssi.


Mark
______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net


------------------------------

Date: Sat, 27 Oct 2001 21:52:06 +0200
From: "Steven Wüthrich" <spam@dsxs.net>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <3bdb1061_1@news.bluewin.ch>


"Mark Taylor" <mtaylor@lrim.com> schrieb im Newsbeitrag
news:Xns9147966BE4AB0mtaylorlrimcom@128.242.171.114...
> "Steven Wüthrich" <spam@dsxs.net> wrote in
> <3bdb0a0c$1_4@news.bluewin.ch>:
>
>
> >
> >oh right... i didnt know this was SSI....
> >but what other entry do i put in my HTML file if not the above??
> >
> >
> >i really only want the script to start, which then prints the message...
> >how to i call the script from within the main.html??
> >
> >regards, steven
> >
> >
> >
>
> The entry itself appears to be fine at first glance..
>
> rename your main.html to main.shtml
>
> If it works then you know the server is setup to allow ssi.
>
>
> Mark


yes, ive changed the file to shtml already... it works. that means the
shtml is printed, so my host supports SSI, right??

but the hello there is still not being displayed




------------------------------

Date: 27 Oct 2001 14:40:34 -0500
From: mtaylor@lrim.com (Mark Taylor)
Subject: Re: how to set up a CGI on my webpage
Message-Id: <Xns9147978D1D6D8mtaylorlrimcom@128.242.171.114>

mtaylor@lrim.com (Mark Taylor) wrote in
<Xns9147966BE4AB0mtaylorlrimcom@128.242.171.114>: 

>"Steven Wüthrich" <spam@dsxs.net> wrote in
><3bdb0a0c$1_4@news.bluewin.ch>: 
>
>
>>
>>oh right... i didnt know this was SSI....
>>but what other entry do i put in my HTML file if not the above??
>>
>>
>>i really only want the script to start, which then prints the
>>message... how to i call the script from within the main.html??
>>
>>regards, steven
>>
>>
>>
>
>The entry itself appears to be fine at first glance..
>

After another glance your ssi line needs a space in it I think...

<!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi"-->

needs a space after counter.cgi" so it reads...

<!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi" -->



Mark
______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net


------------------------------

Date: 27 Oct 2001 14:55:36 -0500
From: mtaylor@lrim.com (Mark Taylor)
Subject: Re: how to set up a CGI on my webpage
Message-Id: <Xns91479A1A42A08mtaylorlrimcom@128.242.171.114>

"Steven Wüthrich" <spam@dsxs.net> wrote in <3bdb1061_1@news.bluewin.ch>:

>
>"Mark Taylor" <mtaylor@lrim.com> schrieb im Newsbeitrag
>news:Xns9147966BE4AB0mtaylorlrimcom@128.242.171.114...
>> "Steven Wüthrich" <spam@dsxs.net> wrote in
>> <3bdb0a0c$1_4@news.bluewin.ch>:
>>
>>
>> >
>> >
>> >
>>
>
>yes, ive changed the file to shtml already... it works. that means the
>shtml is printed, so my host supports SSI, right??
>
>but the hello there is still not being displayed
>
>

Have you shifted gears again?

<!--#exec cgi="/htdocs/www/cgi-bin/counter.cgi" -->

Should do what ever counter.cgi is designed to do.

If....

#!/bin/perl
print "Content-type:text/html\n\n";
print "Hello World!<BR>\n";

is saved as "hello.cgi" and 

<!--#exec cgi="/htdocs/www/cgi-bin/hello.cgi" -->

is in your main.shtml file the "Hello World!" should print in the browser 
in the location where the line above is at.


And maybe any further should be done in email or in 
comp.infosystems.www.authoring.cgi so as not to further annoy the die hard 
perl mongers...


Cheers,
Mark
______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net


------------------------------

Date: Sat, 27 Oct 2001 13:16:29 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <3BDB161D.BD1F4574@vpservices.com>

Mark Taylor wrote:
> 
> And maybe any further should be done in email or in
> comp.infosystems.www.authoring.cgi so as not to further annoy the die hard
> perl mongers...

Thank you, yes.  And the other two reasons that is appropriate are 1) so
that Steven can learn to distinguish which problems relate to which
parts of the technology and 2) so that the issue is discussed where
people who know about it hang out.  Perhaps Mark is correct in all he
says and knows everything about cgi authoring but on the off chance that
isn't the case, then Steven is better off going to a newsgroup where
people capabable of improving on or adding to Mark's advice are to be
found.

-- 
Jeff



------------------------------

Date: Sat, 27 Oct 2001 22:24:06 +0200
From: "Steven Wüthrich" <spam@dsxs.net>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <3bdb17e0$1_1@news.bluewin.ch>


"Mark Taylor" <mtaylor@lrim.com> schrieb im Newsbeitrag
news:Xns91479A1A42A08mtaylorlrimcom@128.242.171.114...
> "Steven Wüthrich" <spam@dsxs.net> wrote in <3bdb1061_1@news.bluewin.ch>:


Okay, as you said im not gonna post anymore...



Thanks already for your help.

Loads of people replied, iin all kinds of groups, but not

All of them were patient enough..



Anyway, I think im near it now.



Before, when I tried to run the script www.dsxs.net/cgi-bin/hello.cgi

It said something about a header problem or so.. now it only prints

The hello world! Thingy. that's already quite good, isn't it?? So its
working!!



But I just don't succeed in putting it on the website!! Its just not there!!

Do you think it might be something wrong with the path??

à      http://www.kontent.de/support/perl.phtml



thank you, steven







------------------------------

Date: Sat, 27 Oct 2001 22:25:00 +0200
From: "Steven Wüthrich" <spam@dsxs.net>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <3bdb1816$1_1@news.bluewin.ch>


"Jeff Zucker" <jeff@vpservices.com> schrieb im Newsbeitrag
news:3BDB161D.BD1F4574@vpservices.com...
> Mark Taylor wrote:
> >
> > And maybe any further should be done in email or in
> > comp.infosystems.www.authoring.cgi so as not to further annoy the die
hard
> > perl mongers...
>
> Thank you, yes.  And the other two reasons that is appropriate are 1) so
> that Steven can learn to distinguish which problems relate to which
> parts of the technology and 2) so that the issue is discussed where
> people who know about it hang out.  Perhaps Mark is correct in all he
> says and knows everything about cgi authoring but on the off chance that
> isn't the case, then Steven is better off going to a newsgroup where
> people capabable of improving on or adding to Mark's advice are to be
> found.
>
> --
> Jeff
>

you got it!! im off




------------------------------

Date: Sat, 27 Oct 2001 14:13:21 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: how to set up a CGI on my webpage
Message-Id: <3BDB2371.DE3B56E1@vpservices.com>

"Steven Wüthrich" wrote:
> 
> you got it!! im off

Thanks!  But do come back for your perl problems, we're glad to help
with those :-)

-- 
Jeff



------------------------------

Date: Sat, 27 Oct 2001 18:07:27 GMT
From: Louis LeBlanc <leblanc@keyslapper.nospam.org>
Subject: multiple tag replacement within a string
Message-Id: <20011027140852.A27818@keyslapper.org>

Hey all.  I have a string tag substitution question.
I have a string, defined from a config.  This string can have a number 
of tags like _DATE_ _SERVER_ etc.  I have 8 defined in all.  For each 
tag, there is an internal variable.  If that variable is defined, I 
want to replace the tag with that value, or else I want to replace it 
with the word 'unavailable'.

So far, I have done the following:
    if (defined $not_found)
    {
      if (defined $date) $not_found =~ s/_DATE_/$date/g;
      else $not_found =~ s/_DATE_/unavailable/g;

      if (defined $server_admin) $not_found =~ s/_ADMIN_/$server_admin/g;
      else $not_found =~ s/_ADMIN_/unavailable/g;

      # Etc., . . .
    }

Which looks a little cumbersome.  Especially when you see al 8 tags 
replaced.  Any ideas on how to make this more elegant and, hopefully,
more efficient?

TIA & HAND
Lou
-- 
To e-mail me for *legitimate* purposes, remove 'nospam',
otherwise post replies to the NG!  If I need help here,
I should darn well be willing to come back for it, right?

Clothes make the man.  Naked people have little or no influence on society.
    -- Mark Twain


------------------------------

Date: Sat, 27 Oct 2001 13:30:03 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: multiple tag replacement within a string
Message-Id: <3BDB194B.85292F5B@vpservices.com>

Louis LeBlanc wrote:
> 
> So far, I have done the following:
>     if (defined $not_found)
>     {
>       if (defined $date) $not_found =~ s/_DATE_/$date/g;
>       else $not_found =~ s/_DATE_/unavailable/g;
> 
>       if (defined $server_admin) $not_found =~ s/_ADMIN_/$server_admin/g;
>       else $not_found =~ s/_ADMIN_/unavailable/g;
> 
>       # Etc., . . .
>     }
> 
> Which looks a little cumbersome.  Especially when you see al 8 tags
> replaced.  Any ideas on how to make this more elegant and, hopefully,
> more efficient?

Use the hash Luke!  Instead of variables called $date and $server_admin,
have one hash key called configs with keys for those:

my %configs = (
   DATE    => $date,
   S_ADMIN => $server_admin,
   # ... other values
);
my %config_string;
if (defined $not_found) {
   for my $key(keys %configs) { 
        $config_string{$key} = $config{$key} or 'unavailable';
        $not_found =~ s/_${key}_/$config_string{$key}/g;
   }
}

That should replace all of them at once.



------------------------------

Date: Sat, 27 Oct 2001 18:10:59 GMT
From: "Devon Perez" <hoss@chungk.com>
Subject: need help with files
Message-Id: <TMCC7.1002531$si5.17565671@typhoon.kc.rr.com>

how do i make it so that my program can look in a directory and see if a
specific file already exists?

thanks






------------------------------

Date: Sat, 27 Oct 2001 11:41:53 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: need help with files
Message-Id: <3bdafff4@news.microsoft.com>


"Devon Perez" <hoss@chungk.com> wrote in message
news:TMCC7.1002531$si5.17565671@typhoon.kc.rr.com...
> how do i make it so that my program can look in a directory and see if a
> specific file already exists?

if (-e $myfile) {
    print "File $myfile exists\n";
    } else {
    print "File $myfile does not exist\n";
}

You may also want to check if $myfile is a plain file or directory or
symlink or ....
Further details please see "perldoc -f  -e"

jue




------------------------------

Date: Sat, 27 Oct 2001 17:01:52 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: need help
Message-Id: <GLvJB4.17s@presby.edu>

In article <9regt8$1glp$1@news.kabelfoon.nl>,
MAGiC MANiAC^mTo <mto@kabelfoon.nl> wrote:
>
>===code
># Get parameter commands from url...
>@command=split(/&/,$ENV{'QUERY_STRING'});
>$lencommand=@command;
>for($tmp1=0;$tmp1<$lencommand;$tmp1++){
>  @param=split(/=/,$command[$tmp1]);
>  for ($param[0]){s/^\s+//;s/\s+$//} # trim $param[0]
>  if(uc $param[0] eq "SHW"){$param_show=$param[1]}
>}
>===code
>
>Query String is:    id=2&text=hello

Why re-invent the wheel?  Use the CGI.pm module which comes with every 
standard distribution of Perl.  Try this:

use CGI qw/:standard/;

my $ID = param ('id');      # should give $ID the value 2
my $Text = param ('text');  # should give $Text the value 'hello'

As a bonus, this works regardless of whether the data was passed via POST 
or via GET.

Read more about it by typing 'perldoc CGI' at your command-line prompt, or 
by going to <http://www.google.com/> and searching for "CGI.pm tutorial".

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA


------------------------------

Date: Sat, 27 Oct 2001 16:24:09 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Newbie.
Message-Id: <x7pu79yrs8.fsf@home.sysarch.com>

>>>>> "E" == Exodus  <exodus@thisaintreal.com> writes:

  E> Perhaps I've not worken up enough yet - but I don't get it.

first please learn to not top post. put your comments after the edited
parts of posts you quote.

  E> "D L Fleetwood" <dlorraine@bbc.net> wrote in message
  E> news:ttkviaopg7kvea@corp.supernews.com...
  >> "Exodus" <exodus@thisaintreal.com> wrote in message
  >> news:RmuC7.1733$GA.145900@news2-win.server.ntlworld.com...
  >> > Is it OK to post newbie questions to this group?
  >> 
  >> Thus quoth the Usenet Nazis:
  >> 
  >> No Perl for you!

she is some angry person who doesn't seem to like this group having a
culture of proper quoting and other netiquette. ignore her. newbies are
welcomed here. but there are some cultural rules that make it easier for
all (including newbies) to participate. she thinks no rules and total
anarchy is better then a set of traditions and netiquette.

look for a regular post on posting guidelines for this group and read
it. also read the FAQ as much as you can before you post a question. in
general if you do some work before you post and be reasonable in what
and how you ask, you will very likely get help. if you demand answers
and don't lift a finger first, you will more likely to be ignored. she
thinks that is wrong but of course she won't help anyone with anything
but some stupid nazi flames. hmm, i wonder who is more fascist.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


------------------------------

Date: Sat, 27 Oct 2001 16:14:51 GMT
From: "Pujo C A" <adustipujo1@mediaone.net>
Subject: not working
Message-Id: <%3BC7.38369$bK.464038@typhoon.mw.mediaone.net>

I tried that way before but it takes all the word after http:

the result that I want is http://www.yahoo.com/

thanks,

--
Pujo C Agustiyanto
http://www.geocities.com/pujoca
<!-- The richest person in this universe is the person who appreciate what
she/he has-->
"Pujo C A" <adustipujo1@mediaone.net> wrote in message
news:xKxC7.38340$bK.456205@typhoon.mw.mediaone.net...
>
> Does any body know how to do this?
> I want to delete the character from the last / occurence until html
> ex: http://www.yahoo.com/shopping.html
> I want to delete only shopping.html( I mean any number of word after the
> last /)
> I tried this one:
> $url =~s/\w{8}\.html//i;
> but this is too rigid, I want something more flexible.
>
> I appreciate the help so much. Thank you
>
> Pujo C Agustiyanto
> http://www.geocities.com/pujoca
> <!-- The richest person in this universe is the person who appreciate what
> she/he has-->
>
>




------------------------------

Date: 27 Oct 2001 16:47:04 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perl loozer
Message-Id: <9reoe8$8t$2@neptunium.btinternet.com>

Godhead <dp@co.ru> wrote:
> sory huys - i'm lozzer in perl...
> what does it mean
> sub print_content{
>  print <<EOF;
> 
> EOF
> }
> explane me pleace...
> 

The construct :

print <<EOF;

EOF

is discussed in the perlop manpage in some detail.  What you have within
the subroutine is known as a 'here document' it is an idea borrowed from
the Unix shell - it is essentially a form of multiline quoting where the
'<<EOF' is effectively replaced by everything from the next line upto the
line containing the matching tag 'EOF'.  So in this example you will have
a subroutine which prints all of the lines between the print statement and
the EOF (bear in mind that this must always be in the first column).

This construct is not just for print statements but can be used anywhere
an expression can be such as in an assignment or as the argument to a
subroutine so you might equally see things like :

my $foo =<<EO1;
Some stuff
EO1

some_subroutine(<<EO2);
Some more stuff
EO2

You get the picture.  The delimiting tokens can be anything that you want
as long as they match, although it is conventional that they are uppercase
so they are easily distinguished from other names in the program.

Hope that helps.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: 27 Oct 2001 13:10:33 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: perl loozer
Message-Id: <m3pu79nh4m.fsf@mumonkan.sunstarsys.com>

Jonathan Stowe <gellyfish@gellyfish.com> writes:

> The construct :
> 
> print <<EOF;
> 
> EOF
> 
> is discussed in the perlop manpage in some detail.  
                      ^^^^^^

ITYM "perldata" here, but you're right- it probably 
*should* be in perlop.

-- 
Joe Schaefer        "What kills a skunk is the publicity it gives itself."
                                               -- Abraham Lincoln



------------------------------

Date: Sat, 27 Oct 2001 19:29:43 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: perl loozer
Message-Id: <de2mtt4phk2vpt66itvnn0h23phqe9fo7v@4ax.com>

Godhead wrote:

>what does it mean
>sub print_content{
> print <<EOF;
>
>EOF
>}

It's a sub that prints a here-doc. You can find an explanation of
here-docs (or "here-documents", in full) in perldata.

-- 
	Bart.


------------------------------

Date: Sat, 27 Oct 2001 20:42:39 GMT
From: "Devon Perez" <hoss@chungk.com>
Subject: printing html
Message-Id: <3%EC7.331215$ME2.35361430@typhoon.kc.rr.com>

when i try to print a webpage with my script, the quotes from the html
errors up the program, how can i keep it from doing this?

thanks





------------------------------

Date: 27 Oct 2001 15:41:26 -0500
From: mtaylor@lrim.com (Mark Taylor)
Subject: Re: printing html
Message-Id: <Xns9147A1DEFA774mtaylorlrimcom@128.242.171.114>

"Devon Perez" <hoss@chungk.com> wrote in 
<3%EC7.331215$ME2.35361430@typhoon.kc.rr.com>:

>when i try to print a webpage with my script, the quotes from the html
>errors up the program, how can i keep it from doing this?
>
>thanks
>
>
>

Throwing caution to the wind and risking upsetting Jeff I'll just say....

Escape your quotes within the print lines. As in...


print "<a href=\"http://www.kernel.org\">www.kernel.org</a>\n";



Mark


ps: Sorry Jeff, just had to do it.  :-)

______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net


------------------------------

Date: Sat, 27 Oct 2001 14:08:51 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: printing html
Message-Id: <3BDB2263.1D876A4@vpservices.com>

Mark Taylor wrote:
> 
> Escape your quotes within the print lines. As in...
> 
> print "<a href=\"http://www.kernel.org\">www.kernel.org</a>\n";
> 
> ps: Sorry Jeff, just had to do it.  :-)

No, that's perl answer! It's perfectly relevant here. :-)

I might suggest using either here-docs or the qq operator instead of
backwhacking the quotes though:

print qq ( <a href="http://www.kernel.org">www.kernel.org</a>\n );

OR

print <<END_OF_HTML;
    <a href="http://www.kernel.org">www.kernel.org</a>
END_OF_HTML


-- 
Jeff



------------------------------

Date: Sat, 27 Oct 2001 21:17:50 GMT
From: "Devon Perez" <hoss@chungk.com>
Subject: Re: printing html
Message-Id: <2wFC7.1004105$si5.17738955@typhoon.kc.rr.com>

Escape your quotes within the print lines. As in...


print "<a href=\"http://www.kernel.org\">www.kernel.org</a>\n";

do i need to put \ in every link or what?


"Mark Taylor" <mtaylor@lrim.com> wrote in message
news:Xns9147A1DEFA774mtaylorlrimcom@128.242.171.114...
> "Devon Perez" <hoss@chungk.com> wrote in
> <3%EC7.331215$ME2.35361430@typhoon.kc.rr.com>:
>
> >when i try to print a webpage with my script, the quotes from the html
> >errors up the program, how can i keep it from doing this?
> >
> >thanks
> >
> >
> >
>
> Throwing caution to the wind and risking upsetting Jeff I'll just say....
>
> Escape your quotes within the print lines. As in...
>
>
> print "<a href=\"http://www.kernel.org\">www.kernel.org</a>\n";
>
>
>
> Mark
>
>
> ps: Sorry Jeff, just had to do it.  :-)
>
>
____________________________________________________________________________
__
> Posted Via Binaries.net = SPEED+RETENTION+COMPLETION =
http://www.binaries.net




------------------------------

Date: Sat, 27 Oct 2001 16:43:10 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: printing html
Message-Id: <87adycpxn5.fsf@limey.hpcc.uh.edu>

>> On Sat, 27 Oct 2001 20:42:39 GMT,
>> "Devon Perez" <hoss@chungk.com> said:

> when i try to print a webpage with my script, the quotes
> from the html errors up the program, how can i keep it

"error" is a verb??

> from doing this?

CGI.pm has shortcuts (to differentiate this answer from
here-docs and q() answers).

    print a({href => 'http://www.google.com/'}, 'search me!');

What I like about this approach is that it cleanly
separates the way in which perl deals with quoting (as
part of the perl syntax) from the encapsulated generation
of HTML and the way in which /it/ handles quoting.

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


------------------------------

Date: Sat, 27 Oct 2001 23:39:28 +0200
From: "Andreas Winter" <awin@wros.de>
Subject: Q: Proxytest?
Message-Id: <9rf9ha$121$1@news.online.de>

Hello,
is it possible to test a given address with a port for a proxy through a
CGI/Perl-script?

greets
Andreas

p.s. Furthermore use a proxy via CGI/perl?




------------------------------

Date: Sat, 27 Oct 2001 16:45:08 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Q: Proxytest?
Message-Id: <876690pxjv.fsf@limey.hpcc.uh.edu>

>> On Sat, 27 Oct 2001 23:39:28 +0200,
>> "Andreas Winter" <awin@wros.de> said:

> Hello, is it possible to test a given address with a
> port for a proxy through a CGI/Perl-script?

> greets Andreas

> p.s. Furthermore use a proxy via CGI/perl?

  http://search.cpan.org/doc/GAAS/LWP5emu-0.01_01/lib/LWP/UserAgent.pm

      $ua->proxy(...)

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


------------------------------

Date: Sat, 27 Oct 2001 17:10:36 GMT
From: "David Allen" <mda@idatar.com>
Subject: study() question
Message-Id: <gUBC7.2102$hX3.153661@typhoon1.gnilink.net>

Hello,

I've been reading the perldoc for the study() function, and it's not telling
me something I want to know.  Hopefully somebody here knows.  Here's my
question, in perl code.

study($data);
my_function($data);

sub my_function {
  my $string = shift(@_);

  # Is $string studied?
} # End my_function

Strings are pass by value in these functions, so I wouldn't necessarily
expect that it would be studied, because it's not technically the same string
internally in Perl.  (Or is it?)  But what about this:

study($data);
my_function(\$data);

sub my_function {
  my $ref = shift(@_);
  my $string = ${$ref};
  
  # $string is studied here, isn't it?
} # End my_function

-- 
David Allen
http://opop.nols.com/


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 2024
***************************************


home help back first fref pref prev next nref lref last post