[18873] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1041 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 2 03:05:50 2001

Date: Sat, 2 Jun 2001 00:05:11 -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: <991465511-v10-i1041@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 2 Jun 2001     Volume: 10 Number: 1041

Today's topics:
    Re: 1 milj passwords (Jim Scavok)
    Re: 1 milj passwords (Craig Berry)
    Re: 1 milj passwords <krahnj@acm.org>
        Can anyone find the problem with this script ?!?!?! <reply@group.thanx>
    Re: Can anyone find the problem with this script ?!?!?! <somewhere@in.paradise.net>
        date calc modules <chickenmilkbomb@hotmail.com>
    Re: date calc modules <krahnj@acm.org>
    Re: Emailing from a script <denverlynx@hotmail.com>
    Re: Emailing from a script (Martien Verbruggen)
    Re: Fcntl usage with tie? (Martien Verbruggen)
    Re: Fcntl usage? (Martien Verbruggen)
    Re: Flame,help or killfile ? <godzilla@stomp.stomp.tokyo>
    Re: Frustrated people (not) answering questions <comdog@panix.com>
    Re: Frustrated people (not) answering questions <godzilla@stomp.stomp.tokyo>
    Re: Help slim down Perl code <uri@sysarch.com>
    Re: HTTP::Request GET (Eric Bohlman)
    Re: Komodo <godzilla@stomp.stomp.tokyo>
    Re: Komodo <wyzelli@yahoo.com>
    Re: Komodo <godzilla@stomp.stomp.tokyo>
    Re: Komodo <wyzelli@yahoo.com>
    Re: Learning perl - llama book <phil.dobbin@btinternet.com>
        Newbie question ... (Paul Cho)
    Re: Newbie question ... (Martien Verbruggen)
    Re: perlcc <spam_me@spam.com>
    Re: perlcc <spam_me@spam.com>
    Re: perlcc (Martien Verbruggen)
        taint + netstat = error <ryantate@OCF.Berkeley.EDU>
    Re: Why this substitution doesn't work? <fei@unbounded.com>
        xslint <timster@worldnet.att.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 1 Jun 2001 20:46:12 -0700
From: cperljim@yahoo.com (Jim Scavok)
Subject: Re: 1 milj passwords
Message-Id: <ae37778f.0106011946.4fc9befa@posting.google.com>

> I like to produce 1.000.000 12 char passwords in one time with not on the
> same.
> Don't know how to do this in high speed.
> How to do this.
> 
> I created a script but this generates 100 the same again and again.

This generates numeric passwords. You can use this code as a starting
point for generating character passwords.

#!/usr/bin/perl -w

# This generates unique NUMERIC `passwords'

use strict;

# change this to the quantity desired
my $needed = 50;

# password will consist of 3 parts;
my ($pt1, $pt2, $pt3);
# and each part will have 4 digits
my $digits = 12;

my $maybe;

# will contain unique passwords
my %pwd;

sub prepend_zero {
    my $num = shift;
    if      ($num <   10) {
        $num = "000" . $num;
    } elsif ($num <  100) {
        $num =  "00" . $num;
    } elsif ($num < 1000) {
        $num =   "0" . $num;
    }
    return $num;
}

HELL:
while ($needed--)
{
    $pt1 = int(rand(10000));
    $pt2 = int(rand(10000));
    $pt3 = int(rand(10000));

    $pt1 = prepend_zero($pt1);
    $pt2 = prepend_zero($pt2);
    $pt3 = prepend_zero($pt3);    
 
    $maybe = $pt1 . $pt2 . $pt3;
    redo if ( exists( $pwd{$maybe} ) );
    
    my @nums = split //, $maybe, $digits;
    for (my $i = 0, my $j = 1; $j < $digits; $i++, $j++)
    {
        redo HELL if ($nums[$i] == $nums[$j]);
    }
    $pwd{$maybe} = 1; 
}

print "$_\n" foreach (sort keys %pwd);

__END__


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

Date: Sat, 02 Jun 2001 03:46:31 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: 1 milj passwords
Message-Id: <thgocnp6oam229@corp.supernews.com>

sjaak nabuurs (sjaaknabuurs@hetnet.nl) wrote:
: I like to produce 1.000.000 12 char passwords in one time with not on the
: same.
: Don't know how to do this in high speed.

printf "%012d\n", $_ foreach 1 .. 1_000_000;

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "God becomes as we are that we may be as he is."
   |               - William Blake


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

Date: Sat, 02 Jun 2001 06:15:55 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: 1 milj passwords
Message-Id: <3B1884B5.982D6FE1@acm.org>

