[17389] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4811 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 4 18:05:35 2000

Date: Sat, 4 Nov 2000 15:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973379109-v9-i4811@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 4 Nov 2000     Volume: 9 Number: 4811

Today's topics:
        [Q] Matching \0 <kj0@mailcity.com>
        About to slit my own throat (Anthony)
    Re: About to slit my own throat (Ameen Dausha)
    Re: About to slit my own throat <mtaylorlrim@my-deja.com>
    Re: About to slit my own throat <mtaylorlrim@my-deja.com>
    Re: Binary data & sockets <tzz@heechee.beld.net>
    Re: Binary data & sockets <uri@sysarch.com>
        Building a Module on Server without Install.pm (Ameen Dausha)
    Re: Building a Module on Server without Install.pm <not.my.real.email@bellglobal.com>
    Re: Duplicate lInes in File count and del routine <ren.maddox@tivoli.com>
    Re: even or odd ? <nospam@david-steuber.com>
    Re: even or odd ? (Anno Siegel)
    Re: Freelance Programmer Neede - Good Money <nospam@david-steuber.com>
    Re: Freelance Programmer Neede - Good Money <nospam@david-steuber.com>
    Re: Freelance Programmer Neede - Good Money (Tony L. Svanstrom)
    Re: hello world <bart.lateur@skynet.be>
        help w/linux RH6.2 perl script wmarvel@my-deja.com
    Re: How to check passwd is correct? (David Efflandt)
        how to sort corresponding arrays? drtsq@my-deja.com
    Re: killfiles (was Re: Perl style and module searches) <nospam@david-steuber.com>
    Re: My brain hurts: another regex Q. (Daniel Chetlin)
    Re: OT: Yes there _are_ stupid questions.  Anyone colle <nospam@david-steuber.com>
    Re: OT: Yes there _are_ stupid questions.  Anyone colle <flavell@mail.cern.ch>
    Re: Perl style and module searches <nospam@david-steuber.com>
    Re: Perl syntax and beyond (was: Re: Perl style and mod <bart.lateur@skynet.be>
    Re: Stultiloquent Queries (was: even or odd?) <nospam@david-steuber.com>
    Re: Timers? <nospam@david-steuber.com>
    Re: Weak References Was: Keeping a List of Objects (Ilya Zakharevich)
    Re: Weak References Was: Keeping a List of Objects (Anno Siegel)
        XML::Parser and diacriticals <godoy@conectiva.com>
    Re: XML::Parser and diacriticals <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 4 Nov 2000 17:43:07 -0500
From: kj0 <kj0@mailcity.com>
Subject: [Q] Matching \0
Message-Id: <8u23dr$5jt$1@panix3.panix.com>




I have a null-terminated string (a la C) followed by garbage.  I'd
like to get rid of the garbage by using something like

  $C_string =~ s/\0.*$//;

but it doesn't work (no match; garbage stays).  Likewise,

  $C_string =~ s/^(.*?)\0.*$/$1/;

also fails.  And yet,

  ($C_string) = ($C_string =~ /^(.*?)\0/);

gets the job done.  Why doesn't the first approach work?

KJ



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

Date: Sat, 04 Nov 2000 22:02:34 GMT
From: apsaffer@hotmail.com (Anthony)
Subject: About to slit my own throat
Message-Id: <3a04876d.12593835@news.rectec.net>

Hello Everyone,
I have written a CGI script in Perl and it just isn't working. This
script needs to work by Monday or else I am going to get it in a bad
way. Could someone take a look at the code below and tell me why it
isn't working.  Here are a few things to get you started:

1: The path to Perl on the system is correct (I've verified this).
2: The path to Sendmail is correct (verified this too).
3: The way I am calling the GetFormInput routine may be wrong but it
wasn't working even when I called it the standard way.

With that said, here is the code to the script:


#!/usr/local/bin/perl
# Anonymous Mailer Script
# Written By Anthony Saffer

CGI::Carp qw(fatalsToBrowser);
$mail_prog = '/usr/lib/sendmail' ;

GetFormInput;

$Mail_To = $field{'Mail_To'} ;	 
$Mail_From = $field{'Mail_From'} ;	 
$Mail_Subject = $field{'Mail_Subject'} ;	 
$Message_Text = $field{'Message_Text'} ;	 
$B1 = $field{'B1'} ;	 
$B2 = $field{'B2'} ;	 

$message = "" ;
$found_err = "" ;


$errmsg = "<p></p>\n" ;

if (length($Mail_From) > 8) {
	$message = $message.$errmsg ;
	$found_err = 1 ; }


$errmsg = "<p></p>\n" ;

if (length($Mail_Subject) > 1297250159) {
	$message = $message.$errmsg ;
	$found_err = 1 ; }


$errmsg = "<p></p>\n" ;

if (length($Message_Text) > 107310433) {
	$message = $message.$errmsg ;
	$found_err = 1 ; }


$errmsg = "<p></p>\n" ;

if (length($B1) > 1393034862) {
	$message = $message.$errmsg ;
	$found_err = 1 ; }

if ($found_err) {
	&PrintError; }


$recip = $Mail_To ;

open (MAIL, "|$mail_prog -t");
print MAIL "To: $recip\n";
print MAIL "Reply-to: $Mail_From\n";
print MAIL "From: $Mail_From\n";
print MAIL "Subject: $Mail_Subject\n";
print MAIL "\n\n";
print MAIL "".$Message_Text."\n" ;
print MAIL "\n" ;
print MAIL "\n" ;
print MAIL "\n" ;
print MAIL "---\n" ;
print MAIL "This message was sent using the anonymous mail service
available at http://www.supermailer.netfirms.com.  If this message is
of a harassing nature please report it to casaffer\@rectec.net and it
will be dealt with promptly.\n" ;
print MAIL "\n\n";
close (MAIL);


sub PrintError { 
print "Content-type: text/html\n\n";
print $message ;

exit 0 ;
return 1 ; 
}

sub GetFormInput {

	(*fval) = @_ if @_ ;

	local ($buf);
	if ($ENV{'REQUEST_METHOD'} eq 'POST') {
		read(STDIN,$buf,$ENV{'CONTENT_LENGTH'});
	}
	else {
		$buf=$ENV{'QUERY_STRING'};
	}
	if ($buf eq "") {
			return 0 ;
		}
	else {
 		@fval=split(/&/,$buf);
		foreach $i (0 .. $#fval){
			($name,$val)=split (/=/,$fval[$i],2);
			$val=~tr/+/ /;
			$val=~ s/%(..)/pack("c",hex($1))/ge;
			$name=~tr/+/ /;
			$name=~ s/%(..)/pack("c",hex($1))/ge;

			if (!defined($field{$name})) {
				$field{$name}=$val;
			}
			else {
				$field{$name} .= ",$val";
				
				#if you want multi-selects to goto
into an array change to:
				#$field{$name} .= "\0$val";
			}


		   }
		}
return 1;
}





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

Date: Sat, 04 Nov 2000 22:29:19 GMT
From: ameen @ dausha . net (Ameen Dausha)
Subject: Re: About to slit my own throat
Message-Id: <3a048d59.155921715@news>

Everybody, look at the last lines. This is a spam generator and the
URL it refers to does not exist.

On Sat, 04 Nov 2000 22:02:34 GMT, apsaffer@hotmail.com (Anthony) spat:

>Hello Everyone,
>I have written a CGI script in Perl and it just isn't working. This
>script needs to work by Monday or else I am going to get it in a bad
>way. Could someone take a look at the code below and tell me why it
>isn't working.  Here are a few things to get you started:
>
>1: The path to Perl on the system is correct (I've verified this).
>2: The path to Sendmail is correct (verified this too).
>3: The way I am calling the GetFormInput routine may be wrong but it
>wasn't working even when I called it the standard way.
>
>With that said, here is the code to the script:
>
>
>#!/usr/local/bin/perl
># Anonymous Mailer Script
># Written By Anthony Saffer
>
>CGI::Carp qw(fatalsToBrowser);
>$mail_prog = '/usr/lib/sendmail' ;
>
>GetFormInput;
>
>$Mail_To = $field{'Mail_To'} ;	 
>$Mail_From = $field{'Mail_From'} ;	 
>$Mail_Subject = $field{'Mail_Subject'} ;	 
>$Message_Text = $field{'Message_Text'} ;	 
>$B1 = $field{'B1'} ;	 
>$B2 = $field{'B2'} ;	 
>
>$message = "" ;
>$found_err = "" ;
>
>
>$errmsg = "<p></p>\n" ;
>
>if (length($Mail_From) > 8) {
>	$message = $message.$errmsg ;
>	$found_err = 1 ; }
>
>
>$errmsg = "<p></p>\n" ;
>
>if (length($Mail_Subject) > 1297250159) {
>	$message = $message.$errmsg ;
>	$found_err = 1 ; }
>
>
>$errmsg = "<p></p>\n" ;
>
>if (length($Message_Text) > 107310433) {
>	$message = $message.$errmsg ;
>	$found_err = 1 ; }
>
>
>$errmsg = "<p></p>\n" ;
>
>if (length($B1) > 1393034862) {
>	$message = $message.$errmsg ;
>	$found_err = 1 ; }
>
>if ($found_err) {
>	&PrintError; }
>
>
>$recip = $Mail_To ;
>
>open (MAIL, "|$mail_prog -t");
>print MAIL "To: $recip\n";
>print MAIL "Reply-to: $Mail_From\n";
>print MAIL "From: $Mail_From\n";
>print MAIL "Subject: $Mail_Subject\n";
>print MAIL "\n\n";
>print MAIL "".$Message_Text."\n" ;
>print MAIL "\n" ;
>print MAIL "\n" ;
>print MAIL "\n" ;
>print MAIL "---\n" ;
>print MAIL "This message was sent using the anonymous mail service
>available at http://www.supermailer.netfirms.com.  If this message is
>of a harassing nature please report it to casaffer\@rectec.net and it
>will be dealt with promptly.\n" ;
>print MAIL "\n\n";
>close (MAIL);
>
>
>sub PrintError { 
>print "Content-type: text/html\n\n";
>print $message ;
>
>exit 0 ;
>return 1 ; 
>}
>
>sub GetFormInput {
>
>	(*fval) = @_ if @_ ;
>
>	local ($buf);
>	if ($ENV{'REQUEST_METHOD'} eq 'POST') {
>		read(STDIN,$buf,$ENV{'CONTENT_LENGTH'});
>	}
>	else {
>		$buf=$ENV{'QUERY_STRING'};
>	}
>	if ($buf eq "") {
>			return 0 ;
>		}
>	else {
> 		@fval=split(/&/,$buf);
>		foreach $i (0 .. $#fval){
>			($name,$val)=split (/=/,$fval[$i],2);
>			$val=~tr/+/ /;
>			$val=~ s/%(..)/pack("c",hex($1))/ge;
>			$name=~tr/+/ /;
>			$name=~ s/%(..)/pack("c",hex($1))/ge;
>
>			if (!defined($field{$name})) {
>				$field{$name}=$val;
>			}
>			else {
>				$field{$name} .= ",$val";
>				
>				#if you want multi-selects to goto
>into an array change to:
>				#$field{$name} .= "\0$val";
>			}
>
>
>		   }
>		}
>return 1;
>}
>
>
>



Ben Wilson (a.k.a. Ameen, Last of the Dausha)
____________________________
-"Ever heard of Aristotle . . . Plato . . . Socrates?!"
-"Yes."
-"Morons!"


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

Date: Sat, 04 Nov 2000 22:42:57 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: About to slit my own throat
Message-Id: <8u23dh$23h$1@nnrp1.deja.com>

In article <3a04876d.12593835@news.rectec.net>,
  apsaffer@hotmail.com (Anthony) wrote:
> Hello Everyone,
> I have written a CGI script in Perl and it just isn't working. This
> script needs to work by Monday or else I am going to get it in a bad
> way. Could someone take a look at the code below and tell me why it
> isn't working.  Here are a few things to get you started:
>
> 1: The path to Perl on the system is correct (I've verified this).
> 2: The path to Sendmail is correct (verified this too).
> 3: The way I am calling the GetFormInput routine may be wrong but it
> wasn't working even when I called it the standard way.
>
> With that said, here is the code to the script:
>
> #!/usr/local/bin/perl
> # Anonymous Mailer Script
> # Written By Anthony Saffer
>
> CGI::Carp qw(fatalsToBrowser);
> $mail_prog = '/usr/lib/sendmail' ;
>
> GetFormInput;
>
Shouldn't there be an '&' in front of GetFormInput?

mark

--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!


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


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

Date: Sat, 04 Nov 2000 22:52:35 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: About to slit my own throat
Message-Id: <8u23vi$2h6$1@nnrp1.deja.com>

In article <3a048d59.155921715@news>,
  ameen @ dausha . net (Ameen Dausha) wrote:
> Everybody, look at the last lines. This is a spam generator and the
> URL it refers to does not exist.
>
> On Sat, 04 Nov 2000 22:02:34 GMT, apsaffer@hotmail.com (Anthony) spat:

Darn, your right...I never went that far...Anthony please disregard my
previous post. (As if that will do any good, lol)

The url is good...

Mark


--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!


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


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

Date: 04 Nov 2000 15:07:47 -0500
From: Ted Zlatanov <tzz@heechee.beld.net>
Subject: Re: Binary data & sockets
Message-Id: <m3wvej1ox8.fsf@heechee.beld.net>

"Billy" <billy@nospamforme.com> writes:

> I've been working a program which was communicating with 
> plain-text over sockets.  I now need to add the ability to transfer 
> binary data over the socket.

> The problem is how to mark the end of the data.  The data can be
> of any size, and contain any data.  I'd rather avoid the possibility
> of matching a "####endofdata####" type tag by accident and 
> fubarring up the data.

Besides the binary protocols recommended by others, you might want to
consider encoding your data with base64 or quoted-printable encoding,
which have the obvious advantage that you can use text protocols.
Base64 is generally better if you are dealing with purely binary data,
quoted-printable is better for mostly textual data.

If you are transmitting small amounts of data, this may be the better
way to go.  For large data transfers, a binary protocol is the better
choice.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: Sat, 04 Nov 2000 21:42:10 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Binary data & sockets
Message-Id: <x7wvejh0ss.fsf@home.sysarch.com>

>>>>> "B" == Billy  <billy@nospamforme.com> writes:

  B> I've been working a program which was communicating with 
  B> plain-text over sockets.  I now need to add the ability to transfer 
  B> binary data over the socket.
  B> The problem is how to mark the end of the data.  The data can be
  B> of any size, and contain any data.  I'd rather avoid the possibility
  B> of matching a "####endofdata####" type tag by accident and 
  B> fubarring up the data.

you have to create a protocol. no way around it. even text data over a
pipe uses a protocol which may be a simple as the common newline
terminated records. it is still a protocol.

as for what protocol to use or create, that depends on many things and
you haven't mentioned any of them.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sat, 04 Nov 2000 19:37:04 GMT
From: ameen @ dausha . net (Ameen Dausha)
Subject: Building a Module on Server without Install.pm
Message-Id: <3a0464a6.145501456@news>

I lease web space from a company who promises complete CGI-BIN and
Perl support, yet they lack CGI.pm. So, I decided to go ahead and
install the module in my own space. Unfortunately, root is the only
one with permissions to 'install.pm' so I can't 'make install.'

I've sent a few emails to the company and am awaiting their
feedback--but it's been a while. I am considering switching services
(including building my own server), but this does not solve my
near-term needs.

What other options/solutions present themselves? How can I install
Modules without install?



Ben Wilson (a.k.a. Ameen, Last of the Dausha)
____________________________
-"Ever heard of Aristotle . . . Plato . . . Socrates?!"
-"Yes."
-"Morons!"


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

Date: Sat, 04 Nov 2000 20:57:53 GMT
From: "MNJP" <not.my.real.email@bellglobal.com>
Subject: Re: Building a Module on Server without Install.pm
Message-Id: <lL_M5.15142$1C6.720953@news20.bellglobal.com>


I don't know the answer to your question

but, regarding the CGI.pm unavailability

Personally I've never had to use it and I don't know what the big deal is.

Just include the following sub into your program, call it in the beginning,
and you'll have all the variables passed from the browser in the hash %FORM.
It works for me every single time.

sub GETVARIABLES() {
 my $value;
 my $name;
 my $buffer;
 read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
 $buffer ||= $ENV{'QUERY_STRING'};
 $RAWDATA = $buffer;
 my @pairs = split(/&/, $buffer);
 foreach (@pairs) {
  ($name, $value) = split/=/;
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ s/~!/ ~!/g;
  $name = lc($name);
  $FORM{$name} = $value;
  }
 }


<ameen @ dausha . net (Ameen Dausha)> wrote in message
news:3a0464a6.145501456@news...
> I lease web space from a company who promises complete CGI-BIN and
> Perl support, yet they lack CGI.pm. So, I decided to go ahead and
> install the module in my own space. Unfortunately, root is the only
> one with permissions to 'install.pm' so I can't 'make install.'
>
> I've sent a few emails to the company and am awaiting their
> feedback--but it's been a while. I am considering switching services
> (including building my own server), but this does not solve my
> near-term needs.
>
> What other options/solutions present themselves? How can I install
> Modules without install?
>
>
>
> Ben Wilson (a.k.a. Ameen, Last of the Dausha)
> ____________________________
> -"Ever heard of Aristotle . . . Plato . . . Socrates?!"
> -"Yes."
> -"Morons!"




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

Date: 04 Nov 2000 14:28:08 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Duplicate lInes in File count and del routine
Message-Id: <m3aebfmqhz.fsf@dhcp11-177.support.tivoli.com>

jkipp@mbna.com writes:

[and I wrote:]
> > my %line_count;
> >
> > open FILE, $file or die "Could not open $file, $!";
> > while (<FILE>) {
> >   chomp;
> >   $line_count{$_}++;
> > }
> > close FILE;
> >
    foreach (keys %line_count) {
> >   print;

That line prints the actual data.

> >   print " $line_count{$_} times" if $line_count{$_} > 1;

While that one prints the count if it is greater than one.

> >   print "\n";
> > }
> 
> The order is not important. I am not quite sure I know what you are
> doing here or how to implement into my routine.

Basically, if you want to keep a count, use a hash.  For each line,
increment its element in the hash.  Then, at the end, the hash value
for each line will be its count.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Sat, 04 Nov 2000 20:58:28 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: even or odd ?
Message-Id: <m38zqztpxp.fsf@solo.david-steuber.com>

Bart Lateur <bart.lateur@skynet.be> writes:

' Anno Siegel wrote:
' 
' >>There are a number of expressions that will do the job.  The truth of
' >>n&1 is one of my favorite if only numbers >=0 are considered.  The
' >>general case would be the truth of n%2.
' >
' >Are you saying n&1 doesn't indicate parity for negative n?  Why?
' 
' I think he might be thinking of 1's complement, where AFAIK ~$n == -$n
' for any positive $n. I've never seen this in the real world, though.

This is a rather embarrassing brain fart on my part.  For two's
compliment, the n&1 solution works nicely and is faster (I think, if
that makes a difference) than using the % operator which boils down to
doing some integer division.  In my mind, n&1 is also more obvious
because I am used to dealing with C style ints rather than Perl
scalers which could be holding a reference to another scaler that
holds a value that may or may not be an int.

Like I should talk anyway.  I'm still trying to understand (well, I
sorta looked at the code once) how primality testing for very large
primes works.  Very large being defined as at least 128bits required
to represent the number.

I seem to recall that the tests I've seen were along the lines of this
number is probably a prime.

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: 4 Nov 2000 22:26:58 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: even or odd ?
Message-Id: <8u22fi$q28$1@lublin.zrz.tu-berlin.de>

David Steuber  <nospam@david-steuber.com> wrote in comp.lang.perl.misc:

[...]

>Like I should talk anyway.  I'm still trying to understand (well, I
>sorta looked at the code once) how primality testing for very large
>primes works.  Very large being defined as at least 128bits required
>to represent the number.
>
>I seem to recall that the tests I've seen were along the lines of this
>number is probably a prime.

That would be Miller-Rabin and derivates.  When they say "composite",
they mean composite.  When they sat "prime", they mean, there is still
a chance it may not be.  The probability of error can be arbitrary low.

Anno


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

Date: Sat, 04 Nov 2000 21:42:13 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: Freelance Programmer Neede - Good Money
Message-Id: <m3r94rs9cb.fsf@solo.david-steuber.com>

Russ Jones <russ_jones@rac.ray.com> writes:

' Here's an urgent quote:
' "I'M GONNA THROW UP!!!" - me on a car trip to Wyoming in 1958.

ROFLMAO!

Did the driver pull over in time?

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: Sat, 04 Nov 2000 21:43:27 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: Freelance Programmer Neede - Good Money
Message-Id: <m3n1ffs9a9.fsf@solo.david-steuber.com>

tony@svanstrom.com (Tony L. Svanstrom) writes:

' I can tell that's going to cost a lot, I mean, to begin with I'd have to
' hire someone to break into your office and computer just to find out
' what you want done.

How much are you willing to pay for that job?

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: Sat, 04 Nov 2000 22:47:16 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Freelance Programmer Neede - Good Money
Message-Id: <1ejljd3.1n7593l1dn6kp6N%tony@svanstrom.com>

David Steuber <nospam@david-steuber.com> wrote:

> tony@svanstrom.com (Tony L. Svanstrom) writes:
> 
> ' I can tell that's going to cost a lot, I mean, to begin with I'd have to
> ' hire someone to break into your office and computer just to find out
> ' what you want done.
> 
> How much are you willing to pay for that job?

I'm sorry, I don't hire people with webpages that doesn't pass
<URL: http://validator.w3.org/ >

:-)


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Sat, 04 Nov 2000 20:01:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: hello world
Message-Id: <spq80t46amp11q5a0telc7loni9hme7i1h@4ax.com>

­»´ä¸} wrote:

>print "hello world"

No -w? No "use strict;"? 


  ;-)

-- 
	Bart.


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

Date: Sat, 04 Nov 2000 19:00:13 GMT
From: wmarvel@my-deja.com
Subject: help w/linux RH6.2 perl script
Message-Id: <8u1mbr$oc8$1@nnrp1.deja.com>

/home/me/foo

#!/usr/bin/perl
print("this and that\n");

Gives the bash interpreter.
Yet the "> perl foo" works.

HELP, TIA.

WM


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


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

Date: Sat, 4 Nov 2000 21:51:40 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to check passwd is correct?
Message-Id: <slrn90917a.rjg.efflandt@efflandt.xnet.com>

On Sun, 05 Nov 2000 01:01:12 +0800, Beggar <cpegbeggar@mail.com> wrote:
>
>How can I write a program in shell script or perl to
>test user's input passwd is correct compare with /etc/shadow?
>Is that need to use "crypt()" ? any other quick method or
>function that I can pass the input and compare the string to
>the shadow file's passwd field?
>
>Please reply to "cpegbeggar@mail.com"

At first I was thinking of getpwnam() but that just gets you an "x" with
shadow passwords.

Parsing /etc/shadow is easy, colon separated fields for each username,
like a password file for web authentication.  The problem is, only root
can read it.

