Questioning wisdom of system() call inside an eval block

Questioning wisdom of system() call inside an eval block

am 27.03.2007 20:59:58 von Deane.Rothenmaier

This is a multipart message in MIME format.
--===============1332031535==
Content-Type: multipart/alternative;
boundary="=_alternative 006866DE862572AB_="

This is a multipart message in MIME format.
--=_alternative 006866DE862572AB_=
Content-Type: text/plain; charset="us-ascii"

Perlers, I feel like I know just enough about this to be dangerous, so
I'll put it to you.

I'm beginning to suspect a chunk of code isn't doing what I need it to.
I've looked through the perldoc on system(), and that's what really
started me wondering. What I'm not sure about is which way to go to fix
this--especially since it seems to work. Here's the code I'm looking at:

eval {
system( "certutil -f -enterprise -addstore root $cert > NUL 2>&1" );
};
$@ and Carp::croak( "Error installing certificate ($@)" );

where $cert contains the name of a certificate file (foo.cer). Is there
an easier, or cleaner, way of running a program? How, and what, would I
replace in this jumble using backticks--would that be a better way to go?

Thanks to anyone who'll help me make sure I'm DWIM!

Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150

"I am but mad north-north-west. When the wind is southerly I know a hawk
from a hand-saw." -- Hamlet (Act II, scene ii)
--=_alternative 006866DE862572AB_=
Content-Type: text/html; charset="us-ascii"



Perlers, I feel like I know just enough about this to be dangerous, so I'll put it to you.  



I'm beginning to suspect a chunk of code isn't doing what I need it to. I've looked through the perldoc on system(), and that's what really started me wondering. What I'm not sure about is which way to go to fix this--especially since it seems to work.  Here's the code I'm looking at:



eval  {

   system( "certutil -f -enterprise -addstore root $cert > NUL 2>&1" );

};

$@ and Carp::croak( "Error installing certificate ($@)" );



where $cert contains the name of a certificate file (foo.cer).  Is there an easier, or cleaner, way of running a program?  How, and what, would I replace in this jumble using backticks--would that be a better way to go?



Thanks to anyone who'll help me make sure I'm DWIM!



Deane Rothenmaier

Programmer/Analyst

Walgreens Corp.

847-914-5150



"I am but mad north-north-west. When the wind is southerly I know a hawk from a hand-saw." -- Hamlet (Act II, scene ii)

--=_alternative 006866DE862572AB_=--


--===============1332031535==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1332031535==--

RE: Questioning wisdom of system() call inside an eval block

am 27.03.2007 21:21:58 von Mike Crowl

This is a multi-part message in MIME format.

--===============0289149379==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C770A5.5988756A"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C770A5.5988756A
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

The backtick version would look something like:

=20

my $cmd =3D "certutil -f -enterprise -addstore root $cert > NUL";

my $output =3D `$cmd 2>&1`; # output should contain STDOUT and
STDERR

my $returnCode =3D $?; # whatever value the external
process returned

=20

=20

Typically I wrap commands in either some sort of OO-ish package, or in a
function to help hide the implementation details of external commands
from the program. This makes it more portable, especially if someone
has a wild hair and decides to call OS-specific utilities.

=20

________________________________

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Deane.Rothenmaier@walgreens.com
Sent: Tuesday, March 27, 2007 1:00 PM
To: activeperl@listserv.ActiveState.com
Subject: Questioning wisdom of system() call inside an eval block

=20


Perlers, I feel like I know just enough about this to be dangerous, so
I'll put it to you. =20

I'm beginning to suspect a chunk of code isn't doing what I need it to.
I've looked through the perldoc on system(), and that's what really
started me wondering. What I'm not sure about is which way to go to fix
this--especially since it seems to work. Here's the code I'm looking
at:=20

eval {=20
system( "certutil -f -enterprise -addstore root $cert > NUL 2>&1" );=20
};=20
$@ and Carp::croak( "Error installing certificate ($@)" );

where $cert contains the name of a certificate file (foo.cer). Is there
an easier, or cleaner, way of running a program? How, and what, would I
replace in this jumble using backticks--would that be a better way to
go?=20

