[29259] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 503 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 11 06:09:53 2007

Date: Mon, 11 Jun 2007 03:09:05 -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           Mon, 11 Jun 2007     Volume: 11 Number: 503

Today's topics:
    Re: a password encryption question. <joe@inwap.com>
    Re: Negative times in Spreadsheet::WriteExcel? <josef.moellers@fujitsu-siemens.com>
        new CPAN modules on Mon Jun 11 2007 (Randal Schwartz)
        parallel child processes not working properly  vkinger@hotmail.com
    Re: The Concepts and Confusions of Prefix, Infix, Postf <twisted0n3@gmail.com>
    Re: The Concepts and Confusions of Prefix, Infix, Postf <twisted0n3@gmail.com>
    Re: The Concepts and Confusions of Prefix, Infix, Postf <jo@durchholz.org>
    Re: The Concepts and Confusions of Prefix, Infix, Postf <jo@durchholz.org>
    Re: urgent:reading 2 files into 2 different $ variables <george.titus@gmail.com>
    Re: Useless use of array element in void context <mstep@podiuminternational.org>
    Re: Useless use of array element in void context <hjp-usenet2@hjp.at>
    Re: Useless use of array element in void context <mstep@podiuminternational.org>
    Re: Yet Another Software Challenge <joe@inwap.com>
    Re: Yet Another Software Challenge <joe@inwap.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 10 Jun 2007 18:35:12 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: a password encryption question.
Message-Id: <6dOdnavCKfVPO_HbnZ2dnUVZ_gednZ2d@comcast.com>

nightcats@gmail.com wrote:

>    @alphabet = ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '.', '/');
>    $salt = join ('', @alphabet[rand (64), rand (64)]);
> 
>    $password = "$FORM{'password'}";
>    $pass = crypt($password, $salt);
> 
> The ouput was a perfect result of random-crypted password.

That is as it should be.

> However, a new problem was created.
> 
> My Login.cgi could not read the ramdom-cryped password.
> The related script was,
> 
>    @alphabet = ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '.', '/');
>    $salt = join ('', @alphabet[rand (64), rand (64)]);

No.  The salt is supposed to be randomized when
the password is originally set; not when it is being compared.

>    if (crypt($password, $salt) ne $pwordlist{$FORM{'username'}})

   $password_on_record = $pwordlist{$FORM{username}};
   $salt = substr $password_on_record,0,2;
   if (crypt($password,$salt) ne $password_on_record)

	-Joe


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

Date: Mon, 11 Jun 2007 11:35:38 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Negative times in Spreadsheet::WriteExcel?
Message-Id: <f4j51c$m62$1@nntp.fujitsu-siemens.com>

jmcnamara@cpan.org wrote:
> On Jun 5, 12:49 pm, Josef Moellers <josef.moell...@fujitsu-
> siemens.com> wrote:
>=20
>>Hi,
>>
>>I'm trying to record time differences in an Excel spreadsheet, but I'm
>>unable to do this for negative differences:
>=20
>=20
>=20
> Hi,
>=20
> By default, Excel doesn't allow you to use negative times. You can see
> some information about this here:
>=20
>     http://www.google.com/search?hl=3Den&q=3Dexcel+negative+time
>=20
> One of the workarounds suggested in those links is to use the 1904
> time epoch in Excel. Here is a Spreadsheet::WriteExcel example:
>=20
[ ... ]
>=20
> For further questions see the Spreadsheet::WriteExcel group:
>=20
>     http://groups.google.com/group/spreadsheet-writeexcel

Thanks, that indeed does the trick ... in Excel. When I view the sheet=20
in OpenOffice, it still shows some positive times within the cell and=20
"-00:10:00" in the edit line on top :-O
I am surprised that this isn't something that more people stumble across.=


Josef
--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html



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

Date: Mon, 11 Jun 2007 04:42:15 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Jun 11 2007
Message-Id: <JJGFqF.2Ip@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

