[16504] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3916 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 4 14:10:42 2000

Date: Fri, 4 Aug 2000 11:10:20 -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: <965412620-v9-i3916@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 4 Aug 2000     Volume: 9 Number: 3916

Today's topics:
        Graphic in a search results page (David)
    Re: Graphic in a search results page <andras@mortgagestats.com>
    Re: Graphic in a search results page (David)
    Re: Graphic in a search results page <bean@agentkhaki.com>
    Re: How do I send data to another Server ??? classies@my-deja.com
    Re: How do I send data to another Server ??? <care227@attglobal.net>
    Re: How do I send data to another Server ??? <jeff@vpservices.com>
    Re: How to open and append to a file <godzilla@stomp.stomp.tokyo>
        How to print news with NNTP? <yhu@mail.nih.gov>
    Re: How to print news with NNTP? <yhu@mail.nih.gov>
        id and password:the easyiest way <diab.litoNOdiSPAM@usa.net.invalid>
    Re: id and password:the easyiest way <care227@attglobal.net>
    Re: id and password:the easyiest way <bean@agentkhaki.com>
    Re: Impossible RegEx Problem nobull@mail.com
        negative zero? <sternberg@phys.uni-paderborn.de>
    Re: Novice Question: Outputting an existing file nobull@mail.com
    Re: outputting a CGI script to another frame? <mikek@worldwebserver.com>
        perl output to 3 frames... (dps\)
        porting apps from UNIX to Win2000/NT4.0 <jpcrisci@mailnwql.cr.usgs.gov>
        Proxy w/ username/pass validation fperkins@my-deja.com
    Re: Proxy w/ username/pass validation <tony_curtis32@yahoo.com>
    Re: Regexp problem - Stripping HTML <carst@ocean7.com>
    Re: Send Data Received to another Server ???? aaron@preation.com
    Re: Send Data Received to another Server ???? <bkennedy99@home.com>
    Re: Send Data Received to another Server ???? nobull@mail.com
        SSI across servers jkirsch@kirschnet.com
    Re: SSI across servers <care227@attglobal.net>
    Re: Syntax for http request preation@my-deja.com
        syslog on win32? <pc@wherever.com>
    Re: Uhmm... Errr... <bean@agentkhaki.com>
    Re: Uploading images via Perl script nobull@mail.com
    Re: uuuuuuuAaron Kulkis is a Communist B... <jeff@vpservices.com>
    Re: Where is the best spot to flock file in this sub?? <jeff@yoak.com>
    Re: WWWBoard.PL <flavell@mail.cern.ch>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 04 Aug 2000 16:19:14 GMT
From: brooksd@interlog.com (David)
Subject: Graphic in a search results page
Message-Id: <AVBi5.7916$Lg1.143894@cac1.rdr.news.psi.ca>

Hello, all: I was hoping that someone might have some advice.

The truth is I don't really know Perl at all.  I have a search engine on my 
site (www.vangoghgallery.com) and someone else did the coding for me years 
ago.  Well, all I want to do is get a graphic to appear at the top of the 
search results page.  I include the coding below and I was sure that it would 
work, but it doesn't.  No graphic appears.  Can anyone let me know what I'm 
doing wrong?

Many thanks in advance.

David Brooks
www.vangoghgallery.com

brooksd@interlog.com
________________________________________