Thanks to anyone who'll help me make sure I'm DWIM!=20

Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150

"I am but mad north-north-west. When the wind is southerly I know a hawk
from a hand-saw." -- Hamlet (Act II, scene ii)


------_=_NextPart_001_01C770A5.5988756A
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">










style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>The backtick version would look =
something like:



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my $cmd =3D =
size=3D2 face=3D"Courier New"> style=3D'font-size:10.0pt;font-family:"Courier New"'>certutil
-f -enterprise -addstore root $cert > NUL”;
size=3D2
color=3Dnavy face=3DArial> style=3D'font-size:10.0pt;font-family:Arial;
color:navy'>



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my $output =3D `$cmd =
2>&1`;     
# output should contain STDOUT and STDERR



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my $returnCode =3D =
$?;           &nbs=
p; 
 # whatever value the external process =
returned



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Typically I wrap commands in either =
some
sort of OO-ish package, or in a function to help hide the implementation
details of external commands from the program.  This makes it more
portable, especially if someone has a wild hair and decides to call =
OS-specific
utilities.



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 





size=3D3
face=3D"Times New Roman">






style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:
size=3D2
face=3DTahoma>
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] style=3D'font-weight:
bold'>On Behalf Of
Deane.Rothenmaier@walgreens.com

Sent: Tuesday, March 27, =
2007 1:00
PM

To:
activeperl@listserv.ActiveState.com

Subject: Questioning =
wisdom of
system() call inside an eval block





style=3D'font-size:
12.0pt'> 



style=3D'font-size:
12.0pt'>

style=3D'font-size:10.0pt;
font-family:sans-serif'>Perlers, I feel like I know just enough about =
this to
be dangerous, so I'll put it to you.  




style=3D'font-size:10.0pt;font-family:sans-serif'>I'm
beginning to suspect a chunk of code isn't doing what I need it to. I've =
looked
through the perldoc on system(), and that's what really started me =
wondering.
What I'm not sure about is which way to go to fix this--especially since =
it
seems to work.  Here's the code I'm looking at:




style=3D'font-size:10.0pt;font-family:"Courier New"'>eval
 {


style=3D'font-size:10.0pt;font-family:"Courier New"'> 
 system( "certutil -f -enterprise -addstore root $cert > =
NUL
2>&1" );


style=3D'font-size:10.0pt;font-family:"Courier New"'>};


style=3D'font-size:10.0pt;font-family:"Courier New"'>$@
and Carp::croak( "Error installing certificate ($@)" =
);
size=3D2 face=3Dsans-serif> style=3D'font-size:10.0pt;font-family:sans-serif'>



style=3D'font-size:10.0pt;font-family:sans-serif'>where
$cert contains the name of a certificate file (foo.cer).  Is there =
an easier,
or cleaner, way of running a program?  How, and what, would I =
replace in
this jumble using backticks--would that be a better way to =
go?




style=3D'font-size:10.0pt;font-family:sans-serif'>Thanks
to anyone who'll help me make sure I'm DWIM!




style=3D'font-size:10.0pt;font-family:sans-serif'>Deane
Rothenmaier

Programmer/Analyst

Walgreens Corp.

847-914-5150



"I am but mad north-north-west. When the wind is southerly I know a =
hawk
from a hand-saw." -- Hamlet (Act II, scene =
ii)









------_=_NextPart_001_01C770A5.5988756A--

--===============0289149379==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0289149379==--

RE: Questioning wisdom of system() call inside an eval block

am 27.03.2007 21:23:39 von Mike Crowl

This is a multi-part message in MIME format.

--===============2020069771==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C770A5.9593997D"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C770A5.9593997D
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Sorry small correction: You'll still want to wrap the call in an eval
like so:

=20

my $output;

=20

eval {

$output =3D `$cmd 2>&1`;

};

=20

=20

________________________________

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Mike
Crowl
Sent: Tuesday, March 27, 2007 1:22 PM
To: Deane.Rothenmaier@walgreens.com; activeperl@listserv.ActiveState.com
Subject: RE: Questioning wisdom of system() call inside an eval block