AI-NeuralNet-SOM-0.02
http://search.cpan.org/~drrho/AI-NeuralNet-SOM-0.02/
Perl extension for Kohonen Maps 
----
ASNMTAP-3.000014
http://search.cpan.org/~asnmtap/ASNMTAP-3.000014/
----
Acme-FizzBuzz-0.02
http://search.cpan.org/~yappo/Acme-FizzBuzz-0.02/
The FizzBuzz program can be written shortest 
----
Apache2-AuthHatena-0.01
http://search.cpan.org/~danjou/Apache2-AuthHatena-0.01/
Simple authentication mod_perl module using Hatena Auth API 
----
Apache2-AuthHatena-0.02
http://search.cpan.org/~danjou/Apache2-AuthHatena-0.02/
Simple authentication mod_perl module using Hatena Auth API 
----
Apache2-AuthHatena-0.03
http://search.cpan.org/~danjou/Apache2-AuthHatena-0.03/
Simple authentication mod_perl module using Hatena Auth API 
----
Apache2-Autocomplete-0.11
http://search.cpan.org/~rkobes/Apache2-Autocomplete-0.11/
Autocomplete service backend via mod_perl 
----
Astro-SpaceElevator-0.03
http://search.cpan.org/~dbrooks/Astro-SpaceElevator-0.03/
Model a Space Elevator 
----
Audio-M4P-0.35
http://search.cpan.org/~billh/Audio-M4P-0.35/
M4P/MP4/M4A QuickTime audio music format modules 
----
Audio-M4P-0.351
http://search.cpan.org/~billh/Audio-M4P-0.351/
Perl QuickTime / MP4 tools, now (alpha) strips personal ID information from Apple .m4a filea 
----
Bundle-Dependencies-Catalyst-0.04
http://search.cpan.org/~ski/Bundle-Dependencies-Catalyst-0.04/
installs non-Catalyst prereqs 
----
Class-DBI-Form-00.03
http://search.cpan.org/~ebruni/Class-DBI-Form-00.03/
Convert Class::DBI record in HTML form field. 
----
Class-Trigger-0.11_02
http://search.cpan.org/~miyagawa/Class-Trigger-0.11_02/
Mixin to add / call inheritable triggers 
----
Devel-PDB-0.01
http://search.cpan.org/~ivanwong/Devel-PDB-0.01/
A simple Curses-based Perl Debugger 
----
Devel-PDB-0.02
http://search.cpan.org/~ivanwong/Devel-PDB-0.02/
A simple Curses-based Perl Debugger 
----
Devel-PDB-0.03
http://search.cpan.org/~ivanwong/Devel-PDB-0.03/
A simple Curses-based Perl Debugger 
----
File-Locate-Harder-0.03
http://search.cpan.org/~doom/File-Locate-Harder-0.03/
when you're determined to use a locate db 
----
File-Locate-Harder-0.04
http://search.cpan.org/~doom/File-Locate-Harder-0.04/
when you're determined to use a locate db 
----
HTML-Mason-1.36
http://search.cpan.org/~drolsky/HTML-Mason-1.36/
High-performance, dynamic web site authoring system 
----
HTML-Menu-TreeView-0.6.6
http://search.cpan.org/~lze/HTML-Menu-TreeView-0.6.6/
----
Hatena-API-Auth-0.05
http://search.cpan.org/~naoya/Hatena-API-Auth-0.05/
Perl intaface to the Hatena Authentication API 
----
Ima-DBI-0.35
http://search.cpan.org/~perrin/Ima-DBI-0.35/
Database connection caching and organization 
----
JSON-XS-1.24
http://search.cpan.org/~mlehmann/JSON-XS-1.24/
JSON serialising/deserialising, done correctly and fast 
----
Lingua-JA-Summarize-Extract-0.02
http://search.cpan.org/~yappo/Lingua-JA-Summarize-Extract-0.02/
summary generator for Japanese 
----
Module-List-Pluggable-0.07
http://search.cpan.org/~doom/Module-List-Pluggable-0.07/
list or require sub-sets of modules 
----
PAB3-3.1.0
http://search.cpan.org/~chrmue/PAB3-3.1.0/
Perl Application Builder / Version 3 
----
PPM-Make-0.94
http://search.cpan.org/~rkobes/PPM-Make-0.94/
Make a ppm package from a CPAN distribution 
----
String-Diff-0.03
http://search.cpan.org/~yappo/String-Diff-0.03/
Simple diff to String 
----
Template-Plugin-Cache-0.13
http://search.cpan.org/~perrin/Template-Plugin-Cache-0.13/
cache output of templates 
----
Tie-File-FixedRecLen-0.1
http://search.cpan.org/~oliver/Tie-File-FixedRecLen-0.1/
Fixed Length Record support for Tie:File 
----
XML-SAX-Expat-0.39
http://search.cpan.org/~bjoern/XML-SAX-Expat-0.39/
SAX2 Driver for Expat (XML::Parser) 
----
boolean-0.10
http://search.cpan.org/~ingy/boolean-0.10/


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

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


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

