[23186] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5407 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 22 00:06:11 2003

Date: Thu, 21 Aug 2003 21:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 21 Aug 2003     Volume: 10 Number: 5407

Today's topics:
    Re: and Randal L. Schwartz the hacker <gregs@trawna.com>
    Re: and Randal L. Schwartz the hacker <matthew.garrish@sympatico.ca>
    Re: Anyway to Kill virus email on my Host Mailbox autom (David Efflandt)
    Re: Apache returns 200 OK, but my perl script sends 302 <jwillmore@cyberia.com>
    Re: comparison with functions ord and length <bharnish@technologist.com>
    Re: comparison with functions ord and length (Steve D)
    Re: Copy constructors <usenet@dwall.fastmail.fm>
    Re: imagemagick composite problem <mgjv@tradingpost.com.au>
    Re: IN SEARCH OF ELEGANT CODE: Setting a hash value to  <bart.lateur@pandora.be>
    Re: OT but hey <mpapec@yahoo.com>
    Re: perl zombies (aka ? the Platypus)
    Re: proto-type sub needs new ribbon ? (Jay Tilton)
    Re: proto-type sub needs new ribbon ? <bharnish@technologist.com>
    Re: Quick removal of the begging of a file? <mgjv@tradingpost.com.au>
    Re: simple regex <sholden@staff.cs.usyd.edu.au>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 21 Aug 2003 22:33:53 GMT
From: Greg Schmidt <gregs@trawna.com>
Subject: Re: and Randal L. Schwartz the hacker
Message-Id: <c4iakvke6pki2th9adk21k1i5n2ukgdm05@4ax.com>

On Thu, 21 Aug 2003 12:10:42 -0600, Eric Schwartz <emschwar@pobox.com>
wrote:

>Keith Keller <kkeller-spammmm@wombat.san-francisco.ca.us> writes:
>> Wow, you're bitter.  Did he crack your password of 12345?
>
>That's the stupidest combination I've ever heard in my life! That's
>the kind of thing an idiot would have on his luggage!

I was going to post that, but you have beaten me to it.  Seems fitting
that it would be posted by someone named Schwartz....

-- 
Greg Schmidt (gregs@trawna.com)
  Trawna Publications (http://www.trawna.com/)


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

Date: Thu, 21 Aug 2003 19:35:21 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: and Randal L. Schwartz the hacker
Message-Id: <cHc1b.548$PJ2.81006@news20.bellglobal.com>


"Greg Schmidt" <gregs@trawna.com> wrote in message
news:c4iakvke6pki2th9adk21k1i5n2ukgdm05@4ax.com...
> On Thu, 21 Aug 2003 12:10:42 -0600, Eric Schwartz <emschwar@pobox.com>
> wrote:
>
> >Keith Keller <kkeller-spammmm@wombat.san-francisco.ca.us> writes:
> >> Wow, you're bitter.  Did he crack your password of 12345?
> >
> >That's the stupidest combination I've ever heard in my life! That's
> >the kind of thing an idiot would have on his luggage!
>
> I was going to post that, but you have beaten me to it.  Seems fitting
> that it would be posted by someone named Schwartz....
>

I'm sure he is a little more security conscious than you give him credit
for. 12345 may be the password to his computer, but my guess would be his
luggage opens to the tune of 000.

Matt




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

Date: Fri, 22 Aug 2003 03:38:53 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Anyway to Kill virus email on my Host Mailbox automatically?
Message-Id: <slrnbkb42c.i6t.efflandt@typhoon.xnet.com>

On Wed, 20 Aug 2003 23:40:44 -0500, Dennis@NoSpam.com <Dennis@NoSpam.com> wrote:
> In the last two days I've been unindated with 100+ virus .pif and .scr
> attachment emails from forged return addresses.
> 
> The real address from the headers is SANJIVSA (dt140n11.tampabay.rr.com
> [24.92.192.17]) for all the virus emails.
> 
> I emailed abuse@rr.com over ten times with copies and headers of the virus email
> but to no avail.  They just ignore.
> 
> I would like to install a perl program on the Unix host computer that would
> search the headers of all incoming emails that are put into my mail box and
> delete the email with selected headers that I choose.
> 
> My Host computer is a Unix box and I have access to the mail client.  How would
> I go about installing a perl program to do the above?

So configure procmail recipes (see 'man procmail' and 'man procmailex').  
The following .procmairc recipes get rid of a bunch of worms.

:0
* ^Content-Transfer-Encoding:.*base64
* name=.*\.(bat|exe|pif|scr|vbs)
$TRASH

:0 B
* ^Content-Transfer-Encoding:.*base64
{
    :0 B
    * name=.*\.(bat|exe|pif|scr|vbs)
    $TRASH

    :0 B
    * name=.*your_details\.zip
    $TRASH
}

-- 
David Efflandt - All spam ignored  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: Fri, 22 Aug 2003 01:33:33 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: Apache returns 200 OK, but my perl script sends 302 REDIRECT
Message-Id: <20030821213310.5833a987.jwillmore@cyberia.com>

On Thu, 21 Aug 2003 21:07:23 +0200
Michel Tokic <michel@tokic.com> wrote:
> thanks for your help. My script is a little complicated, and calls
> some functions of a self written module. Depending on the
> parameters, it gives a special output to the user. But one function
> is, to relocate to a special site, when eg. the delete-function is
> called. Just to prevent, 
>   that the user don't can reload the page with the browsers built-in
>   
> reload-button.
> 
> So just doing generated HTML output isn't enough for me ;-)
> 
> Another idea?

Yes .... 

==TESTED==
#!perl

print "Location: http//www.foobar.com/intern/index.html\n\n";
==TESTED==

which was already posted in response to your question.

'302' is the proper code Apache (and every other web server in
compliance with the proper RFC's) is suppose to send   The above code
will redirect your clients.

Which version of CGI are you using?  You may need to upgrade the
module, because the 'redirect' method works fine for me (using version
3.0).

Now you have 2 "action items" to perform - try the code snippet above
and see if you have the latest and greatest version of CGI.

HTH

Jim


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

Date: Fri, 22 Aug 2003 01:30:38 GMT
From: Brian Harnish <bharnish@technologist.com>
Subject: Re: comparison with functions ord and length
Message-Id: <pan.2003.08.22.01.30.59.576010@technologist.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

On Thu, 21 Aug 2003 05:41:33 -0700, Bohne wrote:

> Can somebody explain the following to me?
> 
> if (int ((((ord($STRING) - 32) & 077) + 2) / 3) == int(length($STRING) / 4))
> 
> This case seems to be true if $STRING has been uuencoded, false otherwise.
> I just don't seen to be able to figure out why!

Yes, it does seem to verify the length of a uuencoded string is correct.

Remember the first character in a uuencoded string is the length of the
decoded string.

 - Brian
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/RXIGiK/rA3tCpFYRAjd7AKCtWtTUmY5umifhG5Ms0VEp1yh1bACdGE0h
DmpBRSUM0xrpDzwQeSIdbGE=
=gh93
-----END PGP SIGNATURE-----



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

Date: 21 Aug 2003 19:14:36 -0700
From: google.deller@smsail.com (Steve D)
Subject: Re: comparison with functions ord and length
Message-Id: <e41b2b3b.0308211814.7049e440@posting.google.com>

simjesse@aol.com (Bohne) wrote in message news:<bfedec4.0308210441.12103bf6@posting.google.com>...
> Can somebody explain the following to me?
> 
> if (int ((((ord($STRING) - 32) & 077) + 2) / 3) == int(length($STRING) / 4))
> 
> This case seems to be true if $STRING has been uuencoded, false otherwise.
> I just don't seen to be able to figure out why!

From man uuencode(5):

     The body consists of a number of lines, each at most 62
characters long
     (including the trailing newline).  These consist of a character
count,
     followed by encoded characters, followed by a newline.  The
character
     count is a single printing character, and represents an integer,
the num-
     ber of bytes the rest of the line represents.  Such integers are
always
     in the range from 1 to 45 or 64 and can be determined by
subtracting the
     character space (octal 40) from the character.  Character 64
represents a
     count of zero.

     Groups of 3 bytes are stored in 4 characters, 6 bits per
character.  All
     characters are always in range from 1 to 64 and are offset by a
space
     (octal 40) to make the characters printing.  Character 64
represents a
     count of zero.  The last line may be shorter than the normal 45
bytes.
     If the size is not a multiple of 3, this fact can be determined
by the
     value of the count on the last line.  Extra null characters will
be
     included to make the character count a multiple of 4.  The body
is termi-
     nated by a line with a count of zero.  This line consists of one
ASCII
     backquote (octal 140) character.

So all it is doing is taking the first character's value, subtracting
32 to get 1..45 or 64, and'ing with 077 to convert 64 to zero.  Adds
to so the divide rounds up, and divides by 3.  It then compares that
with the string length/4, which "ignores" the extra two characters
(length and newline) to give you the number of 4-char multiples.  That
should match the rounded up divide by 3 value if this was uuencoded.

Of course it's nowhere perfect, and there are going to be 63-character
strings that meet the algorithm.  That is, there will be false
positives, but no false negatives :-).

Regards,
Steve D


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

Date: Fri, 22 Aug 2003 02:37:23 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Copy constructors
Message-Id: <Xns93DEE6223A764dkwwashere@216.168.3.30>

"Bill Smith" <wksmith@optonline.net> wrote:

> "Joe Creaney" <mail@annuna.com> wrote in message
> news:3F44F19E.4070000@annuna.com...
>> I have been reading up in C++ about copy constructors, is it possable
>> to use them in perl.  I want to delete an object from one array and put
>> it in another array.  When I delete the object the object in the other
>> array goes away too.

> I recommend Damian Conway's book "Object Oriented Perl".  The section
> "Constructors as object duplicators" describes this problem and its
> solution from the Perl perspective.

Or maybe Clone.pm from CPAN or Storable.pm in the standard modules?



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

Date: 22 Aug 2003 01:34:36 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: imagemagick composite problem
Message-Id: <slrnbkaspe.1ng.mgjv@verbruggen.comdyn.com.au>

On Thu, 21 Aug 2003 19:33:38 +0200,
	Lam <lam-no-spamm-thanks@nospam.org> wrote:
> hi
> i have a problem to compose 2 images :
> the code :

That is, however, not all of your code. It is nicer, and more polite,
to post a full program that people can run. There's quite a bit of
editing to do to your code to fill in the blanks, before it can be run.

> my $effect_image = new Image::Magick;
> my $status = $effect_image->Read($image_before);
> die "Couldn't open file! $status" if $status;

You check for problems. Good idea.

> my $background = new Image::Magick;
> $background->Set(size => $x . "x" . $y);
> $background->ReadImage('xc:grayscale');

You don't check for problems here, however. Why not? And why do you
use ReadImage() here, but Read() earlier? They're the same thing.

$status = $background->Read('xc:grayscale');
die $status if $status;

You'll note that this is in error. Grayscale is not a colours; it's a
colour space. What did you want? Gray?

$status = $background->Read('xc:gray');
die $status if $status;

> Exception 410: Reference is not my type (Image::Magick) at ... 
> 
> any idea ? 

You need to check for errors earlier and more often.


Also see http://www.imagemagick.org/www/perl.html


Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | 42.6% of statistics is made up on the spot.
                        | 


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

Date: Fri, 22 Aug 2003 01:43:21 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: IN SEARCH OF ELEGANT CODE: Setting a hash value to a chomp'ed thing
Message-Id: <d9takvo352aosmhu5glc4n0itcr56kotsf@4ax.com>

David Filmer wrote:

>I can do this:
>
>   chomp($ps = `which ps`);   #chomp that system-call linefeed!
>   %hash = ('key' => $ps);
>
>but what I really want to do is something like this:
>
>   %hash = ('key' => chomp `which ps`);

	chomp($hash{key} = `which ps`);

-- 
	Bart.


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

Date: Fri, 22 Aug 2003 00:44:30 +0200
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: OT but hey
Message-Id: <0cgakv4k7cejul5l68jfb7jqje497iloju@4ax.com>

X-Ftn-To: hudson 

hudson <scripts_you_know_the_drill_@hudsonscripting.com> wrote:
>>so everybody can stop by. You can even get yourself a resume homepage with
>>all details. :)
>>
>>-- 
>>Matija
>
>fine, I'll take the bait...thanks Matija, are you a virus writer?
>anyway, here's some info that is probably you:
>
>mpapec sail.hr, adresa: Bezimena bb 
>tel.: 098/820 195 
>
>Matija Papec
> 
>Croatia [Hrvatska]
>matija.papec@bonus.fido.hr 

Bravo Sherlock, you just discovered what is my name; did you read it from
your news reader? :> I see you are little confused so you didn't notice that
you're the only one who wants to be anonymous.. Get yourself a real name
script kidie.

[fut a.f.]

-- 
Matija


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

Date: Thu, 21 Aug 2003 22:20:11 GMT
From: "David Formosa (aka ? the Platypus)" <dformosa@dformosa.zeta.org.au>
Subject: Re: perl zombies
Message-Id: <slrnbkahcs.1hr.dformosa@dformosa.zeta.org.au>

On Thu, 21 Aug 2003 01:07:00 -0700, hudson <none@example.com> wrote:

[...]

> geez...I have no idea that someone had a medical condition.
> 
> the page is 404, by the way

My server was down, which would have caused an error other then a 404.

[...]

>>David is nice guy,

Thanks.

>> he was the perl beachhead amongst the 
>>python programmers in our department...
> 
> you know what...David called me ignorant,

Because you act in a mannor which indercates you lack knolige.

> so I still think he is a
> prick regardless of his condition....

From you that is a high compliment. 

-- 
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.


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

Date: Fri, 22 Aug 2003 01:40:21 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: proto-type sub needs new ribbon ?
Message-Id: <3f457443.101527620@news.erols.com>

stuseven@hotmail.com (stu7) wrote:

:    With Perl 5.6, I'm trying to use prototypes and a new
:  subroutine...

I don't have 5.6 handy, but I don't think subroutine prototyping was
changed between 5.6 and 5.8.  YMMV.

:      sub testproto($) { subroutine here }
: 
:     With this, I tried to use the actual "prototype" call...
: 
:      prototype testproto ;

Do you expect something to happen when the prototype() function is
called in void context?

:       and I also tried   
:      print prototype testproto;

Try it again with real syntax that doesn't make perl barf.

    print prototype( 'testproto' );

or

    print prototype( \&testproto );

:   however, the subroutine output seems unaffected regardless of
:  what parameters are sent... $a or @Arr...

Whether that behavior is correct or not depends on what the subroutine
actually does with its arguments, but passing a scalar or an array
causes the sub to receive very different arguments.

    sub testproto($) {
        print "testproto received args: @_\n";
    }

    my $a = 'foo';
    testproto( $a ); # prints "testproto received args: foo"
    
    my @Arr = 'foo';
    testproto( @Arr ); # prints "testproto received args: 1"



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

Date: Fri, 22 Aug 2003 01:42:38 GMT
From: Brian Harnish <bharnish@technologist.com>
Subject: Re: proto-type sub needs new ribbon ?
Message-Id: <pan.2003.08.22.01.43.00.480880@technologist.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

On Thu, 21 Aug 2003 14:14:51 -0700, stu7 wrote:

> +
>    With Perl 5.6, I'm trying to use prototypes and a new
>  subroutine...
> 
>      sub testproto($) { subroutine here }
> 
>     With this, I tried to use the actual "prototype" call...
> 
>      prototype testproto ;
>       and I also tried   
>      print prototype testproto;
> 
>   however, the subroutine output seems unaffected regardless of
>  what parameters are sent... $a or @Arr... and the prototype command
>  doesnt seem to return anything at all.
> 
>      Am I using these correctly, or isnt prototyping of this kind
>  working in Perl yet ?

Try posting some real code so the rest of us can see your exact problem!

#!perl -wl
use strict;
sub mypush(\@@) {return @_}
print "Version: $]";
print prototype \&mypush;
my@x=(1..5);
print mypush(@x,3,4,5)
__END__

I get this:
Version: 5.006001
\@@
ARRAY(0x8100010)345

Seems to work fine to me.

 - Brian
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/RXUciK/rA3tCpFYRAhP1AJ9HpbLEXaOIJmaWaz+FKCUs47jQmACfbKaK
2ZZcPMmAwOnYtBhwr+6LATM=
=NAqT
-----END PGP SIGNATURE-----



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

Date: 22 Aug 2003 01:20:39 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Quick removal of the begging of a file?
Message-Id: <slrnbkarv9.1ng.mgjv@verbruggen.comdyn.com.au>

On Thu, 21 Aug 2003 14:05:07 -0400,
	Ted Zlatanov <tzz@lifelogs.com> wrote:
> On Tue, 19 Aug 2003, ben.goldberg@hotpop.com wrote:
> 
>>> >  scalar(<FH>); # skip to the end of the line.
>> 
>> I got the idea of skipping to the end of the line this way from
>> look.pl.
> 
> Doesn't this cause the whole file to be put into memory temporarily?

No. Just one line.

> Why not just seek(FH, 0, SEEK_END)? It's O(1) * as opposed to any O(n)
> solution that loops through the lines of the file.

Because the seek() seeks to the end of the file, instead of the end of
the line. It's a different thing. 

If the OP reallty did want to seek to the end of the file, and not
just the end of the line, then I apologise for intruding. I couldn't
get enough history on this thread from my news server to determine.

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | The gene pool could use a little chlorine.
                        | 


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

Date: 22 Aug 2003 01:50:49 GMT
From: Sam Holden <sholden@staff.cs.usyd.edu.au>
Subject: Re: simple regex
Message-Id: <slrnbkatnp.dc9.sholden@staff.cs.usyd.edu.au>

On Thu, 21 Aug 2003 15:43:04 -0000,
	David K. Wall <usenet@dwall.fastmail.fm> wrote:
> Thens <thens@nospam.com> wrote:
> 
>> perl -pe 's,\[|\]|^-,,g' file 
> 
> The OP also said s?he might want to eliminate the lines with dashes:
> 
>     perl -ne "next if /^-/; s,\[|\]|,,g; print" file
> 
> I don't use one-liners much, and was initially puzzled that 'next' 
> didn't give me the expected results until I noticed that -p puts the 
> print in the implicit while(){} in a continue{} block. Caveat luser. 
>:-)

I'd use something like:

perl -ne "tr/[]//d;print unless /^-/" file

or

perl -ne "print unless tr/[]//d,/^-/" file

I much prefer "print unless ..." to "next if ...;print". Though using
next does allow to avoid the s// or tr// operation, but the string
is two characters long so it isn't going to be an expensive op.
And using s// when tr// will do the job only adds to the complexity.

-- 
Sam Holden



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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


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


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