=20

The backtick version would look something like:

=20

my $cmd =3D "certutil -f -enterprise -addstore root $cert > NUL";

my $output =3D `$cmd 2>&1`; # output should contain STDOUT and
STDERR

my $returnCode =3D $?; # whatever value the external
process returned

=20

=20

Typically I wrap commands in either some sort of OO-ish package, or in a
function to help hide the implementation details of external commands
from the program. This makes it more portable, especially if someone
has a wild hair and decides to call OS-specific utilities.

=20

________________________________

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Deane.Rothenmaier@walgreens.com
Sent: Tuesday, March 27, 2007 1:00 PM
To: activeperl@listserv.ActiveState.com
Subject: Questioning wisdom of system() call inside an eval block

=20


Perlers, I feel like I know just enough about this to be dangerous, so
I'll put it to you. =20

I'm beginning to suspect a chunk of code isn't doing what I need it to.
I've looked through the perldoc on system(), and that's what really
started me wondering. What I'm not sure about is which way to go to fix
this--especially since it seems to work. Here's the code I'm looking
at:=20

eval {=20
system( "certutil -f -enterprise -addstore root $cert > NUL 2>&1" );=20
};=20
$@ and Carp::croak( "Error installing certificate ($@)" );

where $cert contains the name of a certificate file (foo.cer). Is there
an easier, or cleaner, way of running a program? How, and what, would I
replace in this jumble using backticks--would that be a better way to
go?=20

Thanks to anyone who'll help me make sure I'm DWIM!=20

Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150

"I am but mad north-north-west. When the wind is southerly I know a hawk
from a hand-saw." -- Hamlet (Act II, scene ii)


------_=_NextPart_001_01C770A5.9593997D
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">










style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Sorry small correction:  =
You’ll
still want to wrap the call in an eval like =
so:



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>my =
$output;



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>eval {



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>      =
      $output =3D `$cmd =
2>&1`;



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>};



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 





size=3D3
face=3D"Times New Roman">






style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:
size=3D2
face=3DTahoma>
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] style=3D'font-weight:
bold'>On Behalf Of
Mike Crowl

Sent: Tuesday, March 27, =
2007 1:22
PM

To:
Deane.Rothenmaier@walgreens.com; activeperl@listserv.ActiveState.com

Subject: RE: Questioning =
wisdom of
system() call inside an eval block





style=3D'font-size:
12.0pt'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>The backtick version would look =
something
like:



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my $cmd =3D =
size=3D2 face=3D"Courier New"> style=3D'font-size:10.0pt;font-family:"Courier New"'>certutil
-f -enterprise -addstore root $cert > NUL”;
size=3D2
color=3Dnavy face=3DArial> style=3D'font-size:10.0pt;font-family:Arial;
color:navy'>



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my $output =3D `$cmd
2>&1`;      # output should contain =
STDOUT and
STDERR



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my $returnCode =3D
$?;           &nbs=
p; 
 # whatever value the external process =
returned



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Typically I wrap commands in either =
some
sort of OO-ish package, or in a function to help hide the implementation
details of external commands from the program.  This makes it more =
portable,
especially if someone has a wild hair and decides to call OS-specific
utilities.



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 





size=3D3
face=3D"Times New Roman">






style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:
size=3D2
face=3DTahoma>
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] style=3D'font-weight:
bold'>On Behalf Of
Deane.Rothenmaier@walgreens.com

Sent: Tuesday, March 27, =
2007 1:00
PM

To:
activeperl@listserv.ActiveState.com

Subject: Questioning =
wisdom of
system() call inside an eval block





style=3D'font-size:
12.0pt'> 



style=3D'font-size:
12.0pt'>

style=3D'font-size:10.0pt;font-family:
Arial'>Perlers, I feel like I know just enough about this to be =
dangerous, so
I'll put it to you.  




style=3D'font-size:10.0pt;font-family:Arial'>I'm
beginning to suspect a chunk of code isn't doing what I need it to. I've =
looked
through the perldoc on system(), and that's what really started me =
wondering.
What I'm not sure about is which way to go to fix this--especially since =
it
seems to work.  Here's the code I'm looking at:




style=3D'font-size:10.0pt;font-family:"Courier New"'>eval
 {


style=3D'font-size:10.0pt;font-family:"Courier New"'> 
 system( "certutil -f -enterprise -addstore root $cert > =
NUL
2>&1" );


style=3D'font-size:10.0pt;font-family:"Courier New"'>};


style=3D'font-size:10.0pt;font-family:"Courier New"'>$@
and Carp::croak( "Error installing certificate ($@)" =
);
size=3D2 face=3DArial> style=3D'font-size:10.0pt;font-family:Arial'>



style=3D'font-size:10.0pt;font-family:Arial'>where
$cert contains the name of a certificate file (foo.cer).  Is there =
an
easier, or cleaner, way of running a program?  How, and what, would =
I
replace in this jumble using backticks--would that be a better way to =
go?





style=3D'font-size:10.0pt;font-family:Arial'>Thanks
to anyone who'll help me make sure I'm DWIM!




style=3D'font-size:10.0pt;font-family:Arial'>Deane
Rothenmaier

Programmer/Analyst

Walgreens Corp.

847-914-5150



"I am but mad north-north-west. When the wind is southerly I know a =
hawk
from a hand-saw." -- Hamlet (Act II, scene =
ii)









------_=_NextPart_001_01C770A5.9593997D--

--===============2020069771==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============2020069771==--

Re: Questioning wisdom of system() call inside an eval block

am 27.03.2007 21:57:33 von Mark Mielke

On Tue, Mar 27, 2007 at 01:59:58PM -0500, Deane.Rothenmaier@walgreens.com wrote:
> I'm beginning to suspect a chunk of code isn't doing what I need it to.
> I've looked through the perldoc on system(), and that's what really
> started me wondering. What I'm not sure about is which way to go to fix
> this--especially since it seems to work. Here's the code I'm looking at:
> eval {
> system( "certutil -f -enterprise -addstore root $cert > NUL 2>&1" );
> };
> $@ and Carp::croak( "Error installing certificate ($@)" );
> where $cert contains the name of a certificate file (foo.cer). Is there
> an easier, or cleaner, way of running a program? How, and what, would I
> replace in this jumble using backticks--would that be a better way to go?
> Thanks to anyone who'll help me make sure I'm DWIM!

The system() call is sending all stdout/stderr to never-never land. The
only thing system() is returning is the exit status code for certutil.
The eval{} will never catch anything.

It should be something like:

system("certutil ...") == 0
or die "Error installing certificate.\n";

If you need to trap the errors, you'll need something more complicated.
The eval{} will not do it.

Cheers,
mark

--
mark@mielke.cc / markm@ncf.ca / markm@nortel.com __________________________
.. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Questioning wisdom of system() call inside an eval block

am 28.03.2007 11:14:39 von Brian Raven

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Deane.Rothenmaier@walgreens.com
Sent: 27 March 2007 20:00
To: activeperl@listserv.ActiveState.com
Subject: Questioning wisdom of system() call inside an eval block

> Perlers, I feel like I know just enough about this to be dangerous, so
I'll put it to you. =


Hmmm, ominous words ... :-)

> =

> I'm beginning to suspect a chunk of code isn't doing what I need it
to. I've looked through the perldoc on =

> system(), and that's what really started me wondering. What I'm not
sure about is which way to go to fix =

> this--especially since it seems to work. Here's the code I'm looking
at: =

> =

> eval { =

> system( "certutil -f -enterprise -addstore root $cert > NUL 2>&1"
); =

> }; =

> $@ and Carp::croak( "Error installing certificate ($@)" );
> =

> where $cert contains the name of a certificate file (foo.cer). Is
there an easier, or cleaner, way of running > a program? How, and what,
would I replace in this jumble using backticks--would that be a better
way to go? =


Why are you using eval? I can see no reason for it. Also, "> NUL 2>&1"
suggests that would be no output from the command to be captured, so how
would backticks help?

> =

> Thanks to anyone who'll help me make sure I'm DWIM! =