If you can overcome that, telling if a user supplied password is valid is
easy in Perl by simply crypting the plain text password with the crypted
password as salt:

crypt($plainpw,$cryptpw) eq $cryptpw || die "password failed";

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


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

Date: Sat, 04 Nov 2000 22:49:59 GMT
From: drtsq@my-deja.com
Subject: how to sort corresponding arrays?
Message-Id: <8u23qm$2ee$1@nnrp1.deja.com>

I have two arrays that correspond to each other (@your_score, @answer).
By correspond, I mean that the value in $your_score[1] is the score for
test 1, and $text[1] is the text description for test 1.

For reasons out of my control, the array starts at 1, not 0.

I want to print these sorted descending from highest score to lowest.

What I've go so far doesn't sort:

	for $ca (1 .. $#text) {
		print "score =  $your_score[$ca], $text[$ca] <BR>" ;
		}


These don't have to be seperate arrays, it could be a hash of arrays,
but I still don't see how to do this. Any pointers?





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


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

Date: Sat, 04 Nov 2000 21:12:51 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: killfiles (was Re: Perl style and module searches)
Message-Id: <m3vgu3sapa.fsf@solo.david-steuber.com>

tchrist@perl.com (Tom Christiansen) writes:

' In article <slrn9039bs.evs.tadmc@magna.metronet.com>,
' Tad McClellan <tadmc@metronet.com> wrote:
' >I find that more often than not, if I open up a "newbie"
' >article, I will find someone wanting me to read the docs to them.
' >
' >So I just don't open them.
' 
' Er, "open"???

As a slrn user, I suspect he is using "open" as short hand for "fetch
the article body".

Should I really be posting the answer when the question was so
obviously rhetorical?  Probably not.

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: 4 Nov 2000 18:40:14 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: My brain hurts: another regex Q.
Message-Id: <8u1l6e02eob@news2.newsguy.com>

On Thu, 2 Nov 2000 17:45:07 -0500, Jeff Pinyan <jeffp@crusoe.net> wrote:
>On Nov 2, Doug Coppage said:
>>I would like to truncate a string at the first character that is NOT in
>>[0-9a-zA-Z_].
>
>  $truncpos = $string =~ /\W/g ? (pos($string) - 1) : -1;
>  $string = substr($string, 0, $truncpos) if $truncpos != -1;
>
>Does that make sense to you?

Why would you go to all that trouble when it's a lot slower for smaller
strings, and not much faster for even very large ones, especially given
that the OP is likely dealing with small strings? Sure, it looks much
fancier, but does it buy you anything?

-dlc


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

Date: Sat, 04 Nov 2000 20:44:04 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: OT: Yes there _are_ stupid questions.  Anyone collect them?
Message-Id: <m3d7gbtqlq.fsf@solo.david-steuber.com>

Rick Delaney <rick.delaney@home.com> writes:

' Martien Verbruggen wrote:
' > 
' > There's no escape. The great Rick Spam Machine will find you wherever
' > you are.
' 
' <<sigh>>  If only that *was* a joke.

The best way to deal with spam is to kill the source.  Hands up those
who think I am referring to the spammer's account.

I seem to be deleting such messages on a regular basis.  I kind of
wish I had the time to set up my own dedicated SMTP server for my
incoming mail so that I could track down the spammer while it was
online and kill its computer somehow.

I guess this sorta falls into the category of "how do I hide my IP
address from a website".

It looks like I've been given enough clues to find such posts to put
together an "Idiot FAQ" or whatever it should be called.  Perhaps when
my TODO list empties out, or is left with just things I don't want to
do, I will do that.  Probably not though.  Then again, you never know.

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: Sat, 4 Nov 2000 22:36:38 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: OT: Yes there _are_ stupid questions.  Anyone collect them?
Message-Id: <Pine.GHP.4.21.0011042230140.342-100000@hpplus03.cern.ch>

On Sat, 4 Nov 2000, David Steuber wrote:

> wish I had the time to set up my own dedicated SMTP server for my
> incoming mail so that I could track down the spammer while it was
> online

well...

> and kill its computer somehow.

This _is_ OT, but don't even suggest that, even in desperation.

If that kind of attack isn't against your ISP's acceptable use policy,
then I wouldn't want to be a customer of that ISP.

Under UK jurisdiction, at least, it could be a criminal offence
(under the computer misuse legislation).

