[15625] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3038 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 13 18:05:23 2000

Date: Sat, 13 May 2000 15:05:10 -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: <958255509-v9-i3038@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 13 May 2000     Volume: 9 Number: 3038

Today's topics:
    Re: &nbsp - what is it? <makarand_kulkarni@My-Deja.com>
        alarm problem <beaumontsystems@netscapeonline.co.uk>
    Re: Arrays (real easy question probably) <lr@hpl.hp.com>
    Re: Arrays (real easy question probably) (Randal L. Schwartz)
    Re: Clear and then Reuse a package name space richard_chen@my-deja.com
    Re: counter <malverian@hotmail.com>
    Re: counter felrodian@my-deja.com
    Re: counting keys in multi-dimensional hash ref <makarand_kulkarni@My-Deja.com>
        Help with Perl/CGI scripts munazzah@my-deja.com
    Re: Help with Perl/CGI scripts malverian@hotmail.com
    Re: Long insert feilds with ODBC/Access <cory-p@usa.net>
        Looking to purchase an FTP script ... jhalbrook@my-deja.com
        Now serving 15? (How can I setup a small server in perl <malverian@hotmail.com>
    Re: Now serving 15? (How can I setup a small server in  <makarand_kulkarni@My-Deja.com>
    Re: Now serving 15? (How can I setup a small server in  malverian@hotmail.com
    Re: Now serving 15? (How can I setup a small server in  <makarand_kulkarni@My-Deja.com>
    Re: Number of things in an array? <slinberg@crocker.com>
    Re: Number of things in an array? <makarand_kulkarni@My-Deja.com>
        Please Help friend on perl problem <velocity@youreallythinkitsme.com>
    Re: Please Help friend on perl problem (brian d foy)
        Problem with CRLF <aureld@free.fr>
    Re: Problem with CRLF (David Efflandt)
    Re: Problem with server scripting <makarand_kulkarni@My-Deja.com>
        Regular Expressions help malverian@hotmail.com
    Re: Regular Expressions help <tony_curtis32@yahoo.com>
        spoofing identity <*nospam*blah80@hotmail.com>
    Re: spoofing identity <jeff@vpservices.com>
    Re: spoofing identity (David Efflandt)
    Re: Using Net::FTP in a subroutine juump@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 13 May 2000 13:29:47 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: &nbsp - what is it?
Message-Id: <391DBB3B.A71B71E@My-Deja.com>

> &nbsp

not &nbsp
but &nbsp;

This is HTML for space.
 &nbsp; is 1  (non-breaking ) horizontal space;



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

Date: Sat, 13 May 2000 20:18:29 +0100
From: "beaumontsystems" <beaumontsystems@netscapeonline.co.uk>
Subject: alarm problem
Message-Id: <391d9c7a_1@plato.netscapeonline.co.uk>

I am having a problem using alarm().
When I have the line...
  alarm(0);
 ... I get the error message...
"The Unsupported function alarm function is unimplemented at line xxx".
I cant figure out what this means. Ive looked at perldoc -f alarm.
Any ideas/suggestions ?

Andrew Fry





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

Date: Sat, 13 May 2000 10:57:07 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Arrays (real easy question probably)
Message-Id: <MPG.138736f7ac4ef92798aa76@nntp.hpl.hp.com>

In article <lmgT4.5779$rv6.243066@news1-hme0> on Sat, 13 May 2000 
18:32:26 +0100, "Eddie" <oogm_yum spam!_@bigfoot.com> <"Eddie" <oogm_yum 
spam!_@bigfoot.com>> says...
> In perl is it possible to have multi-dimensional arrays and how do you
> access them?
> Is this the right way to access a multi-dimensional array?
> 
>                 @array[4,3]
> 
> And if you can't get multi-dimensional arrays is there a way of emulating
> them?

perldoc perllol

perldoc perldsc

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 13 May 2000 11:14:32 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Arrays (real easy question probably)
Message-Id: <m1og6auxkn.fsf@halfdome.holdit.com>

>>>>> "Eddie" == Eddie  <oogm_yum spam!_@bigfoot.com> writes:

Eddie> In perl is it possible to have multi-dimensional arrays and how do you
Eddie> access them?

That's a compound question where the second part presume the first part
is answered "yes". :)

In this case, the answer to the first part is:

No, Perl doesn't have traditional "multidimensional arrays".  Instead,
you get a much more powerful construct of "arrays that can contain
references, including references to other arrays".  For simple stuff,
the difference can be mostly ignored:

        $a[2][3] = "hello";

However, the moment you want an entire row:

        @{$a[2]}

or an entire column:

        map {$a[$_][3]} 0..$#a

You have to know what's really happening behind the scenes.

"perldoc perlref" et. seq. should give you more information.


Eddie> Is this the right way to access a multi-dimensional array?

Eddie>                 @array[4,3]

No.  That's an array slice, equivalent to ($array[4], $array[3]).

(print "Just another Perl hacker,")[1e20]

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sat, 13 May 2000 18:25:55 GMT
From: richard_chen@my-deja.com
Subject: Re: Clear and then Reuse a package name space
Message-Id: <8fk6n3$8h0$1@nnrp1.deja.com>

In article <391a79f8.569462@news.skynet.be>,
  bart.lateur@skynet.be (Bart Lateur) wrote:
> richard_chen@my-deja.com wrote:
>
> >If in the main package you set
> >        *Q::myfunc=\&a_func_in_main;
> >Then after calling scrub_package, the main::a_func_in_main
> >is gone!
>
> >sub scrub_package {
> ...
> >        # Get rid of everything with that name.
> >        undef $$fullname;
> >        undef @$fullname;
> >        undef %$fullname;
> >        undef &$fullname;
> >        undef *$fullname;
>
> I wonder if a simple
>
> 	undef *$fullname;
>
> isn't enough. The chain reaction of decrementing reference counts
should
> release those things that need releasing, but no more.
>
> --
> 	Bart.
>

I think you are right. According to 'perldoc -f undef':

undef *xyz;       # destroys $xyz, @xyz, %xyz, &xyz, etc.

So if that document is correct, then
          undef *$fullname;
should be equivalent to
          undef $$fullname;
          undef @$fullname;
          undef %$fullname;
          undef &$fullname;
This means scrub_package described in perlfaq7 does too much
cleaning up. However, repeated undef calls leading to the
destruction of subroutines outside of the package
is hardly a "feature". If this behavior of undef is
not considered a bug, at least a warning should
be added in the perldoc section on undef.

Richard



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


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

Date: Thu, 11 May 2000 15:04:59 -0700
From: "Malverian" <malverian@hotmail.com>
Subject: Re: counter
Message-Id: <8fkb4u$kf3$1@news.smartworld.net>

> Where can I get a nice counter that does not increment on each page
> refresh.. One that will remember ip or visitor for a period of time.

I'm not sure but you may have to use SSI to get this to print on an HTML
document or use some type of metarefresh to the CGI.

Here's a simple script, it may not work, I'm typing it as I go (bored), feel
free to email me if it doesn't work.

 __START__
#!/usr/bin/perl

use CGI;
$query = new CGI;

$usr_addr = $ENV{'REMOTE_USER'};
$counterdata = 'counter.data';
$users = 'counter.visitors';
open(HITS, $counterdata);
@data = <HITS>;
close(HITS);
open(VISITORS, $counterdata);
@visitors = <VISITORS>;
close(VISITORS);
$visitorlist = "@visitors";
$hitcount = "@data";

if ($visitorlist =~ /$usr_addr/i); {
&beenhere;
} else {
$hitcount = $hitcount + 1;
open(IN, ">$counterdata");
print IN $hitcount;
close(IN);

print "Content-type: text/html\n\n";
print "$hitcount";
}

sub beenhere {
print "Content-type: text/html\n\n";
print "$hitcount<br>";
print "You've been here already, thanks for coming back!";
}
__END__


Try that, hopefully it will work.
malverian@hotmail.com




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

Date: Sat, 13 May 2000 20:34:57 GMT
From: felrodian@my-deja.com
Subject: Re: counter
Message-Id: <8fke9g$gad$1@nnrp1.deja.com>

You might try using cookies. Some people dont like cookies though. Try
Malv's code this is just an idea....


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


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

Date: Sat, 13 May 2000 14:34:33 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: counting keys in multi-dimensional hash ref
Message-Id: <391DCA69.70AAF344@My-Deja.com>

> Is it possible to count through thus structure to obtain the number of keys
> in say,
> %{$hash_ref{ARG}{Payment}}  ?
>

yes
there should be a -> between  $hashref and the first key.

number of keys =   scalar ( keys  %{$hash_ref->{ARG}{Payment}} );

Essentially what you have is a hash to hashes ( HoH ).

Refer to
perldoc perldsc
for more info




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

Date: Sat, 13 May 2000 21:42:30 GMT
From: munazzah@my-deja.com
Subject: Help with Perl/CGI scripts
Message-Id: <8fki84$k48$1@nnrp1.deja.com>

Where can I find a Perl or CGI guestbook script (win98 platform) for my
angelfire.com homepage?  I have tried atleast 20 different kinds of
scripts, but they don't seem to work!!!!  I finally figured out that
its because of my platform.  I would greatly appreciate all of your
help.
Sincerely,
M


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


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

Date: Sat, 13 May 2000 21:48:03 GMT
From: malverian@hotmail.com
Subject: Re: Help with Perl/CGI scripts
Message-Id: <8fkiig$khu$1@nnrp1.deja.com>


> Where can I find a Perl or CGI guestbook script (win98 platform) for
my
> angelfire.com homepage?  I have tried atleast 20 different kinds of
> scripts, but they don't seem to work!!!!  I finally figured out that
> its because of my platform.  I would greatly appreciate all of your
> help.


Okay, I will give you a few pointers.
a) It doesn't matter what platform you are using on your personal
computer since the CGIs will be hosted by your web server. (Which would
be Angelfire)
b) Make sure you are uploading in ASCII and -not- Binary.

If you still have problems post a reply to this, I'll try and help you
out.


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


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

Date: Sat, 13 May 2000 15:49:16 -0500
From: Cory Phillips <cory-p@usa.net>
Subject: Re: Long insert feilds with ODBC/Access
Message-Id: <391DBFCC.564D9C07@usa.net>


--------------8CD5C3AB6FE0902D6E72B8E4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is from the perldoc DBI documentation.

       LongReadLen (unsigned integer, inherited)
           This attribute may be used to control the maximum
           length of 'long' ('blob', 'memo' etc.) fields which
           the driver will read from the database automatically
           when it fetches each row of data.  The LongReadLen
           attribute only relates to fetching/reading long values
           it is not involved in inserting/updating them.

--

-------------------------------------------
Cory Phillips

cory-p@usa.net



--------------8CD5C3AB6FE0902D6E72B8E4
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
This is from the perldoc DBI documentation.
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LongReadLen (unsigned integer,
inherited)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This attribute
may be used to control the maximum
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; length
of 'long' ('blob', 'memo' etc.) fields which
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the driver
will read from the database automatically
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when it
fetches each row of data.&nbsp; The LongReadLen
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attribute
only relates to fetching/reading long values
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it is
not involved in inserting/updating them.
<pre>--&nbsp;

-------------------------------------------
Cory Phillips

cory-p@usa.net</pre>
&nbsp;</html>

--------------8CD5C3AB6FE0902D6E72B8E4--



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

Date: Sat, 13 May 2000 19:35:34 GMT
From: jhalbrook@my-deja.com
Subject: Looking to purchase an FTP script ...
Message-Id: <8fkaq5$cqn$1@nnrp1.deja.com>

I need a script that will let me specify the IP address,
userid, and password so I can FTP files from one server
to another.

Preferably a script that will not require installing any
Perl modules.

Please let me know if you can help me out.

Much thanks.

J. Halbrook



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


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

Date: Thu, 11 May 2000 15:16:06 -0700
From: "Malverian" <malverian@hotmail.com>
Subject: Now serving 15? (How can I setup a small server in perl?)
Message-Id: <8fkbq5$lp6$1@news.smartworld.net>

I've been working on this for a while, and actually I don't even have a
script started. I would really be thankful if someone could tell me how I
could set up a server in Perl.
I want to be able to keep a certain port open on my computer, and when
people connect to it, it will send information to them. Now, I've read every
document on doing listen ports with Socket, but I still can't seem to figure
it out. I'd like the server to allow 15 simultaneous connections and keep
the connections until it is cancelled by the user.
If someone could email and/or post a simple script that would print to the
correct IP and keep the connection I would be extremely thankful!

~Malv
Malverian@hotmail.com




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

Date: Sat, 13 May 2000 13:36:25 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Now serving 15? (How can I setup a small server in perl?)
Message-Id: <391DBCC9.D529A2EE@My-Deja.com>

>  I would really be thankful if someone could tell me how I
> could set up a server in Perl.

perldoc  HTTP::Daemon

==



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

Date: Sat, 13 May 2000 21:05:07 GMT
From: malverian@hotmail.com
Subject: Re: Now serving 15? (How can I setup a small server in perl?)
Message-Id: <8fkg1t$i2u$1@nnrp1.deja.com>


> perldoc  HTTP::Daemon

Could you give me an example of how I could use this for say a MUD
server?

And it has to keep the connection constant, not just when sending the
web page information.


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


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

Date: Sat, 13 May 2000 14:42:14 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Now serving 15? (How can I setup a small server in perl?)
Message-Id: <391DCC36.8FDC535D@My-Deja.com>

>
> Could you give me an example of how I could use this for say a MUD
> server?

Perl MUD stuff is available.
http://www.boutell.com/perlmud/
Do not invent your own unless really necessary.
--



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

Date: Sat, 13 May 2000 18:53:11 GMT
From: Steve Linberg <slinberg@crocker.com>
Subject: Re: Number of things in an array?
Message-Id: <slinberg-D0D15D.14531113052000@news.ne.mediaone.net>

In article <391D627F.B45526A9@ostas.lu.se>, webmaster@ostas.lu.se 
wrote:

> Hi,
> how do I count the contents of an array ?
> I have 
> @values
> how do I know how many values I got ?
> // Jimmy Lantz
> I know this is a newbie Q.!

$total = @values;


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

Date: Sat, 13 May 2000 14:38:09 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Number of things in an array?
Message-Id: <391DCB40.8742DBF@My-Deja.com>

> how do I count the contents of an array ?
> I have
> @values
> how do I know how many values I got ?

$number_of_items = scalar ( @values);

for more info
perldoc -f scalar



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

Date: Sat, 13 May 2000 19:04:27 GMT
From: "velocity" <velocity@youreallythinkitsme.com>
Subject: Please Help friend on perl problem
Message-Id: <%GhT4.61780$fF5.1941446@news1.rdc1.il.home.com>

Can any of you guys tell me why this program wont work.
It's a simple news poster allowing header hacking.
  It seems to work, but no posts show up on usenet.
 I redirected output to a text file and it looked good. I
then used netcat to send the info in that text file to the
news server and it worked. I even typed in the commands from
that file in telnet, that worked also.
  It would seem im using the right posting commands.
It's connecting ok to the server, and quitting ok.
i added 3 seconds of sleep time after every command
to the server in case i needed some wait time.
i changed post commands to caps/no caps.
                   still nothing!
 Can anybody figure this out??

#!/usr/bin/perl
#perl news-poster
#
##################################################################
#                                                                #
#         perlnews 1.0              vinny@tampabay.rr.com        #
#                                                                #
##################################################################


$from   = "\"vinny\"\<vinny\@perlguru.com\>";     # change this
$server = 'news-server';                                        # change
this
$port   = 119;
$win    = 1;                                                              #
enter zero for unix/linux

# anything else for windows




#$refer = "<245@nowhere.com> <ed4f@joeblow.com>"

    # cut and paste references
    # here if replying to a thread.






if ($win) {
    $win="Z";
  } else {
    $win="D";
  }
print "\n\n  Enter group to post to: \n\n";
 $group=<STDIN>;
 chop($group);
print "\n\n   Enter a subject for the post: \n\n\n";
 $subj=<STDIN>;
 chop($subj);
print "\n\n\n   Enter your message now:\n\n";
print "          Type \^$win on a by itself and press enter when done:
\n\n:";
print "    BE SURE TO NOT LEAVE ANY BLANK LINES AT THE END OF YOUR MESSAGE.
\n\n\n";
 @msg=<STDIN>;
print "\n\n\n   Now add any headers you like on its own line,\n\n";
print "        Type ^$win on a line by itself and press enter when done:
\n\n\n";
 @header=<STDIN>;


print "\n\nAttempting to connect to server, please wait\n\n";


use Socket;
$iaddr  = inet_aton($server)                || die "no host reachable at:
$server";
$proto  = getprotobyname('tcp');
$paddr  = sockaddr_in($port, $iaddr);
socket(SOCK, PF_INET, SOCK_STREAM, $proto)  || die "socket: $!";
connect(SOCK, $paddr)                       || die "connect: $!";


print SOCK "post\n";
print SOCK "Message-ID: \<fu4jdh4\@perlguru.com>\n";
print SOCK "From: $from\n";
print SOCK "Newsgroups: $group\n";
print SOCK "References: $refer\n";
print SOCK @header;
############ add permanent headers here#####################
print SOCK "Organization: Sons of Liberty\n";
print SOCK "FUCK CABAL\n";
print SOCK "FUCK NANAU\n";
############################################################
print SOCK "Subject: $subj\n";
print SOCK "\n";
print SOCK @msg;
print SOCK "\n.\n";

close(SOCK)                                 || die "close: $!";
exit;






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

Date: Sat, 13 May 2000 15:02:11 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Please Help friend on perl problem
Message-Id: <brian-1305001502110001@sri.dialup.access.net>

In article <%GhT4.61780$fF5.1941446@news1.rdc1.il.home.com>, "velocity" <velocity@youreallythinkitsme.com> wrote:

>Can any of you guys tell me why this program wont work.
>It's a simple news poster allowing header hacking.


you forgot to 

   use Net::NNTP;

-- 
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ 
  <URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>



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

Date: Sat, 13 May 2000 18:13:47 GMT
From: "Aurelien" <aureld@free.fr>
Subject: Problem with CRLF
Message-Id: <vXgT4.358$D06.793621@nnrp5.proxad.net>

Hello !

I have a problem with CRLF. I made a perl script and I used "write" command
to write in a file with a certain format. At the end of each line of this
file, there is a "^M" which is added. I don't understand why. (I run my
script under Mandrake 7.0)
Here is my script:

---------------------------------------------------------------
#! /usr/bin/perl5 -w

open(FILE,"> result.txt") or die("Unable to open result.txt");
open(FILE2,"essai.txt") or die("Unable to open essai.txt");

while (defined($line=<FILE2>)) {
    @table=split(/\s+/,$line);
    write FILE;
}

close FILE;
close FILE2


format FILE=
@<<<<<<<<   @.########   @<<<<  @<<<<<<<<
$table[0], $table[1], $table[2], $table[3]
 .

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

Can someone help me ? Thanks.

Aurelien







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

Date: 13 May 2000 20:39:42 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Problem with CRLF
Message-Id: <slrn8hrfcd.2u0.efflandt@efflandt.xnet.com>

On Sat, 13 May 2000 18:13:47 GMT, Aurelien <aureld@free.fr> wrote:
>
>I have a problem with CRLF. I made a perl script and I used "write" command
>to write in a file with a certain format. At the end of each line of this
>file, there is a "^M" which is added. I don't understand why. (I run my
>script under Mandrake 7.0)