It might help if you could actually say what YM. I for one am not as
good as Perl sometinse is at guessing that kind of thing.

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Copy Registry Key With Win32::TieRegistry

am 21.06.2007 10:54:53 von EwenMarshall

Hi Guys,

I'm looking to copy a the values of a key from a Win2k or XP registry:

HKEY_LOCAL_MACHINE\Software\gpass\new gpass\consulting room extensions

to

HKEY_CURRENT_USER\Software\gpass\new gpass\consulting room extensions

I've tried using the following code with
use Win32::TieRegistry;
$Registry->{"LMachine/Software/gpass/new gpass/consulting room
extensions/"} = $Registry->{"CUser/Software/gpass/new gpass/consulting
room extensions/"};

but I get the error:

No such root key (CUser/Software/gpass/new gpass/consulting room
extensions) at C:\consult.pl line 7

When I export the reg key I get the following output:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\gpass\new gpass\consulting room extensions]
"SCI"="GpassCre.WebCre"
"PCTI1"="DME7_GpassAx.ctlGpassTab"
"CALM Reminder"="CALMRemind.CALMReminder"
"LabelTrace"="qTrace.qtLabelForm"

Could someone please let me know where I'm going wrong.

Thanks in advance,

Ewen
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Copy Registry Key With Win32::TieRegistry

am 21.06.2007 11:29:26 von Brian Raven

Ewen Marshall <> wrote:
> Hi Guys,
> =

> I'm looking to copy a the values of a key from a Win2k or XP registry:
> =

> HKEY_LOCAL_MACHINE\Software\gpass\new gpass\consulting room extensions
> =

> to
> =

> HKEY_CURRENT_USER\Software\gpass\new gpass\consulting room extensions
> =