Date: Sun, 10 Jun 2007 21:09:04 -0700
From:  vkinger@hotmail.com
Subject: parallel child processes not working properly
Message-Id: <1181534944.214165.308660@p77g2000hsh.googlegroups.com>

Hi,

I have a problem where I am creating multiple parallel child processes
to connect to multiple servers. Each child process has a different
filehandle to read starttime from a text file at the time of fork and
then write into this text file each time it runs. Each child process
has a forever loop so that it never exits unless killed or reboot
occured at server and then it tries to reconnect. My problem is it
works for couple of times and logs data from different servers into
syslog but on 2nd or 3rd attempt(after being stopped by kill -9
<process id>) it only works with the one server( it can be 1st or 2nd
or 3rd as I am testing with  only three servers at present) I am not
sure what is wrong, may be I can use some help here from the experts.
Here is what I am doing.

sub fork_pids
{
	my @pids;
	my $i = 0;
	my $length = scalar(@lines);
	my $pm = new Parallel::ForkManager($length);
	print " Connecting to " , $length , " servers\n ";
	for $i ( 1 .. $length )
	{
		print "spawning child processes $i\n";
		$pm->start and next; #do the fork
		print "Inside the child process\n";
		&GetEventData($i-1);
		$pm->finish;
	}
	$pm->wait_all_children;
}

Here I am checking the length that how many servers are configured in
the config.txt file and GetEventData is my function that takes index
into the number of server and calls the forever loop function. Same
index is used to create another text file inside this function to
record the timestamp associated with the data. Each server here
essentially does the same thing and logs into the syslog. It works
once or twice and then works with only one server.



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

Date: Mon, 11 Jun 2007 01:29:52 -0000
From:  Twisted <twisted0n3@gmail.com>
Subject: Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations
Message-Id: <1181525392.369255.138460@h2g2000hsg.googlegroups.com>

On Jun 10, 8:50 pm, "BCB" <b...@undisclosedlocation.net> wrote:
> I wholeheartedly agree, and did not mean to imply as much in my original
> post, in which my intent was to emphasize the fact that, until you learn the
> language, a J program /does/ resemble line noise! :-)

Eh. This isn't right. The whole discussion was supposed to have died
after the original Perl joke, certainly after the subsequent exclusion
of joke and toy languages. I think I made it clear also that an
editor's command set, Turing-complete though it may be, constitutes a
toy language. Anyway I amend the original claim to cover joke
languages, toy languages, and any write-only languages that
mysteriously aren't considered to fall into either of the former two
categories. After all, you can't really take a language seriously if
it's either impossible to write unmaintainable code in it OR
impossible to write maintainable code in it. The one is necessarily
trivial, and the other unsuitable for anything serious, except as a
machine-compiled intermediate format or a mechanism for assuring job
security.



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

Date: Mon, 11 Jun 2007 07:02:25 -0000
From:  Twisted <twisted0n3@gmail.com>
Subject: Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations
Message-Id: <1181545345.788665.191690@q66g2000hsg.googlegroups.com>

On Jun 11, 2:42 am, Joachim Durchholz <j...@durchholz.org> wrote:
> It is possible to write maintainable Perl.

Interesting (spoken in the tone of someone hearing about a purported
sighting of Bigfoot, or maybe a UFO).

Still, extraordinary claims require extraordinary evidence. (And no, a
fuzzy picture of something that might be a giant serpent-like thing in
the loch, or equivalent, does not constitute "extraordinary
evidence".)



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

Date: Mon, 11 Jun 2007 08:42:55 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations
Message-Id: <f4iqmk$u64$1@online.de>

Twisted schrieb:
> After all, you can't really take a language seriously if
> it's either impossible to write unmaintainable code in it

That's true for any language.
Substitute "not straightforward" for "impossible", and you have a 
condition that actually distinguishes languages.

 > OR impossible to write maintainable code in it.

It is possible to write maintainable Perl.
It's just too easy to write unmaintainable Perl.
Also, a Perl "golfer" and an intermediate Perl programmer will have 
quite different ideas about what idioms should be considered 
maintainable. (I consider Perl's mantra of "many ways to express it" to 
be a weakness, not a strength, since it lengthens the learning curve 
considerably and doesn't buy much. YMMV.)

Regards,
Jo


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

Date: Mon, 11 Jun 2007 09:54:17 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations
Message-Id: <f4iuse$3hl$1@online.de>

Twisted schrieb:
> On Jun 11, 2:42 am, Joachim Durchholz <j...@durchholz.org> wrote:
>> It is possible to write maintainable Perl.
> 
> Interesting (spoken in the tone of someone hearing about a purported
> sighting of Bigfoot, or maybe a UFO).
> 
> Still, extraordinary claims require extraordinary evidence. (And no, a
> fuzzy picture of something that might be a giant serpent-like thing in
> the loch, or equivalent, does not constitute "extraordinary
> evidence".)

There's enough Perl code around. Including some that's been reported as 
maintainable and well-maintained.
I haven't looked too deeply into it, but what I have seen from e.g. 
Webmin looked quite clear and straightforward to me. (Real Programmers 
can write Fortran code in any language - and they can write Pascal code 
in any language...)

Perl code *can* resemble line noise. I don't like the language. I think 
Larry and the Perl community have been getting some priorities very 
wrong over time (and other things very right as well: take a look at the 
regex redesign for Perl 6, for example - it's all shades of grey, not 
black-and-white).

Regards,
Jo


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

Date: Mon, 11 Jun 2007 04:56:46 -0000
From:  geot <george.titus@gmail.com>
Subject: Re: urgent:reading 2 files into 2 different $ variables
Message-Id: <1181537806.873513.26540@p47g2000hsd.googlegroups.com>

On Jun 8, 11:05 am, Joe Smith <j...@inwap.com> wrote:
> geot wrote:
> > On Jun 4, 10:00 pm, geot <george.ti...@gmail.com> wrote:
>
> > pls need help
>
> This is not the place to demand urgent help.
> Responses can take weeks to show up.


thank you for the response. pls dont mistake "urgent", i will be
waiting Patiently for the reply.

with regards
george
:)



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

Date: Sun, 10 Jun 2007 22:16:34 -0700
From:  Marek <mstep@podiuminternational.org>
Subject: Re: Useless use of array element in void context
Message-Id: <1181538994.368464.55840@p47g2000hsd.googlegroups.com>



Thank you all, for this great help! Finally my question turned out to
be a FAQ, but I was looking for perldoc -q void and not, as Paul Lalli
suggested for perldoc -q equal ... And the example here (perlfaq4)
looks really complicate. I would prefere a monster like this, than the
example of the faq:

    if (   $old_line[2] == $out_line[2]
        && $old_line[3] == $out_line[3]
        && $old_line[4] == $out_line[4]
        && $old_line[5] == $out_line[5]
        && $old_line[6] == $out_line[6])


Finally I understood the sense of the comma operator and why this code
is not working:

( $old_line[2], $old_line[3], $old_line[4], $old_line[5],
$old_line[6] )
  ==
( $out_line[2], $out_line[3], $out_line[4], $out_line[5],
$out_line[6] )

This night I dreamt the following "solution": make a slice of the
array-elements to compare, and compare as follows:

         my @old_line_num_to_comp = @old_line[2..6];
         my @out_line_num_to_comp = @out_line[2..6];
         if (@old_line_num_to_comp == @out_line_num_to_comp) { ... }

But apparently here is the same problem, the comma operator is working
silently over the two arrays. This is tricky and I am wondering, why
Larry Wall or somebody else from you gurus is not inventing an
operator, just to compare two arrays, one element after the other :-)

Thank you all for your genius suggestions! So many elegant
suggestions! It is always an aesthetic revelation for me, to see
elegant code from professionals like you. I am glad as a child under
the Christmas tree seeing code like:

            my $result[$_] = $out_line[$_] - $old_line[$_] for 2..6;

Affijn: This is looking really genius! But this gives me a syntax
error! I probably misunderstood something?

I took your second suggestion:

          my @result = map $out_line[$_] - $old_line[$_], 2..6;


but Perl is complaining about an uninitialized value in:

            printf( "TOTAL\t\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n",
                @result[2..6] );


hmmmm, have to learn a lot again!


Thank you all again


marek





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

Date: Mon, 11 Jun 2007 08:24:56 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Useless use of array element in void context
Message-Id: <slrnf6pqlo.dni.hjp-usenet2@zeno.hjp.at>

On 2007-06-11 05:16, Marek <mstep@podiuminternational.org> wrote:
> Thank you all, for this great help! Finally my question turned out to
> be a FAQ, but I was looking for perldoc -q void and not, as Paul Lalli
> suggested for perldoc -q equal ... And the example here (perlfaq4)
> looks really complicate. I would prefere a monster like this, than the
> example of the faq:
>
>     if (   $old_line[2] == $out_line[2]
>         && $old_line[3] == $out_line[3]
>         && $old_line[4] == $out_line[4]
>         && $old_line[5] == $out_line[5]
>         && $old_line[6] == $out_line[6])

The example in the FAQ works for arrays of arbitrary length.

[...]

> This night I dreamt the following "solution": make a slice of the
> array-elements to compare, and compare as follows:
>
>          my @old_line_num_to_comp = @old_line[2..6];
>          my @out_line_num_to_comp = @out_line[2..6];
>          if (@old_line_num_to_comp == @out_line_num_to_comp) { ... }
>
> But apparently here is the same problem, the comma operator is working
> silently over the two arrays.

I see no comma operatore here. 

Instead there are two arrays, and if you use an array in a scalar
context, you get its length. So this code checks if
@old_line_num_to_comp and @out_line_num_to_comp have the same length.

	hp


-- 
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate 
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | hjp@hjp.at         |
__/   | http://www.hjp.at/ |	-- Sam in "Freefall"


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

Date: Mon, 11 Jun 2007 01:48:09 -0700
From:  Marek <mstep@podiuminternational.org>
Subject: Re: Useless use of array element in void context
Message-Id: <1181551689.269400.130900@k79g2000hse.googlegroups.com>



Thank you Peter!


correction to my previous posting:


printf( "TOTAL\t\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n",
                @result[2..6] );

             => @result[0..4]

of course! Little question to you more: you suggested:

    my $same = 1;
    $same = $same && $old_line[$_] == $out_line[$_] for (2 .. 6);
    if ($same) { ... }

I changed to:

     my $same = 1;
     $same = $old_line[$_] == $out_line[$_] for (2 .. 6);
     if ($same) { ... }

because I did not understand the use of the second "$same" after "="
Is it really needed?


Thank you again


marek



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

Date: Sun, 10 Jun 2007 18:40:07 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Yet Another Software Challenge
Message-Id: <6dOdnarCKfVlOvHbnZ2dnUVZ_gednZ2d@comcast.com>

Bart wrote:
> On Jun 7, 5:23 pm, yan...@gmail.com wrote:
> 
>> You're absolutely wrong! Where to start is clearly shown. Thousands of
>> people have succeed so far..
> 
> I give up. What do you have to do to get started? Solve the riddle of
> the salmon then stick that on the end of the url?
> 
> By 'clearly shown' I would expect a big button saying 'Start Here'.

There IS a big button for 'Start Here'.  It's 200 pixels wide and 49 high.


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

Date: Sun, 10 Jun 2007 18:42:32 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Yet Another Software Challenge
Message-Id: <6dOdnaXCKfUXNfHbnZ2dnUVZ_gednZ2d@comcast.com>

Lionel B wrote:

> That site appears to be badly broken. Tried it in Firefox and Opera and 
> the only links (appart from the "Relevant Link" section) appear to lead 
> to jpegs.

Links won't get you anywhere; manually entering text on the Location bar will.


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 503
**************************************


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