sub return_html { 
print "Content-type text/html\n\n"; 
print "<html>\n <head>\n<title>Results of Search</title>\n </head>\n"; 
print "<body><div align=center><center><a 
href="&path=/cgi-bin/search.exe&searchstring=Vincent+van+Gogh">http//www.
barewalls.com/cgi-bin/nph-referral.exe?code=VVGG&path=/cgi-bin/search.
exe&searchstring=Vincent+van+Gogh" onMouseOver="(window.status='Vincent van 
Gogh'); return true"><img align=center src="../images/banners/bw_02.gif" 
width="411" height="66" border="2" alt="Barewalls.com - Art Prints and 
Posters"></a></center></div>"
print "<center>\n <h1>Results of Search</h1>\n 
</center>\n";
print "Below are the results of your Search in no particular order<p><hr 
size=7 width=75%><p>\n"; 
print "<ul>\n";
   foreach $key (keys %include) {
      if ($include{$key} eq 'yes') {
         print "<li><a href=\"$baseurl$key\">$titles{$key}</a>";
         print "&nbsp;&nbsp;-&nbsp;&nbsp;";
         print "$key";
      }
   }
   print "</ul>\n";

(etc., etc.)


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

Date: Fri, 04 Aug 2000 13:12:16 -0500
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: Graphic in a search results page
Message-Id: <398B0780.28DF26E2@mortgagestats.com>

Use an absolute URL when you are referencing the image file, i.e., instead of

<img align=center src="../images/banners/bw_02.gif" width="411" height="66"
border="2"alt="Barewalls.com  Art Prints and Posters">

put this:

<img align=center src="http://www.vangoghgallery.com/images/banners/bw_02.gif"
width="411" height="66" border="2"alt="Barewalls.com  Art Prints and Posters">

You see, your search results page is probably coming from your cgi-bin directory,
so the ../ at the beginning of your image URL points to the directory immediately
above that, but your images directory is probably somewhere else.

Andras



David wrote:

> Hello, all: I was hoping that someone might have some advice.
>
> The truth is I don't really know Perl at all.  I have a search engine on my
> site (www.vangoghgallery.com) and someone else did the coding for me years
> ago.  Well, all I want to do is get a graphic to appear at the top of the
> search results page.  I include the coding below and I was sure that it would
> work, but it doesn't.  No graphic appears.  Can anyone let me know what I'm
> doing wrong?
>
> Many thanks in advance.
>
> David Brooks
> www.vangoghgallery.com
>
> brooksd@interlog.com
> ________________________________________
>
> sub return_html {
> print "Content-type text/html\n\n";
> print "<html>\n <head>\n<title>Results of Search</title>\n </head>\n";
> print "<body><div align=center><center><a
> href="&path=/cgi-bin/search.exe&searchstring=Vincent+van+Gogh">http//www.
> barewalls.com/cgi-bin/nph-referral.exe?code=VVGG&path=/cgi-bin/search.
> exe&searchstring=Vincent+van+Gogh" onMouseOver="(window.status='Vincent van
> Gogh'); return true"><img align=center src="../images/banners/bw_02.gif"
> width="411" height="66" border="2" alt="Barewalls.com - Art Prints and
> Posters"></a></center></div>"
> print "<center>\n <h1>Results of Search</h1>\n
> </center>\n";
> print "Below are the results of your Search in no particular order<p><hr
> size=7 width=75%><p>\n";
> print "<ul>\n";
>    foreach $key (keys %include) {
>       if ($include{$key} eq 'yes') {
>          print "<li><a href=\"$baseurl$key\">$titles{$key}</a>";
>          print "&nbsp;&nbsp;-&nbsp;&nbsp;";
>          print "$key";
>       }
>    }
>    print "</ul>\n";
>
> (etc., etc.)



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

Date: Fri, 04 Aug 2000 17:34:04 GMT
From: brooksd@interlog.com (David)
Subject: Re: Graphic in a search results page
Message-Id: <J%Ci5.7919$Lg1.144068@cac1.rdr.news.psi.ca>

Thank you very much for your quick response!

It doesn't work, though.  I followed your suggestion, but the result was the 
same--no graphic appears on the search results page.

David




In article <398B0780.28DF26E2@mortgagestats.com>, Andras Malatinszky 
<andras@mortgagestats.com> wrote:
>Use an absolute URL when you are referencing the image file, i.e., instead of
>
><img align=center src="../images/banners/bw_02.gif" width="411" height="66"
>border="2"alt="Barewalls.com  Art Prints and Posters">
>
>put this:
>
><img align=center src="http://www.vangoghgallery.com/images/banners/bw_02.gif"
>width="411" height="66" border="2"alt="Barewalls.com  Art Prints and Posters">
>
>You see, your search results page is probably coming from your cgi-bin
> directory,
>so the ../ at the beginning of your image URL points to the directory
> immediately
>above that, but your images directory is probably somewhere else.
>
>Andras
>
>
>
>David wrote:
>
>> Hello, all: I was hoping that someone might have some advice.
>>
>> The truth is I don't really know Perl at all.  I have a search engine on my
>> site (www.vangoghgallery.com) and someone else did the coding for me years
>> ago.  Well, all I want to do is get a graphic to appear at the top of the
>> search results page.  I include the coding below and I was sure that it would
>> work, but it doesn't.  No graphic appears.  Can anyone let me know what I'm
>> doing wrong?
>>
>> Many thanks in advance.
>>
>> David Brooks
>> www.vangoghgallery.com
>>
>> brooksd@interlog.com
>> ________________________________________
>>
>> sub return_html {
>> print "Content-type text/html\n\n";
>> print "<html>\n <head>\n<title>Results of Search</title>\n </head>\n";
>> print "<body><div align=center><center><a
>> href="&path=/cgi-bin/search.exe&searchstring=Vincent+van+Gogh">http//www.
>> barewalls.com/cgi-bin/nph-referral.exe?code=VVGG&path=/cgi-bin/search.
>> exe&searchstring=Vincent+van+Gogh" onMouseOver="(window.status='Vincent van
>> Gogh'); return true"><img align=center src="../images/banners/bw_02.gif"
>> width="411" height="66" border="2" alt="Barewalls.com - Art Prints and
>> Posters"></a></center></div>"
>> print "<center>\n <h1>Results of Search</h1>\n
>> </center>\n";
>> print "Below are the results of your Search in no particular order<p><hr
>> size=7 width=75%><p>\n";
>> print "<ul>\n";
>>    foreach $key (keys %include) {
>>       if ($include{$key} eq 'yes') {
>>          print "<li><a href=\"$baseurl$key\">$titles{$key}</a>";
>>          print "&nbsp;&nbsp;-&nbsp;&nbsp;";
>>          print "$key";
>>       }
>>    }
>>    print "</ul>\n";
>>
>> (etc., etc.)
>


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

Date: 04 Aug 2000 13:43:10 EDT
From: bean <bean@agentkhaki.com>
Subject: Re: Graphic in a search results page
Message-Id: <MPG.13f4c8746b1c3134989689@news.concentric.net>

> Gogh'); return true"><img align=center src="../images/banners/bw_02.gif" 
> width="411" height="66" border="2" alt="Barewalls.com - Art Prints and 
> Posters"></a></center></div>"

I actually think that the problem lies in your code. There should be a 
"\" (minus quotes) before each of your " " " (ie, each open and close 
quote) you're printing out. 

For example, your code should probably go:

*snip*

<img align=center src=\"../images/banners/bw_02.gif\"> width=\"411\" 
height=\"66\" border=\"2\" alt=\"Barewalls.com - Art Prints and Posters
\">

*snip*

Much like your original programmer did here:

*snip*

> print "<li><a href=\"$baseurl$key\">$titles{$key}</a>";

*snip*

I think you'll find your results much more pleasing. 

bean




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

Date: Fri, 04 Aug 2000 15:16:09 GMT
From: classies@my-deja.com
Subject: Re: How do I send data to another Server ???
Message-Id: <8memnh$rl2$1@nnrp1.deja.com>

Sorry for typing my qeustions wrong, but I tought this is researching
what i am doing.

I have the books and got to get to know some basics of Perl.

I am new to perl.

I got my Form on my HTML Page to send the information to the Webserver.

I got the Perlscript to process that values or information and send it
back to the HTML Page.

All this works and I understand this.

I just dont understand how to send these values to another Server, the
books dont say much and i dont know what to search for.

So this is why I reasearch here by asking some questions with the hope
that there are people that had to go through the same process and know
what its like to learn the hard way, that would not mind to just give
you some type of hint on what to look for or what function to use,
instead of critisising other peoples questions.

In article <398AD11D.713163D1@attglobal.net>,
  Drew Simonis <care227@attglobal.net> wrote:
> hugo.b@derivs.com wrote:
> >
> > Hi.
> >
> > I need to send some stringvalues to another server for calculation
and
> > then receive them back to send it to the HTML Page.
> >
> > Any help on how to do this in my Perl Script ???
> >
>
> Since it looks like you are going to post this over and over
> again until you get an answer, I'll give you a hint.  Your
> approach is all wrong.  What you should be posting is something
> like this:
>
> :I am trying to send data to a process on another system, and
> :then receive the output from that process, subsequently
> :generating an HTML page for display.  I've tried ... (insert
> :what you've tried)
> :
> :Can anyone give me a pointer as to what I might be doing wrong?
>
> You see, folks aren't here to offer free consulting, but they
> are often glad to offer free assistance.  You need to show that
> you've tried, put forth some effort, researched a bit, etc.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 04 Aug 2000 11:42:51 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: How do I send data to another Server ???
Message-Id: <398AE47B.8254EE67@attglobal.net>

classies@my-deja.com wrote:
> 
> So this is why I reasearch here by asking some questions with the hope
> that there are people that had to go through the same process and know
> what its like to learn the hard way, that would not mind to just give
> you some type of hint on what to look for or what function to use,
> instead of critisising other peoples questions.

If indeed others have gone through this problem before (which 
many have), wouldn't you be best served by searching the archives
of this group at a place like... oh, I don't know... deja?


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

Date: Fri, 04 Aug 2000 09:29:44 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do I send data to another Server ???
Message-Id: <398AEF78.968091AA@vpservices.com>

hugo.b@derivs.com wrote:
> 
> I need to send some stringvalues to another server for calculation and
> then receive them back to send it to the HTML Page.

Translated into technical language, that questions becomes "I need to
send some stringvalues to a glurrble and recieve them back and send it
to the HTML Page."  If we knew what a "glurrble" is, we could offer some
advice.

Guessing at some possible values for glurrble -- if glurrble is a
database application on another machine, look into DBI and DBI::Proxy;
if glurrble is a CGI script on another machine, look into LWP; if
glurrble is something else, look into IPC or or go ask on
alt.glurrbles.misc about how to talk to glurrbles.  Once you find out
how to talk to your glurrble, if you're having trouble doing that in
Perl, come back and tell us what you've tried.

(DBI and LWP are Perl modules, see http://search.cpan.org/ for more
info. IPC is a series of Perl functions dealing with Inter Process
Communications, see the Perl docs for more info).

-- 
Jeff


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

Date: Fri, 04 Aug 2000 09:13:17 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How to open and append to a file
Message-Id: <398AEB9D.7BE54B0C@stomp.stomp.tokyo>

Chris Stone wrote:

> Godzilla! wrote:
 
> > You will learn most of your programming by actually writing programs.
> > Trial and Error is a fabulous teacher. Use pragma hints for awhile,
> > if you think they will help. Stop using pragma hints as soon as possible.
> > Pragma hints can lead to stagnation in programming techniques and usually
> > lead to very mediocre programmers. Only imaginative critical thinkers
> > become great programmers. Pragma hints will not do this for you.
> 
> Trial and error is definitely the best way to learn, in fact it's about the
> only way I learn how to do anything, just doing it over and over till I get
> it right. BTW, you lost me with term "pragma hint" what are these? They
> sound bad.

OH... pragma hints are those stupid things, " -w " "use strict" taint check
and so forth. Sissified Geek stuff. My experience, least for the type of
imaginative programs I write, pragma hints cause more problems than resolve. 
Pragma hints are pretty buggy. It is not uncommon for pragma hints to
crash a script rather than help a programmer.
 
> > FORTRAN and Turbo Pascal is my background.
 
> Just out of couriosity, are you in the programing proffesion, or the
> teaching proffesion?

I am a retired hooker with a college degree.
A college degree is a great investment of
your time but won't always earn you lots
and lots and lots of money.
 
 
> > For a challenge, this script of mine will
> > print each time a person enters for the first
> > time. This can be changed with a bit of
> > creativity, such as adding a hidden field
> > to your form action, a control.

> > NAME="Control" VALUE="control"....

> > if ($in{Control})
> >  { well... do the right thing here... print? }
 
> I'm not sure exactly what you're trying to do here

You'll figure it. Logic is this:

If a new arrival, print old guestbook entries to screen
but do not print empty entries, do not open and write to
log. This barebones script I posted will print regardless
if there are entries or not upon new arrival. Some control
needs to be incorporated. Some use a referral variable. A
hidden field control is more reliable. Upon new entry, you
don't want a write nor empty entries printed.

 
> > Oh yes, before I forget, don't bother
> > with file locking. Are you really
> > expecting millions of hits per day?
> > You will have better luck being struck
> > by lightning than having two visitors
> > make entries at the precise same moment.
 
> Hehe, I'll be lucky to get two visitors in a single day, and I doubt either
> of them would be kind enough to sign my guestbook <g>

Yep. Realistic attitude. Most here will scream at you for not
using file lock although you have zero need to use lock. Most
here don't know there are some safeguards built into Unix/Apache
operating systems which help to prevent double write corruption.

 
> > As your skills mature, not so much in
> > programming but rather in dealing with
> > Life, you will discover women are quite
> > talented in many ways, especially in
> > employing our feminine instincts,
> > such as our inherent fickle nature,
> > to.. hmm... take care of business.
 
> You kind of lost me right about here

I wouldn't be much of a woman if you understood me.

 
> Some questions regarding your script:
 
> > # FULL PATH NAME FOR YOUR LOG FILE:

> >   $log_path = "/var/ftp/home/...etc ...etc /gbentries.log";
 
> should i put anything in this file to begin with, or will it
> create itself, or should it just be blank?

You will need to create this file and upload. Blank should be
ok with +< read and write. If you ever have problems under
similar circumstances, with html prints, use an html comment,

<!-- initialize --> 

to initialize an empty file. Your program can delete this
upon first use, then print your html entry stuff. Usually
a blank file is not a problem if you call for both read
and write. Your write call will hold it open for you.

Do consider using a full internal path name by habit.
This is the best way. You won't go wrong.


> > ## OPEN OLD ENTRIES LOG FILE:

> >   open (GBENTRIES, "+<$log_path"); ## add error check
> 
> what does "+<" do? is it similar to ">>" and ">" functions?

This +< is READ and WRITE. In this case, the write wipes
your file clean and writes. Another +<< will READ and
APPEND to your file. You cannot use these though to
create a new file like you can >> and > both of which
will create a new file automatically, on most servers.

 
> > ## PUSH NEW ENTRY INTO WORKING ARRAY:

> >   push (@Gbentries, $new_entry);
 
> What does push do? Sounds useful

Research PUSH, POP, SHIFT and UNSHIFT. There is
a trick built into my use of push to give you
a challenge in printing. These are easy ways
to manipulate an array; push things in, pop
things out, this kinda stuff.

 
> Thanks again for the code, I'm gonna try and work from it
> and someday maybe end up with a script of my own. Sad thing
> is it probably won't get more then 10 hits. But then that's
> not really the point, I just want to figure out how this stuff
> works.

I periodically post nude pictures of myself and nude pictures
of my boyfriend. He usually draws more visitors than my big
butt. He is an older amateur boxer literally.. umm.. well,
he reminds people of a Clydesdale Horse. My hits usually 
jump two-hundred percent when word is out "New nude pictures!"

Some of my regular visitors, good friends, will send me personal
nude pictures to use as random backgrounds which change with each
click of a submit button. This is fun. This is especially true
of a girlfriend down in Miami, Florida. She likes to dress up
like a belly dancer with see through skimpies.

Godzilla!

--
Alturus 5, Gamma Sector, Perl Manglers:
  http://la.znet.com/~callgirl/webchat/nph-chahta.cgi


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

Date: Fri, 04 Aug 2000 12:16:44 -0400
From: Ying Hu <yhu@mail.nih.gov>
Subject: How to print news with NNTP?
Message-Id: <398AEC6C.AD82EE0C@mail.nih.gov>

Hi,
@lines seems an array? How to print it? Thanks
Ying

 $server = Net::NNTP->new("news")
  or die "Can't connect to news server:$@ $!\n";
 ($narticles, $first, $last, $name) =
$server->group("comp.lang.perl.misc")
  or die "Can't select comp.lang.perl.misc\n";
 foreach $megid ($first..$last){
  @lines = $server -> body($megid);
  unless (defined @lines ){
   warn "$id ... :(\n";
   next;
  }
  foreach $line (@lines){
   print "$line\n";
  }
 }




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

Date: Fri, 04 Aug 2000 12:36:35 -0400
From: Ying Hu <yhu@mail.nih.gov>
Subject: Re: How to print news with NNTP?
Message-Id: <398AF113.E475AD56@mail.nih.gov>



Ying Hu wrote:

> Hi,
> @lines seems an array? How to print it? Thanks
> Ying
>
>  $server = Net::NNTP->new("news")
>   or die "Can't connect to news server:$@ $!\n";
>  ($narticles, $first, $last, $name) =
> $server->group("comp.lang.perl.misc")
>   or die "Can't select comp.lang.perl.misc\n";
>  foreach $megid ($first..$last){
>   @lines = $server -> body($megid);
>   unless (defined @lines ){
>    warn "$id ... :(\n";
>    next;
>   }
>   foreach $line (@lines){
>    print "$line\n";

        foreach $l (@$line){
            print $l . "\n";
        }

        Do you have a simple method?

>
>   }
>  }



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

Date: Fri, 04 Aug 2000 08:47:10 -0700
From: Diablito <diab.litoNOdiSPAM@usa.net.invalid>
Subject: id and password:the easyiest way
Message-Id: <101c7bbc.9dd8cc85@usw-ex0105-035.remarq.com>

I am about a newbie to Perl programming and I need a simple and
effective system to store and call id and passwords of a site's
users.I am thinking in a txt file like this:

id#1
password#1
id#2
password#2
id#3
password#3

Is it a good way or is there something better I could do?
Also I am wondering how can a user change his password with this
system,should the program copy and rewrite the whole file?
I am reading the "Learning Perl" book and it talks about a DBM
database,is it difficult to use for a newbie?

thanks anyone,
Mario


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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: Fri, 04 Aug 2000 12:05:42 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: id and password:the easyiest way
Message-Id: <398AE9D6.BB1F398@attglobal.net>

Diablito wrote:
> 
> I am about a newbie to Perl programming and I need a simple and
> effective system to store and call id and passwords of a site's
> users.I am thinking in a txt file like this:
> 
> id#1
> password#1
> id#2
> password#2
> id#3
> password#3

I'd do 

id:password
id:password
 .
 .
 .

But thats just me, I don't think its a big deal.  I do, however
want to caution you against storing these files in a plain text
way.  I suggest using _at_least_ the crypt() function to provide
some level of protection.  Then you can compare the crypt()ed 
passwords and get the same effect.  Much like UNIX does for your
logon password.  

> Is it a good way or is there something better I could do?
> Also I am wondering how can a user change his password with this
> system,should the program copy and rewrite the whole file?

A simple regular expression to search and replace upon confirmation 
of the entered value.


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

Date: 04 Aug 2000 12:25:59 EDT
From: bean <bean@agentkhaki.com>
Subject: Re: id and password:the easyiest way
Message-Id: <MPG.13f4b661f4351622989688@news.concentric.net>

> id#1
> password#1
> id#2
> password#2
> id#3
> password#3

If you're going to go this route, you might want to print id#1 and 
username#1 on the same line, separated by, say a "::" (minus quotes). 

As far as the dbm file goes, I'm also a newbie, and doing pretty much 
the same thing. I did as follows:

# you might want to process the username and password first to make sure 
they don't contain any !@#$%^... etc. 

dbmopen(%auth_users, "auth_users", 0666);

%temp_users = ($username, $password);

# I think you can eliminate the next line and go change the line after 
that to %auth_users = (%auth_users, %temp_users); but I'm not sure.

%old_users = %auth_users;

%auth_users = (%old_users, %temp_users);

dbmclose (%auth_users);

Since a DBM file is simply an associative array, you now have your 
password associated to your username, makes everything nice and easy to 
deal with, and very easy to check and make sure that two people don't 
have the same username, etc. 

Good luck. 

bean


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

Date: 04 Aug 2000 17:45:18 +0100
From: nobull@mail.com
Subject: Re: Impossible RegEx Problem
Message-Id: <u9k8dxt1pd.fsf@wcl-l.bham.ac.uk>

"Earthlink News" <rickysregistration@hotmail.com> writes:

> # In Perl script:
> # name of variable
> $p = 'parameter';
> # $$p is the same as $parameter (used elsewhere in the script)
> $$p = '"s%Rick%Rick is $cool%g"';

You $p is a symbolic reference.  You probably should re-write your
code to avoid symbolic references.

> I think I'm somewhat to blame for the confusion because I forgot to mention
> that the code I was including was just pseudo-code, and not actual
> executable code, in order to explain what I was trying to do.

Always a good way to make enemies arround here!

> But here is where the problems start; I've tried different combinations of
> evals and /e's (I'm including a couple below) but none seem to work.  The
> result I'd like is for $doc == 'Rick is one cool cat' but I keep getting
> $doc == 'Rick' no matter which of the following I try:
> 
> # Check:
> # This correctly returns: s%Rick%Rick is one cool cat%g
> print eval($$p);
> 
> # Try different substitutions:
> $doc =~ eval($$p);
> eval($doc =~ $parameter);
> eval($doc =~ eval($parameter));

Close but no cigar.  You want:

eval '$doc =~ ' . eval $$p;

Or if you prefer (and have 5.5 or better):

eval eval $$p for $doc;

Better still if you are doing this in a loop then you should take the
compilation outside the loop.

my $mutator = eval 'sub {' . eval($$p) . '}';
&$mutator for $doc;

Personally I think there's far too many levels of indirection in there.

Why do you have those extra qoutes in the config file?  Would it not
be better to get rid of them and loose one eval everywhere?  After all
the RHS of s/// is subject to string interpolation anyhow.

my $mutator = eval "sub {$$p}";
&$mutator for $doc;

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 04 Aug 2000 19:15:21 +0200
From: Michael Sternberg <sternberg@phys.uni-paderborn.de>
Subject: negative zero?
Message-Id: <398AFA29.8107CB5F@phys.uni-paderborn.de>

I found that some versions of perl treat zero-valued expressions as '-0'. 
This is strange to look at in scientific computing.  How can I change the
way this is handled?

Consider this test program:

    @a = (0, -1, -0);
    for (@a) { $_ *= 0; }
    print -$x, "\t (@a) \t perl $]\t$^O\n";

Here's the output for several platforms:

    0        (0 -0 0)        perl 5.004     hpux
    -0       (0 -0 0)        perl 5.00404   solaris
    0        (0 0 0)         perl 5.00503   freebsd
    -0       (0 -0 0)        perl 5.00503   linux
    -0       (0 -0 0)        perl 5.006     dec_osf

Note the different behaviour for the two 5.00503 versions.



Regards,
-- 
Michael Sternberg,  Dipl. Phys.          | Uni-GH Paderborn
http://www.phys.uni-paderborn.de/~stern/ | FB6 Theoretische Physik 
phone: +49-(0)5251-60-2329   fax: -3435  | 33098 Paderborn, Germany
"Who disturrrbs me at this time?"  << Zaphod Beeblebrox IV >>	<*>


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

Date: 04 Aug 2000 17:12:40 +0100
From: nobull@mail.com
Subject: Re: Novice Question: Outputting an existing file
Message-Id: <u9n1itt37r.fsf@wcl-l.bham.ac.uk>

"Toni" <trioinfoQUITAESTO@trioinfografia.com> writes:

> I'm a beginner and I've this question

Even as a beginner you should be able to tell that your question is
almost certianly not a Perl one.  Even a novice driver should be able
to distingish if he's having trouble changing gear or following the
roadsigns.

> How can I output an existing html file from my script to the browser? I've
> read about
>  Location: URL
> but it gives me error.

You've written some code and you get an error.  You've probably done
something wrong.  Show us the code and/or the error if you want us to
have a chance of telling you what.


-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 04 Aug 2000 15:55:17 GMT
From: "Mike King @work" <mikek@worldwebserver.com>
Subject: Re: outputting a CGI script to another frame?
Message-Id: <398AE76F.E1A97F2@worldwebserver.com>



Jonathan Stowe wrote:
> 
> On Thu, 03 Aug 2000 00:22:53 GMT j555@my-deja.com wrote:
> > Hi,
> > I've got a search mechanism in one frame (a form)
> > and I'd like its output to go to another frame.

<FORM action="your_cgi_script.pl" target="your_frame_name">


-Mike K.


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

Date: Fri, 4 Aug 2000 16:53:12 +0100
From: "Matthew Augier \(dps\)" <Matthew@DPS.uk.com>
Subject: perl output to 3 frames...
Message-Id: <lLBi5.997$pS6.11488@news2-win.server.ntlworld.com>

Ok - I'll admit that I'm new at this! but I'm getting there (see
rhocar.port5.com - I've written a whole perl e-card system!) but I might of
bitten off more than I can chew for my next problem...

I would like a perl script that creates three frames then outputs it to it -
creating the frames is not a problem but how on earth do you then pump out the
text to each frame? (well in fact two are static frames and one will be cgi
output)

TIA

Mat




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

Date: Fri, 4 Aug 2000 16:25:35 GMT
From: "John P. Crisci" <jpcrisci@mailnwql.cr.usgs.gov>
Subject: porting apps from UNIX to Win2000/NT4.0
Message-Id: <398AEE7F.3503F830@mailnwql.cr.usgs.gov>

My setup is IIS4.0 on a NT4.0 workstation as a Web development platform
using ActiveState Perl. I am trying to port Gunther Birznieks search
program (from the book "Web Scripts with CGI/Perl") from Solaris UNIX to
Microsoft NT4.0. It works great on Solaris.

The problem is in the GetNextEntry subroutine. I am not getting any
errors - it just skips this subroutine and returns no data - even though
I know it should. I can't figure out how it is behaving differently on
NT. The program is fairly long for a news group and I hesitate to
include it. If someone can offer any general type solutions, I would
really appreciate it. If I get any requests to add the program, I will
resend this E-Mail.

Here is the subroutine. I can't find out anything about the readdir
function. Maybe that's the problem. When I walk thorugh it with the perl
debugger, I don't see any passed arguments

sub GetNextEntry {
    local($dirhandle, $directory) = @_;

    while ($filename = readdir($dirhandle)) {
	if (($filename =~ /htm.?/i) ||
	    (!($filename =~ /^\.\.?$/) &&
	     -d "$directory/$filename")) {
	    last;
	} # End of IF Filename is html document or a directory
    } # End of while still stuff to read

# Filename will be valid if it is a directory or an HTML file.
    $filename;

} # End of GetNextEntry

TIA 

John


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

Date: Fri, 04 Aug 2000 16:09:28 GMT
From: fperkins@my-deja.com
Subject: Proxy w/ username/pass validation
Message-Id: <8meprj$ubl$1@nnrp1.deja.com>

Ok, I need to post a query string going through our firewall, which
also prompts for a valid USERNAME and PASSWORD.

I understand how to specify a firewall:

  use LWP::UserAgent;
  $ua = new LWP::UserAgent;
  $ua->agent("AgentName/0.1 " . $ua->agent);

  $ua->proxy('http' => 'http://internet.ourfirewall.com:81');

  # Create a request
  my $req = new HTTP::Request POST => 'http://www.server.com/test.cgi';
  $req->content_type('application/x-www-form-urlencoded');
  $req->content('match=www&errors=0');

However, how can I specify that this request must be authenticated by a
valid username and pass?  I checked my Perl Cookbook and searched the
forum and Perl FAQ but couldnt find anything.
I guess im looking for someway to specify:

<made up code>
  $ua->authenticate('username' => 'myid');
  $ua->authenticate('password' => 'mypassword');
</made up code>

Thanks in advance,

Frank



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 04 Aug 2000 11:29:44 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Proxy w/ username/pass validation
Message-Id: <87bsz9gfbb.fsf@limey.hpcc.uh.edu>

>> On Fri, 04 Aug 2000 16:09:28 GMT,
>> fperkins@my-deja.com said:

> Ok, I need to post a query string going through our
> firewall, which also prompts for a valid USERNAME and
> PASSWORD.

> I understand how to specify a firewall:
> ...
> However, how can I specify that this request must be
> authenticated by a valid username and pass?  I checked
> my Perl Cookbook and searched the forum and Perl FAQ but
> couldnt find anything.  I guess im looking for someway
> to specify:

perldoc LWP::UserAgent

lists the method get_basic_credentials() which it appears
you need to sub-class in some way.

If you have the credentials in the code (which may not be
a good idea!)  you could probably just sub-class
LWP::UserAgent and rewrite get_basic_credentials() as

    sub get_basic_credentials { ('username', 'password') }

(untested)

LWP::UserAgent suggests looking at lwp-request, which
shows how to sub-class LWP::UserAgent and override
get_basic_credentials() (prompt for input from STDIN in
this case).

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Fri, 04 Aug 2000 13:45:17 -0500
From: "Carsten Heinrigs" <carst@ocean7.com>
Subject: Re: Regexp problem - Stripping HTML
Message-Id: <3jDi5.25439$GS1.620253@news-west.usenetserver.com>

In article <8m9bf0$r06$1@nnrp1.deja.com>, mbutt@my-deja.com wrote:
> I am trying to construct a regular expression to strip certain HTML tags
> out of a string.
> 
> the string $x contains an entire  HTML document. I wan to remove the PHP
> tags from it.
> 
> e.g.
> <?php echo "hello"?><br><h3>blah blah blah</h3><?php echo "good bye"?>
> 
> using the regexp s/\<\?.*\?\>// will remove everything. Because it
> matches the first '<?' and the last '?>' without noticing if there are
> any other starting and closing tags in between. How do I get it to
> remove only the php tags and leave behine any HTML in between.
> 
> thank you,
> 	Martin.

s/<\?[^?]*\?>//g
???





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

Date: Fri, 04 Aug 2000 15:04:34 GMT
From: aaron@preation.com
Subject: Re: Send Data Received to another Server ????
Message-Id: <8mem1t$r2v$1@nnrp1.deja.com>

In article <8mdtbm$2da$1@orpheus.gellyfish.com>,
  Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Thu, 03 Aug 2000 16:29:30 GMT hugo.b@derivs.com wrote:
> > How do I send data received from html form to another server using
PERL
> > ???
> >
>
> I dont know about PERL but in Perl ( see perlfaq1 ) one would need to
know
> what protocols are available for communication between the two
servers.  If
> I assume correctly and you are talking about HTTP then you will want
to
> use LWP::UserAgent, but of course you might use NFS,rcp,ssh,SMTP, FTP,
UUCP,
> RPC, RMI, CORBA or any number of the other thousands of protocols that
> enable you to send data from one machine to another.
>

Ok, this is one specific question. I believe the question was about
http, but if not, since you know all of those protocols, please tell me
which one of them is the easiest to use with Apache on a Unix server,
and the same thing on another Unix server an another network, and how I
would do that? thanks for any advice?

Aaron H.
Preation Web Development
CollegeUnited.com


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 04 Aug 2000 15:16:22 GMT
From: "Ben Kennedy" <bkennedy99@home.com>
Subject: Re: Send Data Received to another Server ????
Message-Id: <a7Bi5.80041$A%3.1119019@news1.rdc2.pa.home.com>

> Ok, this is one specific question. I believe the question was about
> http, but if not, since you know all of those protocols, please tell me
> which one of them is the easiest to use with Apache on a Unix server,
> and the same thing on another Unix server an another network, and how I
> would do that? thanks for any advice?

It is easy to write simple TCP client/server applications with the
IO::Socket module.  One perl script would be called by the web user,
assuming you've configured apache CGI correctly.  This script would then
connect using IO::Socket via TCP to a server script on another machine.  The
O'Reilly book "Perl Cookbook" has lots of useful examples about setting up
client and server scripts.

--Ben Kennedy




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

Date: 04 Aug 2000 18:10:10 +0100
From: nobull@mail.com
Subject: Re: Send Data Received to another Server ????
Message-Id: <u9g0olt0jx.fsf@wcl-l.bham.ac.uk>

aaron@preation.com writes:

> Ok, this is one specific question. I believe the question was about
> http, but if not, since you know all of those protocols, please tell me
> which one of them is the easiest to use with Apache on a Unix server,
> and the same thing on another Unix server an another network, and how I
> would do that? thanks for any advice?

If it's truely another network then none of these protocols will
work!

You do not give sufficient information about the application to determine
which would be the most appropriate protocol.  Clearly if one half of
the client/server pair exists and is already using some protocol, say
HTTP, then that's likely to be easiest.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 04 Aug 2000 15:00:49 GMT
From: jkirsch@kirschnet.com
Subject: SSI across servers
Message-Id: <8melqs$r0g$1@nnrp1.deja.com>

Is there a way to do SSI across servers.  I get an 'error processing
directive' error when I use either 'include virtual' or 'exec cgi'.  I
know that the 'include virtual' works locally.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 04 Aug 2000 11:13:10 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: SSI across servers
Message-Id: <398ADD86.4B01AA64@attglobal.net>

jkirsch@kirschnet.com wrote:
> 
> Is there a way to do SSI across servers.  I get an 'error processing
> directive' error when I use either 'include virtual' or 'exec cgi'.  I
> know that the 'include virtual' works locally.
> 

No, and this has nothing to do with Perl.


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

Date: Fri, 04 Aug 2000 14:56:27 GMT
From: preation@my-deja.com
Subject: Re: Syntax for http request
Message-Id: <8melin$ql6$1@nnrp1.deja.com>

In article <8mekfl$psf$1@nnrp1.deja.com>,
  jpalloz@my-deja.com wrote:
> What would be the proper syntax for an http request in a perl script?
>
> Also, is it possible to pass variables to the url being requested by
> the http request?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

For an http request from a perl script use the LWP module from CPAN,
there are several other posts right now about LWP. The most recent
edition of The Perl Journal has a good article using LWP on page 69, so
first check that out if you can. It is real easy to use.

You can pass a html form GET post to a URL when you use the LWP module,
like for instance you could do a get() of the URL
http://www.collegeunited.com/cgi-bin/prodisplay.pl?prod=Dl2333223345 and
the server would take in the information prod=dl23333223345 and process
it, but for anything that contains wierd characters of spaces you'll
have to convert it to ASCII to put in the URL to get it to work like
that.

I don't know of any other ways to do this, but am very interested in
learning if anyone knows. I want to know how to send an HTML form POST
with all values from a PERL program to a server. So help if you can
anyone, thanks a lot.

Aaron Houghton
Preation Web Development
CollegeUnited.com


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 4 Aug 2000 23:14:22 +0800
From: "news.wiredcity.com.au" <pc@wherever.com>
Subject: syslog on win32?
Message-Id: <k5Bi5.69666$N4.1911546@ozemail.com.au>

Hi

I am running a syslog deamon on a win2k box that logs all entires to ODBC. I
have some admin scripts that generate logs and I'd like to have them logged
to the syslog server as well so that they go to the database as well.

I'm using the latest build of perl from Activestate but the sys::syslog
module seems to be unix only.

Is there a module or library available that allows a perl script running on
Win32 to log to a syslog server?

thanks

Paul




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

Date: 04 Aug 2000 12:09:08 EDT
From: bean <bean@agentkhaki.com>
Subject: Re: Uhmm... Errr...
Message-Id: <MPG.13f4b268d6a5040989687@news.concentric.net>

> I'll forward him a copy of this posting in case he still needs material.

Thank you.

> If he's willing, the price would only be having your work publicly (but
> anonymously) picked apart.

No problem. None at all.

Thanks again. 

bean


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

Date: 04 Aug 2000 17:16:41 +0100
From: nobull@mail.com
Subject: Re: Uploading images via Perl script
Message-Id: <u9lmydt312.fsf@wcl-l.bham.ac.uk>

oliver.arend@gmx.de writes:

> I guess you've seen the possibility to upload images onto a server via
> a Perl script, e.g. in a discussion forum. 

Are you talking about a Perl script to implement the client side or
the server side of this transaction?

What protocols are involved?  HTTP?  NNTP?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 04 Aug 2000 09:01:52 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: uuuuuuuAaron Kulkis is a Communist B...
Message-Id: <398AE8F0.7F3B22BB@vpservices.com>



No User wrote:

You know what, &)(&*)*head, I can take your annonymity, and I can take
your off-topicality, and I can take your vulgarity, but the *n* word in
your cc list (alt.flame.n) makes me want to puke.  Go pedal your racist
crap to someone who wants to hear it.

-- 
Jeff


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

Date: Fri, 04 Aug 2000 11:42:55 -0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: Where is the best spot to flock file in this sub??
Message-Id: <8mersl02mdi@news2.newsguy.com>

In article <398A93EC.C5DD3B65@sympac.com.au>, Scott Laughton
<scotnet@sympac.com.au> wrote:
> Hi there,

Hi! 

> Now, with the structure of the above sub, if the file "file.txt" gets
> updated between the part where it checks the input and the part where it
> saves the updated array @file back to the "file.txt" It could still end
> up with the same entry going in twice.

Yeah.  You're going to run into trouble so long as you are opening twice. 
If that works at all, it is at least closing the filehandle from the first
open so it can reopen it with the new directive and you'll loose any lock.
 You need one open and then an immediate lock.  The right file mode will
be '+<'.  Open it that way and then lock.  When you are done reading, seek
to the beginning of the file and do your writing.  When you are done with
that, since the file may be shorter than it used to be, you'll need to
truncate the file at the point where the file pointer is located.  For all
of this, perldoc -f on the following:

flock 
seek 
tell 
truncate

That should get the job done.  Good luck.

Cheers, Jeff



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

Date: Fri, 4 Aug 2000 17:39:31 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: WWWBoard.PL
Message-Id: <Pine.GHP.4.21.0008041653200.13101-100000@hpplus03.cern.ch>

On 3 Aug 2000, Jonathan Stowe wrote:

> Of course even if the program did implement correct locking to prevent
> two instances from messing with the data simultaneously, because it
> writes directly to a file that will be used by another program, the web
> server, that is unlikely to partake in any locking scheme it is probable
> that a user will get presented with a partially written file. 

Not if you do things in the right way, and in the right order!

Where a file needs to be updated, the idea is to construct an updated
version in a temporary file, and (when everything else has been made
ready for it) do an atomic renaming of the temporary file in place of
the old one.  The principle is to only take the system through
intermediate states that are valid from the point of view of the
server.  That way, there's no need to lock the system against being
read.

Of course another approach is not to use files as such, but some
kind of database.

> Yeah,
> you're right I cant be arsed to worry about it too much ;-}

I still don't know how good the faq-O-matic _really_ is, but it works
for us, and can be used as a configurable bulletin-board if that's
what you want.  On some platforms it runs sweetly.  On one platform
(digital unix) it's continually sending the webmaster emails, wailing
that the locking system is broken: nevertheless, it gives the
impression of working fine.  I'm sure that none of the faq-O-matics
that I manage are hammered anywhere near as hard as some of the others
that are out there, so I reckon that it must be OK, in spite of some
details about which one might be nervous.

And I don't know how it'll be maintained now that his studies seem to
be completed. 

Mine aren't open to world-wide access, sorry, but see
http://www.dartmouth.edu/~jonh/ff-serve/cache/1.html for the author's
own site (thank goodness that colour scheme isn't mandatory ;-), and
pointers to some generally-accessible faqomatics.



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3916
**************************************


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