> I've tried using the following code with use Win32::TieRegistry;
> $Registry->{"LMachine/Software/gpass/new gpass/consulting room
> extensions/"} =3D $Registry->{"CUser/Software/gpass/new
> gpass/consulting room extensions/"}; =

> =

> but I get the error:
> =

> No such root key (CUser/Software/gpass/new gpass/consulting room
> extensions) at C:\consult.pl line 7
> =

> When I export the reg key I get the following output:
> Windows Registry Editor Version 5.00
> =

> [HKEY_LOCAL_MACHINE\Software\gpass\new gpass\consulting room
> extensions] "SCI"=3D"GpassCre.WebCre" "PCTI1"=3D"DME7_GpassAx.ctlGpassTab"
> "CALM Reminder"=3D"CALMRemind.CALMReminder"
> "LabelTrace"=3D"qTrace.qtLabelForm"
> =

> Could someone please let me know where I'm going wrong.

It looks like you have the assignment statement the wrong way round. It
certainly doesn't match your stated direction of copy.

Also, just in case you haven't noticed, the "Storing Items" section of
'perldoc Win32::TieRegistry' say that all key elements in the
destination path except the last one must already exist.

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Copy Registry Key With Win32::TieRegistry

am 21.06.2007 11:47:57 von EwenMarshall

Ok.. I got it the wrong way round!!! I'm new to registry hacks with perl
and I'm not really sure what I'm doing here. All I want to do is copy
the hive from LMachine\\Software\\gpass\\new gpass\\consulting room
extensions\\ to CUser\\Software\\gpass\\new gpass\\consulting room
extensions\\. The only code I have is:

use Win32::TieRegistry;
$Registry->{"CUser\\Software\\gpass\\new gpass\\consulting room
extensions\\"} = $Registry->{"LMachine\\Software\\gpass\\new
gpass\\consulting room extensions\\"};

When I run it I do not get any errors however it does not create
CUser\\Software\\gpass\\new gpass\\consulting room extensions\\. Do I
need to save/import $registry? Is there a simpler way of doing this? I
have read through the documentation but I'm finding it hard to understand.

Any help is very much appreciated.

Thanks and regards,

Ewen

Brian Raven wrote:
> Ewen Marshall <> wrote:
>
>> Hi Guys,
>>
>> I'm looking to copy a the values of a key from a Win2k or XP registry:
>>
>> HKEY_LOCAL_MACHINE\Software\gpass\new gpass\consulting room extensions
>>
>> to
>>
>> HKEY_CURRENT_USER\Software\gpass\new gpass\consulting room extensions
>>
>> I've tried using the following code with use Win32::TieRegistry;
>> $Registry->{"LMachine/Software/gpass/new gpass/consulting room
>> extensions/"} = $Registry->{"CUser/Software/gpass/new
>> gpass/consulting room extensions/"};
>>
>> but I get the error:
>>
>> No such root key (CUser/Software/gpass/new gpass/consulting room
>> extensions) at C:\consult.pl line 7
>>
>> When I export the reg key I get the following output:
>> Windows Registry Editor Version 5.00
>>
>> [HKEY_LOCAL_MACHINE\Software\gpass\new gpass\consulting room
>> extensions] "SCI"="GpassCre.WebCre" "PCTI1"="DME7_GpassAx.ctlGpassTab"
>> "CALM Reminder"="CALMRemind.CALMReminder"
>> "LabelTrace"="qTrace.qtLabelForm"
>>
>> Could someone please let me know where I'm going wrong.
>>
>
> It looks like you have the assignment statement the wrong way round. It
> certainly doesn't match your stated direction of copy.
>
> Also, just in case you haven't noticed, the "Storing Items" section of
> 'perldoc Win32::TieRegistry' say that all key elements in the
> destination path except the last one must already exist.
>
> HTH
>
>

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Copy Registry Key With Win32::TieRegistry

am 21.06.2007 12:16:10 von Brian Raven

Ewen Marshall <> wrote:
> Ok.. I got it the wrong way round!!! I'm new to registry hacks with
> perl and I'm not really sure what I'm doing here. All I want to do is
> copy the hive from LMachine\\Software\\gpass\\new gpass\\consulting
> room extensions\\ to CUser\\Software\\gpass\\new gpass\\consulting
> room extensions\\. The only code I have is: =

> =

> use Win32::TieRegistry;
> $Registry->{"CUser\\Software\\gpass\\new gpass\\consulting room
> extensions\\"} =3D $Registry->{"LMachine\\Software\\gpass\\new =

> gpass\\consulting room extensions\\"};
> =

> When I run it I do not get any errors however it does not create
> CUser\\Software\\gpass\\new gpass\\consulting room extensions\\. Do I
> need to save/import $registry? Is there a simpler way of doing this?
> I have read through the documentation but I'm finding it hard to
> understand. =


Referring you to the second part of my previous answer, does the key
"CUser\\Software\\gpass\\new gpass" exist? According to the
documentation it needs to for the copy to work.

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Copy Registry Key With Win32::TieRegistry

am 21.06.2007 13:10:47 von EwenMarshall

The hive exists (keys do not) but it still won't update with the keys.
The script I'm creating will have to create the new hive if it doesn't
exist.

Ewen

Brian Raven wrote:
> Ewen Marshall <> wrote:
>
>> Ok.. I got it the wrong way round!!! I'm new to registry hacks with
>> perl and I'm not really sure what I'm doing here. All I want to do is
>> copy the hive from LMachine\\Software\\gpass\\new gpass\\consulting
>> room extensions\\ to CUser\\Software\\gpass\\new gpass\\consulting
>> room extensions\\. The only code I have is:
>>
>> use Win32::TieRegistry;
>> $Registry->{"CUser\\Software\\gpass\\new gpass\\consulting room
>> extensions\\"} = $Registry->{"LMachine\\Software\\gpass\\new
>> gpass\\consulting room extensions\\"};
>>
>> When I run it I do not get any errors however it does not create
>> CUser\\Software\\gpass\\new gpass\\consulting room extensions\\. Do I
>> need to save/import $registry? Is there a simpler way of doing this?
>> I have read through the documentation but I'm finding it hard to
>> understand.
>>
>
> Referring you to the second part of my previous answer, does the key
> "CUser\\Software\\gpass\\new gpass" exist? According to the
> documentation it needs to for the copy to work.
>
>

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs