[29805] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1048 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 21 18:09:41 2007

Date: Wed, 21 Nov 2007 15:09:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 21 Nov 2007     Volume: 11 Number: 1048

Today's topics:
        A little help on perl coding.. clearguy02@yahoo.com
    Re: A little help on perl coding.. <jimsgibson@gmail.com>
        A little help on perl hashes.. clearguy02@yahoo.com
        California Moving Companies <movers12@movers12.com>
    Re: Calling a SQL Server Stored Procedure from within P <smallpond@juno.com>
    Re: Calling a SQL Server Stored Procedure from within P <jurgenex@hotmail.com>
    Re: Calling a SQL Server Stored Procedure from within P <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Calling a SQL Server Stored Procedure from within P <smallpond@juno.com>
    Re: Calling a SQL Server Stored Procedure from within P <smallpond@juno.com>
    Re: firefox could open my cgi, IE will be dead, why? <ben@morrow.me.uk>
    Re: firefox could open my cgi, IE will be dead, why? <emschwar@pobox.com>
    Re: is there any command for catch in tcl in perl <5502109103600001@t-online.de>
    Re: is there any command for catch in tcl in perl <ben@morrow.me.uk>
    Re: list context inside term xhoster@gmail.com
    Re: list context inside term (Randal L. Schwartz)
        Los Angeles Movers 818-439-3474 <movers12@movers12.com>
    Re: Perl Tk: long running callback loses GUI interactiv <ben@morrow.me.uk>
    Re: Regular expression help <tadmc@seesig.invalid>
    Re: Script to disconnect Linksys WRT54G wireless router <ben@morrow.me.uk>
        Why doesn't Digest::MD5::md5_hex match GNU md5sum? <usenet@davidfilmer.com>
    Re: Why doesn't Digest::MD5::md5_hex match GNU md5sum? <emschwar@pobox.com>
    Re: Why doesn't Digest::MD5::md5_hex match GNU md5sum? <m@rtij.nl.invlalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 21 Nov 2007 12:14:39 -0800 (PST)
From: clearguy02@yahoo.com
Subject: A little help on perl coding..
Message-Id: <04ee98b1-2fb6-4ceb-a3e8-3f6168931eb3@w34g2000hsg.googlegroups.com>

Hi folks,


I am playing around on the below issue. I have a file, C:\test.txt
with the following content:

--------------------------------------------------------------------------------------------------------------
user id       name       email                            employee
uid           manager uid

jcarter        john        jacarter@gmail.com        00206251
00207609
mstella      mary       mstella@yahoo.com       00207609  	00220458
msmith      martin     msmith@gmail.com        00202227  	00207609
bborders     bob        bborders@gmail.com      00220458  	00202003
swatson     sush       swatson@yahoo.com     00224981  	00207609
rcasey        rick        rcasey@gmail.com
00202003               00201009
----------------------------------------------------------------------------------------------------------------


mstella is the boss of jcarter, msmith and swatson;
bborders  is the boss  of mstella;
rcasey is the boss of bborders;

Now I need to replace the manager uid's with the boss id's; for the
top-most manager's id, you can replace his manager uid with his user
id itself (in this case rcasey is the top-most guy).

i.e the output file should be as follows:
---------------------------------------------------------------------------------
user id       name       email                            manager id

jcarter        john        jacarter@gmail.com        mstella
mstella      mary       mstella@yahoo.com        bborders
msmith      martin     msmith@gmail.com         mstella
bborders     bob        bborders@gmail.com       rcasey
swatson     sush       swatson@yahoo.com       mstella
rcasey       rick         rcasey@gmail.com          rcasey
--------------------------------------------------------------------------------

I am struggling to figure it out with hashes and arrays, but not
getting a desired result.. can some one help me out here?

Thanks,
JC


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

Date: Wed, 21 Nov 2007 13:54:53 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: A little help on perl coding..
Message-Id: <211120071354533767%jimsgibson@gmail.com>

In article
<04ee98b1-2fb6-4ceb-a3e8-3f6168931eb3@w34g2000hsg.googlegroups.com>,
<clearguy02@yahoo.com> wrote:

> Hi folks,
> 
> 
> I am playing around on the below issue. I have a file, C:\test.txt
> with the following content:
> 
>
> -------------------------------------------------------------------------------
> -------------------------------
> user id       name       email                            employee
> uid           manager uid
> 
> jcarter        john        jacarter@gmail.com        00206251
> 00207609
> mstella      mary       mstella@yahoo.com       00207609    00220458
> msmith      martin     msmith@gmail.com        00202227   00207609
> bborders     bob        bborders@gmail.com      00220458    00202003
> swatson     sush       swatson@yahoo.com     00224981   00207609
> rcasey        rick        rcasey@gmail.com
> 00202003               00201009
>
> -------------------------------------------------------------------------------
> ---------------------------------
> 
> 
> mstella is the boss of jcarter, msmith and swatson;
> bborders  is the boss  of mstella;
> rcasey is the boss of bborders;
> 
> Now I need to replace the manager uid's with the boss id's; for the
> top-most manager's id, you can replace his manager uid with his user
> id itself (in this case rcasey is the top-most guy).
> 
> i.e the output file should be as follows:
>
> -------------------------------------------------------------------------------
> --
> user id       name       email                            manager id
> 
> jcarter        john        jacarter@gmail.com        mstella
> mstella      mary       mstella@yahoo.com        bborders
> msmith      martin     msmith@gmail.com         mstella
> bborders     bob        bborders@gmail.com       rcasey
> swatson     sush       swatson@yahoo.com       mstella
> rcasey       rick         rcasey@gmail.com          rcasey
>
> -------------------------------------------------------------------------------
> -
> 
> I am struggling to figure it out with hashes and arrays, but not
> getting a desired result.. can some one help me out here?

I would use a hash-of-hashes. The key for the primary hash would be the
employee uid, which should always be unique. Each employee will have a
primary hash entry, with the uid as key and a reference to a secondary
hash as value. Each secondary hash will have entries with keys
'user_id', 'manager_uid', etc. Note that you can include the
'employee_uid' as a secondary hash entry or not, because the value is
already the primary hash key.

Your problem them becomes iterating through the primary hash, fetching
the manager uid value from the secondary hash, looking up the 'user id'
field from the manager's hash found by using the manager uid as key,
and adding the value of the manager's user id field to each employee's
secondary hash. Note that I would use a new field for manager id and
not overwrite the existing mananger uid field.

Something like the following, assuming that all of the employee data
has been stored in the primary hash %employees (untested):

  for my $euid ( keys %employees ) {
    my $manager_uid = $employees{$euid}->{manager_uid};
    my $manager_id = $employees{$manager_uid}->{user_id};
    $employees{$euid}->{manager_id} = $manager_id;
  }

Then you can print out the fields for each employee as you wish.

Good luck!

-- 
Jim Gibson

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com


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

Date: Wed, 21 Nov 2007 12:36:09 -0800 (PST)
From: clearguy02@yahoo.com
Subject: A little help on perl hashes..
Message-Id: <9da76f16-332c-4b64-b790-596299e89c58@o6g2000hsd.googlegroups.com>

Hi all,

I am struggling with the below puzzle:

Here is the contents of a file, c:\test.txt

============================================================
user id		name		  uid		   mid

jsmiths		john  	  	00206251  	00207609
jcarter 	                joseph 		00207609  	00220458
mstella		mary		00202227  	00207609
cgoldberg	                cindy		00220458  	00202003
mshiva 		murthy 		00224981  	00207609
hwatson		henry		00202003  	00201869
=============================================================


jcarter is the manager of jsmiths, mstella and mshiva;
cgoldberg is the manager of jcarter;
hwatson is the manager of cgoldberg;

In the output file, I need to replace the mid with the manager id as
follows. And the topmost manager (hwatson) can remain with his id.

================================================
user id		name		manager id

jsmiths		john  	  	jcarter
jcarter 	                joseph 		cgoldberg
mstella		mary		jcarter
cgoldberg	                cindy		hwatson
mshiva 		murthy 		jcarter
hwatson		henry		hwatson
=================================================

I am uisng the hases and arrays and not getting the desired output.

Can some one help me out here?

Thanks,
JC


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

Date: Wed, 21 Nov 2007 11:20:34 -0800 (PST)
From: movers <movers12@movers12.com>
Subject: California Moving Companies
Message-Id: <cd26d91b-ed61-4261-85bb-5edf7b0f4a66@e1g2000hsh.googlegroups.com>

WORLD MOVING & 1 (818) 501-3646 STORAGE
WORLD MOVING & STORAGE

Our clients have included many satisfied domestic gods/goddesses,
educators, entertainment executives, lawyers & merchants, Actores






AFFORDABLE RELOCATION & DELIVERY SOLUTIONS
Local movers, long distance movers, cross country moving, nationwide
relocation, state to state moving, packers & movers, free moving
estimate, moving help, moving labor, relocation, shipping, auto
transport, storage rentals.

Call for immediate quote call 818-501-3646 (818) 439-3474 call
323-678-2704 call 310-925-1720 Movers in your area Excellent Moving
Services.

Email for quote! VISIT US ONLINE AT: http://www.sunshine-mhs.com

Related Websites:



http://www.worldmovingandstorage.com
http://www.mover4u.com
http://www.123movingcompany.com
http://www.movers2u.com
http://www.movers12.com
http://www.sunshine-mhs.com
http://www.movinghaul.com
http://www.attnmovingcompanies.com
http://www.losangeles-movers.com
http://www.locksmithsecurityservices.com
http://www.homeimprovementlosangeles.com
http://www.linksmoving.com
http://www.movingcompanies.co.il
http://www.blogmoving.com






411GOOGLE
Visit this group


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

Date: Wed, 21 Nov 2007 09:52:40 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: Calling a SQL Server Stored Procedure from within Perl
Message-Id: <1e72e862-9dd5-4cba-9e67-96b80fe57ac2@l1g2000hsa.googlegroups.com>

On Nov 21, 10:41 am, ab <absmi...@hotmail.com> wrote:
> Hi,
>
> I'm trying to call a simple Stored Procedure from within my Perl
> script. I tested the SP named "usp_test" in the Query Analyzer and it
> ran OK. My perl script looks like this
>
> use Win32::ODBC;
> if (!($MyDB = new Win32::ODBC("DSN=MyDSN;UID=MyLoginID;PWD=MyPwd;")))
> {
>         print "Error: Unable to connect to the database\n";
>         exit;
>
> }
>
> The connection is OK, I've tested it by listing all the rows in a test
> table. Now I have to call the SP. I tried something like this but that
> didn't work:
> my $sth = $MyDB -> prepare("EXEC usp_test");
> $sth -> execute;
>
> Any information is welcome.
>
> Thanks,
> Ab


I have yet to see any computer program print the error message:
"didn't work"  yet people persist in claiming that is the
result of running their program.  Software vendors go to great
lengths to return useful error indicators, so why not use them?

$rv = $h->err;

"Returns the native database engine error code from the last
driver method called. The code is typically an integer but
you should not assume that."

--S


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

Date: Wed, 21 Nov 2007 17:56:19 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Calling a SQL Server Stored Procedure from within Perl
Message-Id: <7j_0j.1717$281.537@trndny06>

smallpond wrote:
> I have yet to see any computer program print the error message:
> "didn't work"  yet people persist in claiming that is the
> result of running their program.

LOLROTFL, YMMD!!!

May I quote those words occasionally?

jue 




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

Date: Wed, 21 Nov 2007 10:57:51 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Calling a SQL Server Stored Procedure from within Perl
Message-Id: <fmbe15x6h5.ln2@goaway.wombat.san-francisco.ca.us>

On 2007-11-21, smallpond <smallpond@juno.com> wrote:
>
> I have yet to see any computer program print the error message:
> "didn't work"  yet people persist in claiming that is the
> result of running their program.

I've had my Perl programs occasionally say "Something's wrong" when I do
a warn with an undefined variable.  Does that count?  ;-)

(Yes, I go back and fix the warn call if I need it.)

--keith


-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



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

Date: Wed, 21 Nov 2007 12:48:44 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: Calling a SQL Server Stored Procedure from within Perl
Message-Id: <0dfce4f9-491b-4adc-88a2-1baf0f9ec272@o42g2000hsc.googlegroups.com>

On Nov 21, 12:56 pm, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> smallpond wrote:
> > I have yet to see any computer program print the error message:
> > "didn't work"  yet people persist in claiming that is the
> > result of running their program.
>
> LOLROTFL, YMMD!!!
>
> May I quote those words occasionally?
>
> jue

Maybe write an automated responder  (in perl of course)
to post.

As always happens when flaming someone, I was wrong.
I think $h->err is only for the DBI modules.  SQL has
it's own non-standard routine to get the error which
I am too lazy to look up.
--S


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

Date: Wed, 21 Nov 2007 15:03:12 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: Calling a SQL Server Stored Procedure from within Perl
Message-Id: <6c746ac8-7a65-4d8b-9033-e7f9da00f984@j44g2000hsj.googlegroups.com>

On Nov 21, 1:57 pm, Keith Keller <kkeller-use...@wombat.san-
francisco.ca.us> wrote:
> On 2007-11-21, smallpond <smallp...@juno.com> wrote:
>
>
>
> > I have yet to see any computer program print the error message:
> > "didn't work"  yet people persist in claiming that is the
> > result of running their program.
>
> I've had my Perl programs occasionally say "Something's wrong" when I do
> a warn with an undefined variable.  Does that count?  ;-)
>
> (Yes, I go back and fix the warn call if I need it.)
>
> --keith
>
> --
> kkeller-use...@wombat.san-francisco.ca.us
> (try just my userid to email me)
> AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
> see X- headers for PGP signature information

perl -we 'warn $v;'
Name "main::v" used only once: possible typo at -e line 1.
Use of uninitialized value in warn at -e line 1.
Warning: something's wrong at -e line 1.

Heh.  I like the message.  How to warn someone of an error
when the warning has an error.
--S


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

Date: Wed, 21 Nov 2007 17:21:06 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: firefox could open my cgi, IE will be dead, why?
Message-Id: <216e15-0s2.ln1@osiris.mauzo.dyndns.org>


Quoth Ron Bergin <rkb@i.frys.com>:
> 
> 2) Unless there is a possibility of having spaces in the filename,
> there is no need (and most will say you shouldn't) use the quotes
> around the var.

Perl is not shell. There is no need to quote variables, ever, unless you
*really* care about stringification for some reason.

Ben



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

Date: Wed, 21 Nov 2007 11:55:08 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: firefox could open my cgi, IE will be dead, why?
Message-Id: <87myt7cttf.fsf@pobox.com>

"Petr Vileta" <stoupa@practisoft.cz> writes:
> ## open(DATA, "$logfile")|| die("File is not exist!\n");
> ###############
> open(DATA, "$logfile") or die("File not exist or not permission to
> read!\n");

Why not just let Perl tell you what went wrong?  Also, don't need to
quote "$logfile", and you can use lexical filehandles instead of
needing globals like DATA:

open my $data, '<', $logfile or die "Can't open data file: $!";

-=Eric


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

Date: Wed, 21 Nov 2007 17:40:34 +0100
From: Josef Moellers <5502109103600001@t-online.de>
Subject: Re: is there any command for catch in tcl in perl
Message-Id: <47445F82.1000005@t-online.de>

(mailed and posted)

vikram.varshney@gmail.com wrote:
> Hi
> I am Vikram Varshney. My script needs to catch whether a particular
> command fails or passes. This could be done very easily in tcl using
> "catch" which gives "1" output when the command fails and 0 as output
> when the command runs successfully. And what represents NULL character
> in perl. I have tried "\0" & "NULL" & / / & ' ' . But they are not
> working.

Sorry, I missed this last part.

The ASCII NUL character (note the single 'L'! "NULL" is a special 
pointer value in various programming languages, e.g. C, C++) is "\0", 
e.g. you can (sort-of) pretty-print Linux' /proc/.../cmdline entry by

open(my $ppc, '<', '/proc/self/cmdline') or die "Cannot open cmdline: $!";
my $commandline = <$ppc>;
$commandline =~ s/\0/ /g;
print "$commandline\n";

If you mean the "0" as returned by tcl's "catch"-command, then note that 
Perl's "eval" will return "undef" (and $@ is set to the error message), 
which you can simply check with e.g.

if (eval($command)) {
    print "Command was successfull!!\n";
} else {
    print "Command failed: $@\n";
}

Otherwise, a "0" is a 0.

HTH,
-- 
Mails please to josef dot moellers
and I'm on gmx dot de.


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

Date: Wed, 21 Nov 2007 17:40:47 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: is there any command for catch in tcl in perl
Message-Id: <v57e15-0s2.ln1@osiris.mauzo.dyndns.org>


Quoth Josef Moellers <5502109103600001@t-online.de>:
> vikram.varshney@gmail.com wrote:
> >
> > I am Vikram Varshney. My script needs to catch whether a particular
> > command fails or passes. This could be done very easily in tcl using
> > "catch" which gives "1" output when the command fails and 0 as output
> > when the command runs successfully. And what represents NULL character
> > in perl. I have tried "\0" & "NULL" & / / & ' ' . But they are not
> > working.

"\0" is a string containing a single ASCII nul character.
"NULL" is a string containing four characters 'N', 'U', 'L', 'L'.
/ / is a regex that matches a single space.
' ' is a string containing a single space.

These are all different, and in Perl all are true values. Perl has three
false values: the empty string '', the number 0 (or the string '0' which
converts to 0), and the undefined value undef.

> The ASCII NUL character (note the single 'L'! "NULL" is a special 
> pointer value in various programming languages, e.g. C, C++) is "\0", 
> e.g. you can (sort-of) pretty-print Linux' /proc/.../cmdline entry by
> 
> open(my $ppc, '<', '/proc/self/cmdline') or die "Cannot open cmdline: $!";
> my $commandline = <$ppc>;
> $commandline =~ s/\0/ /g;
> print "$commandline\n";
> 
> If you mean the "0" as returned by tcl's "catch"-command, then note that 
> Perl's "eval" will return "undef"

Note: Josef doesn't literally mean "undef" (a string), but undef, which
is a special Perl value a little like the NULL pointer in C or NULL in
SQL (but not entirely like either :) ).

> (and $@ is set to the error message), 
> which you can simply check with e.g.
> 
> if (eval($command)) {
>     print "Command was successfull!!\n";
> } else {
>     print "Command failed: $@\n";
> }

Safer would be

    if (defined eval $command) {

which allows for the $command to return some false-but-defined value
like 0 or ''. Note also that you can use eval {} (see perldoc -f eval)
to avoid the security and speed penalties of eval "".

Ben



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

Date: 21 Nov 2007 17:22:53 GMT
From: xhoster@gmail.com
Subject: Re: list context inside term
Message-Id: <20071121122255.339$Vr@newsreader.com>

xueweizhong@gmail.com wrote:

> BTW, the `[]' is not counted as an operator in perlop(in C, it's an
> binary operator), it's counted as an term delimiter, so we can
> redeclare our questions as:

Is this from the docs, or your interpretation of observed behavior?
If from the docs, can you point me to the section?

Thanks,

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Wed, 21 Nov 2007 14:38:46 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: xueweizhong@gmail.com
Subject: Re: list context inside term
Message-Id: <867ikb4421.fsf@blue.stonehenge.com>

>>>>> "xueweizhong" == xueweizhong  <xueweizhong@gmail.com> writes:

xueweizhong> In `( stat (".") ) [0]',  the `()' don't decide the list context, but
xueweizhong> `()[0]' decides it a list context. Following this way, in `stat(".")
xueweizhong> [0]', why [0] doesn't decide that the left side `stat(".")' is
xueweizhong> evaluated in list context?

Because that's not a standlone syntax.

You can have:

    $foo[$bar] - element of an array
    @foo[@bar] - many elements of an array
    (SomeListExpression)[@bar] - many elements of a list expression

But [] by itself as a suffix doesn't mean anything.

-- 
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: Wed, 21 Nov 2007 11:20:04 -0800 (PST)
From: movers <movers12@movers12.com>
Subject: Los Angeles Movers 818-439-3474
Message-Id: <96ba2254-ab3b-4d38-8e5e-6b0a366e3e8d@41g2000hsh.googlegroups.com>

WORLD MOVING & 1 (818) 501-3646 STORAGE
WORLD MOVING & STORAGE

Our clients have included many satisfied domestic gods/goddesses,
educators, entertainment executives, lawyers & merchants, Actores






AFFORDABLE RELOCATION & DELIVERY SOLUTIONS
Local movers, long distance movers, cross country moving, nationwide
relocation, state to state moving, packers & movers, free moving
estimate, moving help, moving labor, relocation, shipping, auto
transport, storage rentals.

Call for immediate quote call 818-501-3646 (818) 439-3474 call
323-678-2704 call 310-925-1720 Movers in your area Excellent Moving
Services.

Email for quote! VISIT US ONLINE AT: http://www.sunshine-mhs.com

Related Websites:



http://www.worldmovingandstorage.com
http://www.mover4u.com
http://www.123movingcompany.com
http://www.movers2u.com
http://www.movers12.com
http://www.sunshine-mhs.com
http://www.movinghaul.com
http://www.attnmovingcompanies.com
http://www.losangeles-movers.com
http://www.locksmithsecurityservices.com
http://www.homeimprovementlosangeles.com
http://www.linksmoving.com
http://www.movingcompanies.co.il
http://www.blogmoving.com






411GOOGLE
Visit this group


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

Date: Wed, 21 Nov 2007 17:32:35 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Perl Tk: long running callback loses GUI interactivity
Message-Id: <jm6e15-0s2.ln1@osiris.mauzo.dyndns.org>


Quoth zentara <zentara@highstream.net>:
> On Tue, 20 Nov 2007 11:12:20 -0800 (PST), smallpond <smallpond@juno.com>
> wrote:
> >
> >My mistake.  Tk cannot call fork in a callback.  If using fork
> >in a Tk program, call it before calling MainLoop.
> >system is OK, tho.
> 
> Whoa, that is bad info.  Tk can call fork anywhere it wants. You may be
> confusing fork with the Tk thread safety problem.

The OP is on Win32, so they are equivalent (fork is implemented with
threads on Win32).

Ben



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

Date: Wed, 21 Nov 2007 22:45:58 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Regular expression help
Message-Id: <slrnfk87ip.nn7.tadmc@tadmc30.sbcglobal.net>

Benedict White <benedictmpwhite@gmail.com> wrote:

> I seem to have found a regex that works:


It has at least 4 different problems.

What does "works" mean when you say it?


> [A-Za-Z]?[0-9][A-Za-Z]?@example.com.com
>
> Which matches emails to the example.com domain containing numbers.


a-Z is not a valid range.

at-signs need to be escaped in double-quotish contexts such
as a pattern.

There are 2 ".com" substrings required by the pattern.

It only allows a single character between the digit and
the at-sign. It doens't match 'foo2bar@example.com.com' ...


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Wed, 21 Nov 2007 17:29:14 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Script to disconnect Linksys WRT54G wireless router on Windows
Message-Id: <ag6e15-0s2.ln1@osiris.mauzo.dyndns.org>

[f'ups to clpm]

Quoth Wilson <davewilson69@sbcglobal.net>:
> On Wed, 21 Nov 2007 02:08:41 +0000, Ben Morrow wrote:
> > Under ActivePerl you can install Crypt::SSLeay with
> >     C:\> ppm install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd
> 
> I hope to write up a short tutorial to help others, so, in the spirit of
> the tutorial, here is the output from your suggested "ppm" command
> (whatever that is)...

'ppm' stands for 'Perl package manager'; it is a utility which comes
with ActivePerl for installing Perl modules. If you run it with simply
'ppm' you'll get a GUI you can use to locate and install modules.

The reason for the complete URL (rather than simply 'ppm install
Crypt-SSLeay') is that ActiveState's repositry is located in Canada, so
they aren't allowed to provide cryptographic software without a license.
theoryx.uwinnipeg.ca is an alternative repositry which contains the
crypto modules most people need.

> I'm not sure what I just did, but a lot happened when I ran:
> C:\> ppm install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd

Everything seems to have happened as it should. You can test it has
installed correctly with

    perl -MCrypt::SSLeay -e1

which should give no output.

> A copy of the needed library ssleay32.dll was found in
> C:\WINDOWS\system32\ssleay32.dll. 
> If this is compatible with the version (0.9.8a)
> used to compile the Perl module, all that is needed to
> complete the installation is to ensure
> C:\WINDOWS\system32\ssleay32.dll is in your PATH environment variable.

This is saying you already have ssleay32.dll on your system. If you want
to use this copy instead of downloading a new one, you need to be sure
it is the correct version (0.9.8a), which you can probably check from
the Properties window in Explorer, and you need to be sure it is in your
PATH so perl can find it (system32 is already in your PATH, of course).

> Fetch ssleay32.dll? [no]
> Aborting download of ssleay32.dll.

Here ppm is offering to install a new copy of ssleay32.dll; since you
already have one, the default answer is no. Had you said 'yes' it would
have downloaded a new copy and put it somewhere perl could find it.

> done
>   13 files installed

The installation was successful.

Ben



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

Date: Wed, 21 Nov 2007 14:18:56 -0800 (PST)
From: David Filmer <usenet@davidfilmer.com>
Subject: Why doesn't Digest::MD5::md5_hex match GNU md5sum?
Message-Id: <486d21b8-de4a-450f-85ee-0b5ae5e3e173@w40g2000hsb.googlegroups.com>

Greetings.  Kindly consider these two methods to create an MD5 digest
(in hex format):

   perl -e "use Digest::MD5 'md5_hex'; print md5_hex('foo')"
   acbd18db4cc2f85cedef654fccc4a4d8

   echo foo |md5sum
   d3b07384d113edec49eaa6238ad5ff00

Ummm, shouldn't those be the same?

perldoc Digest::MD5
   [snip]
   The MD5 algorithm is defined in RFC 1321

md5sum --help
   md5sum (GNU coreutils) 6.4
   [snip]
   The sums are computed as described in RFC 1321.

Can someone tell me why these two methods produce different output?

Thanks!

--
David Filmer (http://DavidFilmer.com)


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

Date: Wed, 21 Nov 2007 15:25:49 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Why doesn't Digest::MD5::md5_hex match GNU md5sum?
Message-Id: <87ir3vck2a.fsf@pobox.com>

David Filmer <usenet@davidfilmer.com> writes:
> Greetings.  Kindly consider these two methods to create an MD5 digest
> (in hex format):
>
>    perl -e "use Digest::MD5 'md5_hex'; print md5_hex('foo')"
>    acbd18db4cc2f85cedef654fccc4a4d8
>
>    echo foo |md5sum
>    d3b07384d113edec49eaa6238ad5ff00
>
> Ummm, shouldn't those be the same?

No.

$ echo foo | od -c
0000000   f   o   o  \n
0000004

You're getting an extra newline there.  If you want to compare them,
try passing echo the -n flag, which tells it not to append a newline
to its parameters:

$ echo -n foo | md5sum
acbd18db4cc2f85cedef654fccc4a4d8  -

> Can someone tell me why these two methods produce different output?

Because you're passing them different input.  You just didn't notice
it.

-=Eric


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

Date: Wed, 21 Nov 2007 23:26:47 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Why doesn't Digest::MD5::md5_hex match GNU md5sum?
Message-Id: <pan.2007.11.21.22.26.47@rtij.nl.invlalid>

On Wed, 21 Nov 2007 14:18:56 -0800, David Filmer wrote:

> Greetings.  Kindly consider these two methods to create an MD5 digest
> (in hex format):
> 
>    perl -e "use Digest::MD5 'md5_hex'; print md5_hex('foo')"
>    acbd18db4cc2f85cedef654fccc4a4d8
> 
>    echo foo |md5sum
>    d3b07384d113edec49eaa6238ad5ff00
> 
> Ummm, shouldn't those be the same?

No, the input is different, so the output should be different as well.

Try:
   perl -e 'use Digest::MD5 "md5_hex"; print md5_hex("foo\n")'

HTH,
M4



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

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


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