Don't try to fight one kind of offence with a worse one.

Check out www.mail-abuse.org, SpamCop etc.




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

Date: Sat, 04 Nov 2000 21:09:00 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: Perl style and module searches
Message-Id: <m3zojfsavp.fsf@solo.david-steuber.com>

tchrist@perl.com (Tom Christiansen) writes:

' >    I noticed, in another message in this group, the "perldoc" search
' >utility;  very useful but I am looking for something more.  
' 
' That leprous dinosaur, ponderously slow and severely unsafe, is
' useful mainly for making sure that the ignorant remain that way.

I knew it!!!!!

perldoc -q almost never works for me.

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: Sat, 04 Nov 2000 19:50:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl syntax and beyond (was: Re: Perl style and module searches)
Message-Id: <44q80t0ja9qjhmf5i08rl81hqsmg0lngpf@4ax.com>

Gwyn Judd wrote:

>Well I think extending the syntax to have a linked list data type would
>be nice.

Ok. How would you imagine that syntax to be?

-- 
	Bart.


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

Date: Sat, 04 Nov 2000 21:01:27 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: Stultiloquent Queries (was: even or odd?)
Message-Id: <m34s1ntpsp.fsf@solo.david-steuber.com>

cfedde@fedde.littleton.co.us (Chris Fedde) writes:

' VB programmers are all even.  That is assuming of course that perl
' programmers are odd.  Or maybe they are just irrational in which
' case they are neither.

Well, LISP programmer's think they are transcendental.

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: Sat, 04 Nov 2000 21:51:07 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: Timers?
Message-Id: <m3itq3s8xh.fsf@solo.david-steuber.com>

tjla@guvfybir.qlaqaf.bet (Gwyn Judd) writes:

' You lived with a man who wore white belts?  Laura, I'm disappointed in you.
' 		-- Remington Steele

"She always did enjoy a good squeeze"
                -- Same actor, different role

-- 
David Steuber | Perl apprentice.  The axe did not stop the
NRA Member    | mops and buckets from flooding my home.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: 4 Nov 2000 19:47:41 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Weak References Was: Keeping a List of Objects
Message-Id: <8u1p4t$gr1$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>],
who wrote in article <8u1ius$pjv$1@lublin.zrz.tu-berlin.de>:
> Weak references seemed to work as expected in first tests, but
> putting the mechanism under stress reveals that "experimental" is
> there for a reason.  Stress in this case means that I ended up with
> objects of two kinds -- those to which weak references exist, and
> those which contain weak references -- some stored in lexical variables
> and others in exported package variables[1].  In this situation I
> got to see
> 
>   panic: magic_killbackrefs, <DATA> line 38 during global destruction (#1)

Hmm...  As I designed it, weak references should work even when
surviving until global destruction, though this is not supposed to be
the primary way to use them.  Can you supply a short test script?

Ilya


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

Date: 4 Nov 2000 22:06:15 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Weak References Was: Keeping a List of Objects
Message-Id: <8u218n$q0g$1@lublin.zrz.tu-berlin.de>

[posted and mailed]

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote in comp.lang.perl.misc:
>[A complimentary Cc of this posting was sent to Anno Siegel
><anno4000@lublin.zrz.tu-berlin.de>],
>who wrote in article <8u1ius$pjv$1@lublin.zrz.tu-berlin.de>:
>> Weak references seemed to work as expected in first tests, but
>> putting the mechanism under stress reveals that "experimental" is
>> there for a reason.  Stress in this case means that I ended up with
>> objects of two kinds -- those to which weak references exist, and
>> those which contain weak references -- some stored in lexical variables
>> and others in exported package variables[1].  In this situation I
>> got to see
>> 
>>   panic: magic_killbackrefs, <DATA> line 38 during global destruction (#1)
>
>Hmm...  As I designed it, weak references should work even when
>surviving until global destruction, though this is not supposed to be
>the primary way to use them.  Can you supply a short test script?

That may take a bit.  I haven't been able to reproduce the error
outside the rather involved original.  While trying to par it down
I'm seeing unexpected behavior of our() variables with respect to
destructors that is unrelated to WeakRef, but it's not yet clear if
it will lead to a slap on the forehead or a bug report.

Anno


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

Date: 04 Nov 2000 17:13:05 -0200
From: Jorge Godoy <godoy@conectiva.com>
Subject: XML::Parser and diacriticals
Message-Id: <kpr94rtuta.fsf@dagon.conectiva>


Hi!


I'm trying to use the module XML::Parser::PerlSAX and
XML::Grove::Builder to work with XML files. The problem is that
this module isn't working the right way with Latin letters either
using Latin-1 encoding or UTF-8.

For Latin-1, I have this error message:

Couldn't open encmap latin-1.enc:
File not found
 at /usr/lib/perl5/site_perl/5.6.0/i386-linux/XML/Parser.pm line 185


Using ISO-8859-1, there's no error message but the output from
Data::Dumper shows me that "José Alguém" becomes "José Alguém". 

Using XML::Simple, I have the same problem with XMLin(), when I can
read a file with such characters... 



Does anybody knows if this is a bug in XML::Parser or what can I do to
handle these files correctly?



Thanks!
-- 
Godoy. <godoy@conectiva.com>

Departamento de Publicações       Conectiva S.A.
Publishing Department             Conectiva Inc.


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

Date: Sat, 04 Nov 2000 19:58:02 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: XML::Parser and diacriticals
Message-Id: <t8q80tcl244mkrq6gkb0v5s2peul6r1uoo@4ax.com>

Jorge Godoy wrote:

>Using ISO-8859-1, there's no error message but the output from
>Data::Dumper shows me that "José Alguém" becomes "José Alguém". 

Well, that's ISO-Latin-1 turned into UTF8. You need to convert it back
to ISO-Latin-1.

Now, I haven't really found a module which makes that easy.
Unicode::Map, or something like it, is supposed to work, but I haven't
tried any of those. I have, until now, always used my own home grown
solution. Er... Unicode::MapUTF8 looks promising.

-- 
	Bart.


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

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


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