Have you ever thought that maybe the '^M' characters were in your original
data and you simply failed to remove them?  What is the source of
essai.txt?  If you uploaded it from DOS/Win, you forgot to set ASCII text
mode.  Lines from the textarea of a form may also end with \r\n (yes even
from Linux Netscape).

>Here is my script:
>
>---------------------------------------------------------------
>#! /usr/bin/perl5 -w
>
>open(FILE,"> result.txt") or die("Unable to open result.txt");
>open(FILE2,"essai.txt") or die("Unable to open essai.txt");
>
>while (defined($line=<FILE2>)) {
>    @table=split(/\s+/,$line);
>    write FILE;
>}
>
>close FILE;
>close FILE2;
>
>
>format FILE=
>@<<<<<<<<   @.########   @<<<<  @<<<<<<<<
>$table[0], $table[1], $table[2], $table[3]
>.
>
>----------------------------------------------------------------

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Sat, 13 May 2000 13:45:45 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Problem with server scripting
Message-Id: <391DBEF9.2D5EBAEB@My-Deja.com>

>  read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

make sure that CONTENT_LENGTH is some sensible
finite value before starting to read to avoid "overlow".
Nasty clients can do that.

open (f, ">/export/companyName/WWW/cgi-bin/news/zammy/$file.$ext") ||
Unless you open this file in append mode all contents are lost for
each invocation of this CGI. Also make sure that this file was write
permissions for the CGI process in place.

> $myFile = <f>;

Reads a line from $myFile and  does not assign descriptor f to $myFile.

> close (f);

Once you do a close() you cannot write to a file.

> print $myFile $name;

should be
print f $name ;

Programming style note; Use capital letters for file descriptors to make
reading easy.



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

Date: Sat, 13 May 2000 21:23:21 GMT
From: malverian@hotmail.com
Subject: Regular Expressions help
Message-Id: <8fkh41$j82$1@nnrp1.deja.com>

I would like to check for the value of a variable not the string length
in a Regular Expression.

Here is what I have so far...

if ($userlist =~ /Username=$username/i) {
&dologin;
} else {
&nologin;
}

Say $username = 'nobody';

I want it to be equivilant to

if ($userlist =~ /Username=nobody/i) { #etc...


Is there a way to do this?

At the time it acts in this fashion.

if ($userlist =~ /Username=6/i) { #etc...

Any help is greatly appreciated.


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


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

Date: Sat, 13 May 2000 21:41:14 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Regular Expressions help
Message-Id: <87og6aqgat.fsf@shleppie.uh.edu>

>> On Sat, 13 May 2000 21:23:21 GMT,
>> malverian@hotmail.com said:

> I would like to check for the value of a variable not
> the string length in a Regular Expression.
> Here is what I have so far...
> if ($userlist =~ /Username=$username/i) { &dologin; }
> else { &nologin; }
> Say $username = 'nobody';
> I want it to be equivilant to
> if ($userlist =~ /Username=nobody/i) { #etc...
> Is there a way to do this?
> At the time it acts in this fashion.
> if ($userlist =~ /Username=6/i) { #etc...

You're doing it right.

There's something else that's going on here that you're
not telling us about.

Where does $username come from?

hth
t


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

Date: Sat, 13 May 2000 19:21:06 GMT
From: "blah80" <*nospam*blah80@hotmail.com>
Subject: spoofing identity
Message-Id: <CWhT4.5032$WS3.42784@typhoon.we.rr.com>

I know this is pretty basic, but here goes:

Every 5 minutes I want to execute a pgm that hits a site and scrapes then
parses the html.  I don't really have permission to do this, so they might
spot me in the logs pretty soon and block my ip address.  I know people have
bots hitting sites all the time and they solve this.  How do they do that?

Gary




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

Date: Sat, 13 May 2000 12:57:40 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: spoofing identity
Message-Id: <391DB3B4.F2BFFAFC@vpservices.com>

blah80 wrote:
> 
> Every 5 minutes I want to execute a pgm that hits a site and scrapes then
> parses the html.  I don't really have permission to do this, so they might
> spot me in the logs pretty soon and block my ip address.  I know people have
> bots hitting sites all the time and they solve this.  How do they do that?

This URL might have some information on that topic:

http://onlineethics.org/

-- 
Jeff


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

Date: 13 May 2000 20:51:55 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: spoofing identity
Message-Id: <slrn8hrg39.2u0.efflandt@efflandt.xnet.com>

On Sat, 13 May 2000 19:21:06 GMT, blah80 <*nospam*blah80@hotmail.com> wrote:
>I know this is pretty basic, but here goes:
>
>Every 5 minutes I want to execute a pgm that hits a site and scrapes then
>parses the html.  I don't really have permission to do this, so they might
>spot me in the logs pretty soon and block my ip address.  I know people have
>bots hitting sites all the time and they solve this.  How do they do that?

They don't.  There is no way you can gather data from a site without using
a valid IP somewhere, even if it a proxy that redirects to you.  The
search engine spiders have valid IP addresses, even if that address does
not have a name.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Sat, 13 May 2000 19:00:29 GMT
From: juump@my-deja.com
Subject: Re: Using Net::FTP in a subroutine
Message-Id: <8fk8o7$aej$1@nnrp1.deja.com>

In article <391D3F45.65049C52@rochester.rr.com>,
  Bob Walton <bwalton@rochester.rr.com> wrote:
> juump@my-deja.com wrote:
> ...
> > However, the subroutine does not recognize $ftp as anything at all. (The
> > command $ftp->cwd(...) fails in the subroutine.)
> ...
> > How do I get the subroutine to recognize an FTP socket created in the
> > main part of the script? Do I need to pass $ftp as a parameter to the
> > subroutine? And is there some lag between the time I call "$ftp->close;
> > $ftp->quit;" and the time the server actually closes the connection?
> ...
> > Steve
> ...
> You need to pass a reference to $ftp, and dereference it in your sub.
> Something like [untested]:
>
>      &subname(\$ftp);
>      ...
>      sub subname{
>          my $ftpr=shift;
>          my $ftp=$$ftpr;
>          #rest of sub as is
>          ...
>      }

Thanks, I'll try that. Does the recursion matter?

Also, I've been reading the camel book, and got the impression that
maybe I need to put "use Net::FTP" in the subroutine as well as the main
routine. Does that make any sense?

Unfortunately, I can't access the machine from home, so the experiments
will have to wait until Monday.


Thanks again.

Steve


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


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

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 3038
**************************************


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