Jim Scavok wrote:
> 
> > I like to produce 1.000.000 12 char passwords in one time with not on the
> > same.
> > Don't know how to do this in high speed.
> > How to do this.
> >
> > I created a script but this generates 100 the same again and again.
> 
> This generates numeric passwords. You can use this code as a starting
> point for generating character passwords.
> 
> #!/usr/bin/perl -w
> 
> # This generates unique NUMERIC `passwords'
> 
> use strict;
> 
> # change this to the quantity desired
> my $needed = 50;
> 
> # password will consist of 3 parts;
># my ($pt1, $pt2, $pt3);
> # and each part will have 4 digits
># my $digits = 12;
> 
> my $maybe;
> 
> # will contain unique passwords
> my %pwd;
> 
># sub prepend_zero {
>#     my $num = shift;
>#     if      ($num <   10) {
>#         $num = "000" . $num;
>#     } elsif ($num <  100) {
>#         $num =  "00" . $num;
>#     } elsif ($num < 1000) {
>#         $num =   "0" . $num;
>#     }
>#     return $num;
># }
> 
> HELL:
> while ($needed--)
> {
>#     $pt1 = int(rand(10000));
>#     $pt2 = int(rand(10000));
>#     $pt3 = int(rand(10000));
># 
>#     $pt1 = prepend_zero($pt1);
>#     $pt2 = prepend_zero($pt2);
>#     $pt3 = prepend_zero($pt3);
># 
>#     $maybe = $pt1 . $pt2 . $pt3;

    my $maybe = sprintf '%04d%04d%04d', rand(10000), rand(10000),
rand(10000);


>     redo if ( exists( $pwd{$maybe} ) );
> 
>#     my @nums = split //, $maybe, $digits;
>#     for (my $i = 0, my $j = 1; $j < $digits; $i++, $j++)
>#     {
>#         redo HELL if ($nums[$i] == $nums[$j]);
>#     }

    redo if $maybe =~ /(.)\1/;


>     $pwd{$maybe} = 1;
> }
> 
> print "$_\n" foreach (sort keys %pwd);
> 
> __END__







-- 
use Perl;
program
fulfillment


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

Date: Sat, 2 Jun 2001 00:40:26 -0400
From: "SilverSting" <reply@group.thanx>
Subject: Can anyone find the problem with this script ?!?!?!
Message-Id: <9f9qnu$l0m$1@dns3.cae.ca>

Here is my script, write form info to text file.  Can anyone help me with
errors.

#!/usr/bin/perl

#General Variables
$time = localtime;

#Get Form Info
$firstname = param(fname);
$lastname  = param(lname);
$company   = param(company);
$mailaddrs = param(email);
$phonenum  = param(phone);
$faxnum    = param(fax);
$pagesnum  = param(numpg);
$imagenum  = param(numimg);
$prodsales = param(sales);
$website   = param(site);
$siteloc   = param(siteloc);
@services  = param(sitetype);
$compete   = param(competition);
$comment   = param(commets);

#Open Text File
open(CLIENTINFO,">>client.txt");

#Write to Text File
print CLIENTINFO "\n\n*****  New Quote Request Recieved  *****\n";
print CLIENTINFO "            $time \n\n";
print CLIENTINFO "Company Name Requesting Quote   ====> $company.\n";
print CLIENTINFO "Contact Person with Company     ====> $firstname
$lastname.\n";
print CLIENTINFO "Contact Methods, Telephone Num  ====> $phonenum.\n";
print CLIENTINFO "                       Fax Num  ====> $faxnum.\n";
print CLIENTINFO "                 E-mail Address ====> $mailaddrs.\n\n";
print CLIENTINFO "Web Site Specifications.\n";
print CLIENTINFO "              Number of Pages   ====> $pagesnum.\n";
print CLIENTINFO "              Number of Images  ====> $imagenum.\n";
print CLIENTINFO "              Sale of Products  ====> $prodsales.\n\n";
print CLIENTINFO "Current Web Site.\n";
print CLIENTINFO "              Site Existence    ====> $website.\n";
print CLIENTINFO "              Site URL Address  ====> $siteloc.\n";
print CLIENTINFO "              Site Competition  ====> $compete.\n\n";
print CLIENTINFO "Services and Requests Needed.\n";
print CLIENTINFO "              Service Request   ====> @services\n";
print CLIENTINFO "              Client Comments   ====> $comment\n";

#Close Text File
close(CLIENTINFO);

#Client Acceptance
print "<center><strong>"
print "Thank you for your request, you should hear from us with 24-48
hours."
print "</strong></center>"











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

Date: Sat, 2 Jun 2001 16:55:00 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: Can anyone find the problem with this script ?!?!?!
Message-Id: <o50S6.7$rz2.446517@news.interact.net.au>


"SilverSting" <reply@group.thanx> wrote in message
news:9f9qnu$l0m$1@dns3.cae.ca...
> Here is my script, write form info to text file.  Can anyone help me with
> errors.

What errors?  Very helpful to specify what they are.

>
> #!/usr/bin/perl
use CGI;






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

Date: Sat, 02 Jun 2001 05:06:51 GMT
From: "Rob Parker" <chickenmilkbomb@hotmail.com>
Subject: date calc modules
Message-Id: <20010601.220727.1447267605.14429@marley.wntck1.sfba.home.com>

I am looking for a module that will allow me to calulate dates in the
future. I need to take the current date (or any arbitrary date) and
calculate the settlement date for a trade 3 *business* days in the
future. 

For example a trade placed on 5/31/2001 will settle after  3 business
days -  6/4/2001 (skipping the weekend). I have a list of holidays, so
that is not a problem.

If a module does not exist to help with this, should I just use
localtime($currentTime + $(variable = however many milliseconds makes up 3 days))
and account for weekends and holidays?   Something like the
GregorianCalendar class in Java? Any ideas? 

By the way, I am an experienced java programmer - I picked up Beginning
Perl a couple of weeks ago and Programming Perl yesterday. I am really
excited about learning Perl - what I have seen so far has been really
cool. Finally - another language that is portable, easy to use. I always
loved that fact that java was so much more than just a language - really
a technology when you include the api's (JDBC, Swing, Mail, Servlet,
etc.) From what I have seen so far, Perl is the same way. It is a shame
that a lot of people see both languages as web tools when they are so
much more. 

P.S - I just ran the Perl programs that I wrote on a Solaris workstation
on my Debian box at home (without any changes) and I think that they ran
faster on my PIII 550! 
$systemPrice  = $SunA10{"SCSI_512MB_RAM"} + $license + $support  - $pIII550{"IDE_512MB_RAM"};
print "\$$systemPrice\n";
$39700
WOW!

P.S.S - I do miss the 21 inch LCD at work...

Thanks for any help!


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

Date: Sat, 02 Jun 2001 06:29:37 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: date calc modules
Message-Id: <3B1887EE.25691A88@acm.org>

Rob Parker wrote:
> 
> I am looking for a module that will allow me to calulate dates in the
> future. I need to take the current date (or any arbitrary date) and
> calculate the settlement date for a trade 3 *business* days in the
> future.
> 
> For example a trade placed on 5/31/2001 will settle after  3 business
> days -  6/4/2001 (skipping the weekend). I have a list of holidays, so
> that is not a problem.

Perhaps the Date::Business module is what you need?

http://search.cpan.org/search?dist=Date-Business

Visit CPAN for all your module needs.


> [snip]
> 
> P.S.S - I do miss the 21 inch LCD at work...

Now you're just being cruel.  :)



John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 02 Jun 2001 03:30:04 -0000
From: S E <denverlynx@hotmail.com>
Subject: Re: Emailing from a script
Message-Id: <thgnds6nam762c@corp.supernews.com>

Ok, I gave that a try but I then received this error message which I 
having a hard time trying resolve.

Thanks

Rafael Garcia-Suarez wrote:
> 
> 
> S E wrote in comp.lang.perl.misc:
> } Hi,
> } 
> } I am using the below script to send a email with a attachment.  But, 
when 
> } the email to: multiple users I would like the userids to appear on the 
> } same line as you see in most emails.  But, this is the only way I know 
how 
> } to get them on the email currently.  Is there a more efficient way to 
do 
> } this?
> } 
> } #!/usr/local/bin/perl5.6
> } use lib "lib";
> } use MIME::Lite;
> } MIME::Lite->send('smtp', "gp-dragon", Timeout=>180);
> } 
> } $msg = new MIME::Lite
> }      From     => 'somebody@gwl.com',
> }      To       => 'glcomm@gwl.com',
> }      To       => 'prodsupp@gwl.com',
> 
> Try a single 'To' field :
>        To       => (join ', ', 'glcomm@gwl.com', 'prodsupp@gwl.com'),
> 
> -- 
> Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


--
Posted via CNET Help.com
http://www.help.com/


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

Date: Sat, 2 Jun 2001 14:58:41 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Emailing from a script
Message-Id: <slrn9hgsk1.tjn.mgjv@martien.heliotrope.home>

[Please, in the future, post your reply after the suitably trimmed down
text you reply to. It's the generally accepted convention on this
newsgroup and Usenet in general.]

[Post re-ordered according to chronogy, and trimmed down]

On Sat, 02 Jun 2001 03:30:04 -0000,
	S E <denverlynx@hotmail.com> wrote:
> Rafael Garcia-Suarez wrote:
>> 
>> S E wrote in comp.lang.perl.misc:
>> } 
>> }                              I would like the userids to appear on the 
>> } same line as you see in most emails.  But, this is the only way I know how 
>> } to get them on the email currently.  Is there a more efficient way to do 
>> } this?
>> 
>> Try a single 'To' field :
>>        To       => (join ', ', 'glcomm@gwl.com', 'prodsupp@gwl.com'),
>> 
> Ok, I gave that a try but I then received this error message which I 
> having a hard time trying resolve.

What error message? I am having a terrible time trying to resolve that
error message you're getting, simply because I don't know it. And if you
send in the erro message, also include the code that produces it. It may
simply be some typo.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I took an IQ test and the results
Commercial Dynamics Pty. Ltd.   | were negative.
NSW, Australia                  | 


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

Date: Sat, 2 Jun 2001 14:34:14 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Fcntl usage with tie?
Message-Id: <slrn9hgr66.tjn.mgjv@martien.heliotrope.home>

On Thu, 31 May 2001 12:38:21 +0100,
	Mark Grimshaw <m.grimshaw@salford.ac.uk> wrote:

[Post re-ordered to accord with chronology]

> Bart Lateur wrote:
>> 
>> Mark Grimshaw wrote:
>> 
>> >if(!(%DB = $db->open_db('test.db', "O_RDONLY")))
>> 
>> Drop the quotes. O_RDONLY is a "constant", i.e. a sub. For example,
>> O_RDONLY() should work
>> 
>> --
>>         Bart.
>
> That's done it - thanks!  Strange though - what started this enquiry off
> was strict complaining about barewords when I used O_RDONLY without the
> quotes.  Now I get no complaints with:
> if(!(%DB = $db->open_db('test.db', O_RDONLY)))
> 

Ah, I found the other thread about this..

I think you probably have (had) two unrelated problems.

1) You used O_RDONLY without correctly including Fcntl at some point in
the past, or you misspelled it  (which AFAICT would be the only way the
bareword would be rejected by strict).

2) You quoted O_RDONLY.

The two above are unrelated errors, and are probably just confusing the
issue.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.   | accept as reality - Calvin
NSW, Australia                  | 


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

Date: Sat, 2 Jun 2001 13:13:44 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Fcntl usage?
Message-Id: <slrn9hgmf8.tjn.mgjv@martien.heliotrope.home>

On Fri, 01 Jun 2001 11:35:37 +0100,
	Mark Grimshaw <m.grimshaw@salford.ac.uk> wrote:
> Hi,
> 
> Thanks for having patience with me....
> 
>> As you can see, neither -w or strict have any problems with this. I'm
>> still wondering what your original problem is, if it isn't that the
>> constants aren't defined...
>> 
>> Could you submit some code that, for you, gives warnings, and/or
>> errors?
> 
> 1/
> I have these snippets of code from a CGI package:
> 
> ##############
> use Fcntl;
>         if(!($lockuserdb = &q_tiedb(\%USER, $q_userdb, O_RDONLY, 0444)))
>         {
>                 return $lockuserdb;
>         }
> 
> sub q_tiedb
> {
> my($D, $dbb, $modea, $modeb) = @_;  
>         tie(%{$D}, DB_File, $dbb, $modea, $modeb) || return 0;
>         return &q_lock_files($dbb);
> }
> ###############

I can't actually try to run this code, since it's part of a larger whoe
which I don't have, so I'll have to rely on my (fallible) Perl code
reading skills.

Some style notes: You don't need the ampersands in front of the sub
calls. Nowadays it's generally adviced to leave them off. Using them
changes call semantics a little bit (see perlsub), and you're telling
perl to not check for prototypes. In most cases that's ok, but it can
bite you at times.

> q_lock_files simply returns the path/name of a temporary file I use for
> locking purposes or 0 for failure (could've used flock but, in this
> case, didn't).

And if you use existence of that file as a lock, then you have a race
condition. You should really use flock. Or, you could use sysopen with
O_CREAT, but I don't know how portable the atomicity of that is
guaranteed to be. flock was meant for this, you should probably use it.

> The code above all works but fills my apache error log with the usual
> warning about O_RDONLY being non-numeric etc.

Well, it may be usual for you, but it isn't for me :)

Where does Perl give the warning? at the line where the tie actually
happens? Have you tried inspecting what $modea is at that point? If all
your calls are correct, it should be equal to O_RDONLY, but since you
have more code than this, there may be other, malformed calls.

$modea should be a number, not the string O_RDONLY. I can only imagine
the warning appearing at the tie, which means that perl has actually
passed the string "O_RDONLY" into $modea. This means that you are either
not using strict and -w, and the constant isn't imported, or you are
quoting the O_RDONLY, or you have a broken installation of Perl.  The
latter is unlikely, so I would expect one of the others. You are sure
that the use Fcntl; is done _before_ the use of O_RDONLY?

it would really be helpful if you could, instead of only looking at your
large program, break it down in the little bit that gives you problems.
Write a self-contained small program that displays the problem. That
will almost always show you what is wrong, and if it doesn't, it at
least gives you something to show us, which we can actually compile and
run ourselves.

> In the parallel universe that is the other post I made about Fcntl after
> cancelling this original post, the following was given as the solution
> to the other code I was working on (and works without warnings):
> 
> 2/
> ##########
> That's done it - thanks!  Now I get no complaints with:
> use Fcntl;
> if(!(%DB = $db->open_db('test.db', O_RDONLY)))[snip].......
> 
> # this is called from an external package
> sub open_db
> {
> my $self = shift;
> my @input = @_;
> my %DB;
>         tie(%DB, 'DB_File', $input[0], $input[1]) || return 0;
>         return %DB;
> }
> 
> Bart Lateur wrote:
>> 
>> Mark Grimshaw wrote:
>> 
>> >if(!(%DB = $db->open_db('test.db', "O_RDONLY")))

Wait a second. Here the O_RDONLY is quoted. You're sure that in the
actual code you're running it isn't quoted?

>> Drop the quotes. O_RDONLY is a "constant", i.e. a sub. For example,
>> O_RDONLY() should work
>> 
>> --
>>         Bart.
> ###############
> 
> I've snipped a lot of code and collated code from different
> scripts/packages in the interests of brevity (and, hopefully, clarity)
> but the point that puzzles me is why the first snippet above should give
> rise to warnings while the second, with what seems like the same usage
> of O_RDONLY, doesn't.

Well, if you have quotes, then perl just passes the string "O_RDONLY"
around. If you don't use quotes, then perl will see if it can find
something else with that name it needs to run, and a use Fcntl imports a
sub O_RDONLY() into your name space. This sub will be executed, and will
return a number.

> More puzzling (to me) is why the following does NOT complain (it uses
> the external package that has the subroutine q_tiedb no. 1/ above which,
> as explained above, DOES complain about O_RDONLY when called from within
> that package):

I'm still utterly confused about which calls what, what is where, and
which order things happen in.

Honestly, please try to write some small pieces of code, that together
form a working program with its libraries. Words really can't convey
what is going on. Code is the only thing that can. Snippets from a
larger whole are virtually useless, since no one knows what is in the
rest of that whole.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | That's not a lie, it's a
Commercial Dynamics Pty. Ltd.   | terminological inexactitude.
NSW, Australia                  | 


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

Date: Fri, 01 Jun 2001 18:51:34 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Flame,help or killfile ?
Message-Id: <3B1846A6.61B36174@stomp.stomp.tokyo>

buggs wrote:
 
> Considering the recent discussions on this topic
> you migth be interested in the following.
 
> See Simons article:
> http://www.perl.com/pub/2001/05/29/tides.html
 
> Reactions on the article:
> http://use.perl.org/article.pl?sid=01/06/01/048204&mode=flat&threshold=
 
> And a new site mentioned in the article:
> http://learn.perl.org
 

Those are very decent references! I really enjoyed
reading those sites; most encouraging! Thank you!

"I had held out hope for perlmonks to be a flame-free kind
 of place that welcomed others to answer, but its turned into
 the same quagmire that is comp.lang.perl.misc. Different cast,
 but same kinds of flames. I'm even beginning to enjoy the charm
 of Godzilla!, because even if she's wrong a lot of the time, 
 she's nice to newbies."


Ain't that about the truth. Only exception I take to this
is Clinton's obvious unfounded prejudice. My code is almost
always right and almost always more efficient than any code
posted here by others, save for a few, such as Randal. Be sure
you note my emphasis on "almost always" rather than always.

I believe it is about time for you boys to get over two
notions related to a fragile masculine ego. This weenie
wagging game you constantly play, really sucks. My other
notion is to develop enough backbone to admit there are
women who can program as well or better than men.

Here is a real life event which should strike deep
at the heart of your ethics. A few years back, my
forever nemesis and harasser within this group and
elsewhere on the net, my man/woman of a thousand
ugly mugs I know as Frank, said to a group of us
women, using one of his myriad fake personalities,

 "Today's computers are so easy to use, even the
  ladies can use them."


This could be a really great group if you boys
will dismount those high white mules upon which
you prance about in here. Enough mule manure
as it is.



Buggs, very thoughtful article! Clearly you do your
homework and care enough to add quality here.


Godzilla!


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

Date: Fri, 01 Jun 2001 22:16:41 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Frustrated people (not) answering questions
Message-Id: <comdog-15A3E5.22164101062001@news.panix.com>

In article <9f98p3$1a35$1@agate.berkeley.edu>, Ryan Travis Tate 
<ryantate@OCF.Berkeley.EDU> wrote:

[ discussing Matt W. ]

> and yet the world is a better place for his code :-) sort of like
> Outlook ... 

you'd have to go a long way to support either of those.  Outlook
cost the business sector billions of dollars in damages last
year said the New York Times.  that doesn't sound like a better
world.

Matt's code created a horrendous support burden on this
newsgroup and for many other Perl people, as well as quite
a bit of frustration on the part of his users.  i don't
consider that a better world.

-- 
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



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

Date: Fri, 01 Jun 2001 19:35:41 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Frustrated people (not) answering questions
Message-Id: <3B1850FD.C1266C38@stomp.stomp.tokyo>

brian d foy wrote:
 
> Ryan Travis Tate wrote:
 
> [ discussing Matt W. ]

(Matt Wright and his free scripts)
 
> > and yet the world is a better place for his code :-) sort of like
> > Outlook ...
 
(snipped)

> Matt's code created a horrendous support burden on this
> newsgroup and for many other Perl people, as well as quite
> a bit of frustration on the part of his users.  i don't
> consider that a better world.

It is a matter of personal perspective. Your champagne
glass is empty. My champagne glass is overflowing with
sparkling chilled champagne.

Dealing with Matt's early efforts at providing free
Perl scripts for all, has taught a lot of people,
a lot about Perl. Our Perl community is better off
thanks to Matt and his sincere efforts to provide
free scripts for any and all.


Godzilla!


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

Date: Sat, 02 Jun 2001 03:50:53 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Help slim down Perl code
Message-Id: <x7elt3zgip.fsf@home.sysarch.com>

>>>>> "SC" == Sweth Chandramouli <sweth> writes:

  SC> 	I guess the piece that I'm not getting is how to 
  SC> dynamically build the dispatch table in a way that doesn't use symrefs.
  SC> Every example of dispatch tables in Perl that I've seen "composes" them
  SC> manually, rather than generating them automatically from, say, a list or
  SC> a hash.

first, are you absolutely sure you have to build it dynamically? you
haven't made any strong argument for that, other than some nice way of
converting a list. do you have all the functions already written? if so,
then editing a dispatch table is no extra work. 

one case where this actually is needed is when you use AUTOLOAD to
create attribute accessor methods on the fly as they are
needed. creating all of them in advanced is annoying and can be prone to
mistakes. that does require symrefs and the usual idiom is like this:

sub AUTOLOAD
{
	no strict 'refs';

	my ( $self ) = @_ ;

	if ( $AUTOLOAD =~ /.*::(\w+)/ && $is_plain_attr{ $1 } ) {
		my $attr_name = $1;
		*{$AUTOLOAD} = sub {

			$_[0]->{$attr_name} = $_[1] if @_ > 1 ;
			return $_[0]->{$attr_name}
		} ;

		goto &$AUTOLOAD ;


that installs a closure as the accessor method for any allowed attribute
(that is what the %is_plain_attr has is for. i snipped code that
supports other possible methods).

as i said, make sure you really need symrefs and not that they may be a
possible solution. they should be used if they are (about) the only
solution. you haven't made any supporting argument about how that is the
only way to solve your problem. a dispatch table works just as well.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: 2 Jun 2001 07:01:12 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: HTTP::Request GET
Message-Id: <9fa2vo$e75$2@bob.news.rcn.net>

Maya <m.astrakhanskaya@gte.net> wrote:
> Basically, it contains user information selected from the database in which
> I have to send to the given URL

> this is the part of the code that does the sending:

>  $XMLReq = new HTTP::Request;
>  $TheAgent = new LWP::UserAgent;

>   $BaseURL =
> 'http://172.27.12.228/IBCMEntitlements/ESNICreateAppAccount.asp?MetaData=';

>   $Value = '$XML_string';

Is this real code or pseudocode?  If it's real code, your problem is right 
there, and it's glaringly obvious.  If it's pseudocode, how do you expect 
us to debug it?



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

Date: Fri, 01 Jun 2001 18:15:35 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Komodo
Message-Id: <3B183E37.C44B5F4A@stomp.stomp.tokyo>

Jerry wrote:

(snippage)

> I installed ActivePerl-5.6.1.626-MSWin32-x86-multi-thread.msi
> and Komodo-1.0.0-18562.msi and the license file for Komodo. 


> setup-env.tmp:
> TMP=c:\windows\TEMP
> TEMP=C:\windows\TEMP
> PROMPT=$p$g
> winbootdir=C:\WINDOWS
> COMSPEC=C:\WINDOWS\COMMAND.COM
> DJGPP=C:\DJGPP\DJGPP.ENV
> PATH=C:\PERL\BIN;C:\PERL\BIN;C:\WINDOWS;C:\WINDOWS\COMMAND;
       C:\DJGPP\BIN;C:\WINDOWS;C:\WINDOWS;C:\WINDOWS\COMMAND
> CMDLINE=WIN
> windir=C:\WINDOWS
> BLASTER=A220 I5 D1 T4


I have delibertately split one line in your env.tmp
to prevent word wrapping.

I know nothing about Komodo and don't care to know.
However, this file you display is totally screwed up.
It's precedence order is wrong, it sets environments
which are not needed and in some cases, very wrong.
There are duplicate entries, wrong formats; it is
really crazy crap.

It is suprising your machine still operates.

No way would I ever consider Komodo after
viewing this DOS batch file.


Godzilla!
--

This is an example of a typical and
correctly formatted batch file for
a Win 98 based machine.


@IF ERRORLEVEL 1 PAUSE
@ECHO OFF
SET BLASTER=A220 I5 D1 H5 P330  T6
SET CTSYN=C:\WINDOWS
C:\PROGRA~1\CREATIVE\SBLIVE\DOSDRV\SBEINIT.COM
PATH c:\windows;c:\windows\COMMAND
keyb br,,c:\windows\COMMAND\keyboard.sys
SET PATH=C:\APACHE\BIN;%PATH%


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

Date: Sat, 2 Jun 2001 11:08:25 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Komodo
Message-Id: <RiXR6.401$Ir4.3946@vic.nntp.telstra.net>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3B183E37.C44B5F4A@stomp.stomp.tokyo...
> Jerry wrote:
>
> (snippage)
>
> > I installed ActivePerl-5.6.1.626-MSWin32-x86-multi-thread.msi
> > and Komodo-1.0.0-18562.msi and the license file for Komodo.
>
>
> > setup-env.tmp:
> > TMP=c:\windows\TEMP
> > TEMP=C:\windows\TEMP
> > PROMPT=$p$g
> > winbootdir=C:\WINDOWS
> > COMSPEC=C:\WINDOWS\COMMAND.COM
> > DJGPP=C:\DJGPP\DJGPP.ENV
> > PATH=C:\PERL\BIN;C:\PERL\BIN;C:\WINDOWS;C:\WINDOWS\COMMAND;
>        C:\DJGPP\BIN;C:\WINDOWS;C:\WINDOWS;C:\WINDOWS\COMMAND
> > CMDLINE=WIN
> > windir=C:\WINDOWS
> > BLASTER=A220 I5 D1 T4
>
>
> I have delibertately split one line in your env.tmp
> to prevent word wrapping.
>
> I know nothing about Komodo and don't care to know.
> However, this file you display is totally screwed up.
> It's precedence order is wrong, it sets environments
> which are not needed and in some cases, very wrong.
> There are duplicate entries, wrong formats; it is
> really crazy crap.
>
> It is suprising your machine still operates.
>
> No way would I ever consider Komodo after
> viewing this DOS batch file.

Actually none of that is set by Komodo at all.

DJGPP is a C compiler.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Fri, 01 Jun 2001 18:54:43 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Komodo
Message-Id: <3B184763.52A1AEB9@stomp.stomp.tokyo>

Wyzelli wrote:
 
> Godzilla! wrote:
> > Jerry wrote:

> > (snippage)

(snipped my tirade on a piece of crap batch file)

> > No way would I ever consider Komodo after
> > viewing this DOS batch file.
 
> Actually none of that is set by Komodo at all.
 
> DJGPP is a C compiler.


Clearly your knowledge of batch files is not one of your strong points.


  "Getting Komodo startup environment delta from      
'C:\WINDOWS\Profiles\administrator\Application
   Data\ActiveState\Komodo\startup-env.tmp'."



Godzilla!


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

Date: Sat, 2 Jun 2001 15:15:33 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Komodo
Message-Id: <vW_R6.631$Ir4.5522@vic.nntp.telstra.net>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3B184763.52A1AEB9@stomp.stomp.tokyo...
>
> Clearly your knowledge of batch files is not one of your strong points.
>
>   "Getting Komodo startup environment delta from
> 'C:\WINDOWS\Profiles\administrator\Application
>    Data\ActiveState\Komodo\startup-env.tmp'."

Indeed, since that line came from the debug report posted by the OP, not the
batch file.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Sat, 02 Jun 2001 02:37:36 +0100
From: "Phil Dobbin" <phil.dobbin@btinternet.com>
Subject: Re: Learning perl - llama book
Message-Id: <9f9g0k$9di$1@uranium.btinternet.com>

My $0.2.
If you use a Mac try BBEdit as well as MacPerl. Their online manuals
concerning grep even managed to get my head 'round it.
Byeeee....
Phil:-)
--


----------
In article <3c36ac2c.0106011031.6d967d6a@posting.google.com>,
ctewksbury@mediaone.net (Chuck) wrote:


> I am just starting into Perl and have the Llama book and the Camel
> book... I am totally stuck on "regular expressions" and just want to
> know if I should
>
> a- re-read over and over and suddenly get it
>
> b- forge ahead and hope it sinks in later
>
> you pros and non-pros alike have thoughts on this?


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

Date: 1 Jun 2001 21:22:02 -0700
From: cybok@nobreak.com (Paul Cho)
Subject: Newbie question ...
Message-Id: <36e3e8b9.0106012022.8ab05c@posting.google.com>

Hello.
I have a sort of files that contains my PERL message board.
Each files have a message board data with some rule like below.

> 36csdewertrds.txt (There are over than 240 files exists with same constructure)
001||389e84a119ed0ca7|name|name@name.com|2000/02/07,17:38:57|Subject of message|Message contens

Here is what i inteded to.

I want list(or print on the web brouser) them like this.

001.Date=2000/02/07,17:38:57
001.Name=name
001.Email=name@name.com
001.Thread=0
001.Lines=2
001.Domain=local.host
001.Subject=Subject of message
001.Access=0
001.Text=Message contens

002.Date=2000/02/08,14:38:57
002.Name=other
002.Email=other@name.com
002.Thread=0
002.Lines=2
002.Domain=local.host
002.Subject=Subject of message2
002.Access=0
002.Text=Message contens2

 ....

And this is my perl source.


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

    opendir(DIR, "$BaseDir/$MesgDir");
        @list = grep(-T, /(.*).txt/, readdir(DIR));
    foreach $list(@list) {
         open(FILE, $list);
         while (<FILE>) {
           $data = <FILE>;
           @v = split(/\|/, $data);

          print "$v[0].Date=$v[5]\n";
          print "$v[0].Name=$v[3]\n";
          print "$v[0].Email=$v[4]\n";
          print "$v[0].Thread=0\n";
          print "$v[0].Lines=2\n";
          print "$v[0].Domain=61.74.200.81\n";
          print "$v[0].Subject=$v[6]\n";
          print "$v[0].Access=0\n";
          print "$v[0].Text=$v[7]\n";

         }

        close(FILE);

    }

    close(DIR);
    1;

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

Can anybody look into it?
it's not working.

Thanks...

--
Yeon Bok, Cho  <cybok@nobreak.com> Sales Manager.
"Whatever you can do, or dream you can, begin it.
Boldness has genius, power and magic in it."
http://www.CrazyWWWBoard.com ... http://www.cgiserver.net


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

Date: Sat, 2 Jun 2001 15:15:42 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Newbie question ...
Message-Id: <slrn9hgtju.tjn.mgjv@martien.heliotrope.home>

On 1 Jun 2001 21:22:02 -0700,
    Paul Cho <cybok@nobreak.com> wrote:

1) You need to start using -w
2) You need to start using strict.
3) You need to start using -w and strict.
4) Use -w and strict.
5) Always program with -w and strict, unless you know why not.

Did I mention that you probably should use -w and strict?

> 
>     opendir(DIR, "$BaseDir/$MesgDir");

Always check system calls and such for errors:

opendir(DIR, "$BaseDir/$MesgDir") or 
    die "Cannot opendir '$BaseDir/$MesgDir': $!"

>         @list = grep(-T, /(.*).txt/, readdir(DIR));

What is your goal here? To only get files with the extension .txt? or
only files that are "text files" according to -T? or both?

@list = grep { -T && /\.txt$/ } readdir(DIR);

-T is quite expensive. If you think you have files with a .txt extension
that contain something else than ascii text, maybe you should choose a
different extension.

AND:::: this will ONLY work if $BaseDir/$MesgDir happens to be your
current directory.

Readdir only contains the name of the file as it appears in the opened
directory. it does _not_ return the whole path. If you want the whole
path, maybe you should do something like this, instead of the line
earlier:

@list = grep { -T && /\.txt$/ } 
        map { "$BaseDir/$MesgDir" } 
        readdir(DIR);

This gives you the 'full' paths to the files in @list, so that your
opens later on also know where to get them,

Read about opendir, grep, -T and map in perlfunc, and about regular
expressions in perlre.

>     foreach $list(@list) {

I'd rather say something like:
    
    foreach my $file (@list) 
    {

but I'll leave $list in there.

>          open(FILE, $list);

See above:

            open(FILE, $list) or die "Cannot open '$file': $!"

>          while (<FILE>) {

Here you read a line in $_

>            $data = <FILE>;

And here you read the next line in $data.

Did you mean:

            while (my $data = <FILE>)
            {

instead?

Read perlop.

>            @v = split(/\|/, $data);
> 
>           print "$v[0].Date=$v[5]\n";
>           print "$v[0].Name=$v[3]\n";
>           print "$v[0].Email=$v[4]\n";
>           print "$v[0].Thread=0\n";
>           print "$v[0].Lines=2\n";
>           print "$v[0].Domain=61.74.200.81\n";
>           print "$v[0].Subject=$v[6]\n";
>           print "$v[0].Access=0\n";
>           print "$v[0].Text=$v[7]\n";

print <<EOFOO;
$v[0].Data=$v[5]
$v[0].Name=$v[3]
etc..
EOFOO

Look up here-docs in perldata.

> Can anybody look into it?
> it's not working.

Next time you have a problem, don't say "it isn't working". Say WHICH
bit isn't working, and what you need it to do. What do you expect? What
happens?

And please, LEARN to ask perl for help, by using -w, strict, and by
religiously checking all important function calls.

Also, you could have easily printed out the values in @list, to see if
there's anything there at all. You have several errors in your program,
each of which may have caused problems that you saw, but you didn't even
try to get any information from Perl itself. 

> Yeon Bok, Cho  <cybok@nobreak.com> Sales Manager.
> "Whatever you can do, or dream you can, begin it.
> Boldness has genius, power and magic in it."

So does Perl, once you use it correctly.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                  | 


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

Date: Fri, 1 Jun 2001 23:13:54 -0400
From: "MindReaper" <spam_me@spam.com>
Subject: Re: perlcc
Message-Id: <TRYR6.16133$sc4.776575@wagner.videotron.net>

what is perlcc?


Matt Freel a écrit dans le message <9f919h$1q71$1@msunews.cl.msu.edu>...
:I'm getting a fatal error 11 after about a half our of compiling.  Does
:anyone have any suggestions on this.  My code is about 5000 lines broken
:into 8 or 9 packages.  I need to get this into a stand alone binary.
Thanks
:for the help
:
:
:




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

Date: Fri, 1 Jun 2001 23:55:01 -0400
From: "MindReaper" <spam_me@spam.com>
Subject: Re: perlcc
Message-Id: <qsZR6.16503$sc4.798638@wagner.videotron.net>

ok now I know what is perlcc


then, is it easily reverse engineered? :)

because I could try to learn C/C++ instead... :)


MindReaper a écrit dans le message ...
:what is perlcc?
:
:
:Matt Freel a écrit dans le message <9f919h$1q71$1@msunews.cl.msu.edu>...
::I'm getting a fatal error 11 after about a half our of compiling.  Does
::anyone have any suggestions on this.  My code is about 5000 lines broken
::into 8 or 9 packages.  I need to get this into a stand alone binary.
:Thanks
::for the help
::
::
::
:
:




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

Date: Sat, 2 Jun 2001 15:20:30 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: perlcc
Message-Id: <slrn9hgtsu.tjn.mgjv@martien.heliotrope.home>

[Please do not top-post. Put your reply _after_ the suitably trimmed
down text you reply to.]

[Post re-ordered to fit chronology]

On Fri, 1 Jun 2001 23:55:01 -0400,
	MindReaper <spam_me@spam.com> answered himself in a brialliant
	monologue:
> MindReaper a écrit dans le message ...
>:Matt Freel a écrit dans le message <9f919h$1q71$1@msunews.cl.msu.edu>...
>::I'm getting a fatal error 11 after about a half our of compiling.  Does
>::anyone have any suggestions on this.  My code is about 5000 lines broken
>::into 8 or 9 packages.  I need to get this into a stand alone binary.
>:
>:what is perlcc?
> 
> ok now I know what is perlcc

Good. Why didn't you decide to check the documentation beofre posting
your question?

> then, is it easily reverse engineered? :)

You have the sources. Why would you want to reverse engineer perlcc?

> because I could try to learn C/C++ instead... :)

Huh?

If you have a question, please try to be clear. Also, read the perl FAQ,
section 3. It may actually answer some of the questions you are actually
trying to ask.

Martien
-- 
Martien Verbruggen              | My friend has a baby. I'm writing
Interactive Media Division      | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd.   | later I can ask him what he meant -
NSW, Australia                  | Steven Wright


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

Date: Sat, 2 Jun 2001 05:16:22 +0000 (UTC)
From: Ryan Tate <ryantate@OCF.Berkeley.EDU>
Subject: taint + netstat = error
Message-Id: <9f9sr6$1k64$1@agate.berkeley.edu>

i'm trying to figure out why i'm getting an 'Insecure dependency in
``' error when calling netstat within backticks while running in taint
mode. i'm not interpolating any variables inside the backticks, and i
get the error even when i call the program without any options. also,
perl doesn't mind when i call ps inside backticks.

a shortened version of my code is below. note that it will run fine if
i comment out the line containing the call to netstat. any comments
are appreciated!

---
#!/opt/local/bin/perl5.005 -wT

use strict;

$ENV{PATH}='/usr/bin';

unique_id();

sub unique_id{
    join("." => (
		 $0,
		 $$,     
		 time(),
		 unpack("%32L*", `ps -al`),
		 unpack("%32L*", `netstat -in`),       
#problem - Insecure dependency in `` while running with -T switch      
		 )
	 );
}
---

i've looked on deja and re-read my taint documentation and can't
figure out why taint doesn't like netstat ... do i have to give up on
this program?

cheers
r


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

Date: Sat, 02 Jun 2001 06:09:16 GMT
From: "fei" <fei@unbounded.com>
Subject: Re: Why this substitution doesn't work?
Message-Id: <gq%R6.54234$ko.794328@news1.frmt1.sfba.home.com>

thanks!
run the experiment you give me only print several empty line, but no sytax
error.

after several try, this did the work,
( exactly I want is to remove the whole line  if $ARGV[0]  in beginning of
the line. )
I was thinking too complicate:)

while(<IN>){

if(s/^$ARGV[0] .*//){
 chomp;   #remove the whole line
 }
 print;



"John W. Krahn" <krahnj@acm.org>
> Try experimenting with the qr// operator to see how Perl interprets your
> regular expressions.
>
> my $regex = qr/.*\$ARGV[0]\s.*/;
> print "$regex\n";
>
> Also have a look at the quotemeta funtion
>
> perldoc -f quotemeta
>





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

Date: Sat, 02 Jun 2001 05:46:41 GMT
From: Tim <timster@worldnet.att.net>
Subject: xslint
Message-Id: <3B1925C3.89929F2F@worldnet.att.net>

I want to download the xslint tool by Norman Walsh.  The accompanying
document says it needs XML::Parser and XML::DOM to run it.  I downloaded
XML::Parser from CPAN, but its README says that it needs the Expat
module.  I downloaded that.  Then the Expat's README says that it needs
5 other modules, and so on......  Argh!  Isn't there a document that
shows ALL dependencies of ALL Perl modules? Is there an easier way to do
this?  In particular...the xslint module?

-Tim




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

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


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