How to interprete UTF-8 warnings
How to interprete UTF-8 warnings
am 04.03.2008 13:02:58 von Torsten.Werner
Hi all,
I get the following message when I execute a script on a chinese windows
installation (codepage for non-unicode applications is cp936). When I run
the same code on english windows I get no message.
How can I interprete it? A hint into documentation would be good, I did not
found something.
I would like have a information
- which string is wrong
- which line of code is responsible for the message
It is a very large script, I've no idea how to find the wrong string and I
can't see any wrong character.
@ 535 not utf8
SV = PV(0x2fab7b8) at 0x1de2094
REFCNT = 2
FLAGS = (POK,pPOK,UTF8)
PV = 0x3e025dc "\313\316\314\345 9"\0 [UTF8 "\x{2ce}\x{325} 9"]
CUR = 6
LEN = 7
SV = PVMG(0x30148ac) at 0x1de2094
REFCNT = 2
FLAGS = (SMG,POK,pPOK,UTF8)
IV = 0
NV = 0
PV = 0x3e025dc "\313\316\314\345 9"\0 [UTF8 "\x{2ce}\x{325} 9"]
CUR = 6
LEN = 7
MAGIC = 0x3e025ac
MG_VIRTUAL = &PL_vtbl_utf8
MG_TYPE = PERL_MAGIC_utf8(w)
MG_LEN = 4
Thanks
Torsten Werner
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Redefining Constants
am 05.03.2008 02:02:47 von fzarabozo
Hello All,
I'm having some trouble with a module where I need to implement a change.
Basically, this module defines constants that other modules will use at a
later time.
I need to detect parameters in the import() sub (that's the requested
change) and, if the case, redefine some of those constants.
I'm trying with evals but all I'm getting is a warning about "constant
redefined", AND the constant is not really changing (it keeps its previous
value).
Is there a way to correctly redefine a constant at import() time?
Here is a simple example of the scene:
Script.pl
-----------------
use strict;
use warnings;
use myModule constantA => 'foo';
-----------------
myModule.pm
-----------------
package myModule;
use strict;
use warnings;
use constant constantA => 'bar';
sub import {
my %params = @_;
if ($params{constantA}) {
# This should change constantA from 'bar' to 'foo'
eval 'use constant constantA => \''.$params{constantA}.'\'';
warn $@ if $@;
}
}
-----------------
Any comments are highly appreciated.
Thanks in advance,
Paco Zarabozo
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Redefining Constants
am 05.03.2008 15:10:43 von Brian Raven
Zarabozo, Francisco (GE, Corporate) <> wrote:
> Hello All,
> =
> I'm having some trouble with a module where I need to implement a
> change. =
> Basically, this module defines constants that other modules will use
> at a later time. =
> =
> I need to detect parameters in the import() sub (that's the requested
> change) and, if the case, redefine some of those constants.
> =
> I'm trying with evals but all I'm getting is a warning about
> "constant redefined", AND the constant is not really changing (it
> keeps its previous value). =
No. It will be complaining about a subroutine being redefined. =
> =
> Is there a way to correctly redefine a constant at import() time?
I would hope not! That would subvert the whole concept of a constant.
However, ...
> =
> Here is a simple example of the scene:
> =
> Script.pl
> -----------------
> use strict;
> use warnings;
> use myModule constantA =3D> 'foo';
> -----------------
> =
> myModule.pm
> -----------------
> package myModule;
> use strict;
> use warnings;
> use constant constantA =3D> 'bar';
> =
> sub import {
> my %params =3D @_;
> if ($params{constantA}) {
> # This should change constantA from 'bar' to 'foo'
> eval 'use constant constantA =3D> \''.$params{constantA}.'\'';
> warn $@ if $@;
> }
> }
> -----------------
> =
> Any comments are highly appreciated.
While this appears to do what you want (at least it does after
modification), the warning about redefinition of a subroutine may be
hard to inhibit without changing constant.pm. One way would be to avoid
redefining any subroutines, e.g.
------------------------
use strict;
use warnings;
package myModule;
our %defaults =3D (constantA =3D> 'bar');
sub import {
my $module =3D shift;
my %params =3D @_;
foreach my $k (keys %defaults) {
my $val =3D defined($params{$k}) ? $params{$k} : $defaults{$k};
eval qq{use constant $k =3D> '$val'};
warn $@ if $@;
}
}
1;
--------------------------
Its not entirely clear what you are trying to achieve, but I don't think
that variable constants (i.e. constants that are not constant) is a good
way to do it.
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: Redefining Constants
am 05.03.2008 16:34:49 von Foo JH
Dude. constants should not be redefined at all. Sounds like what you
need is just normal variables with default settings instead.
Zarabozo, Francisco (GE, Corporate) wrote:
> Hello All,
>
> I'm having some trouble with a module where I need to implement a change.
> Basically, this module defines constants that other modules will use at a
> later time.
>
> I need to detect parameters in the import() sub (that's the requested
> change) and, if the case, redefine some of those constants.
>
> I'm trying with evals but all I'm getting is a warning about "constant
> redefined", AND the constant is not really changing (it keeps its previous
> value).
>
> Is there a way to correctly redefine a constant at import() time?
>
> Here is a simple example of the scene:
>
> Script.pl
> -----------------
> use strict;
> use warnings;
> use myModule constantA => 'foo';
> -----------------
>
> myModule.pm
> -----------------
> package myModule;
> use strict;
> use warnings;
> use constant constantA => 'bar';
>
> sub import {
> my %params = @_;
> if ($params{constantA}) {
> # This should change constantA from 'bar' to 'foo'
> eval 'use constant constantA => \''.$params{constantA}.'\'';
> warn $@ if $@;
> }
> }
> -----------------
>
> Any comments are highly appreciated.
>
> Thanks in advance,
>
> Paco Zarabozo
>
>
>
> _______________________________________________
> ActivePerl mailing list
> ActivePerl@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Redefining Constants
am 05.03.2008 22:54:07 von fzarabozo
Thank you for your answer.
Yes, I thought so too. Constants are by definition not-variables. I wanted =
to know this for the following reasons:
1. All you know how a company asks you to change the less code possible =
whenever something is requested in critical applications.
2. I didn't desing the modules. The person who did it thought that using =
constants would be nice and he didn't think about something like this =
coming.
3. This module is superclass for other 15 modules that use its constants.
So, I will have to modify such constants in all 16 modules to convert them =
in variables in order to make them configurable. I guess It's always better =
a clean long fix than a dirty short patch. :-)
Thank you again.
Cheers,
Paco Zarabozo
From: Brian Raven
Sent: Wednesday, March 05, 2008 8:10 AM
To: activeperl@listserv.ActiveState.com
Subject: RE: Redefining Constants
Zarabozo, Francisco (GE, Corporate) <> wrote:
> Hello All,
>
> I'm having some trouble with a module where I need to implement a
> change.
> Basically, this module defines constants that other modules will use
> at a later time.
>
> I need to detect parameters in the import() sub (that's the requested
> change) and, if the case, redefine some of those constants.
>
> I'm trying with evals but all I'm getting is a warning about
> "constant redefined", AND the constant is not really changing (it
> keeps its previous value).
No. It will be complaining about a subroutine being redefined.
>
> Is there a way to correctly redefine a constant at import() time?
I would hope not! That would subvert the whole concept of a constant.
However, ...
>
> Here is a simple example of the scene:
>
> Script.pl
> -----------------
> use strict;
> use warnings;
> use myModule constantA =3D> 'foo';
> -----------------
>
> myModule.pm
> -----------------
> package myModule;
> use strict;
> use warnings;
> use constant constantA =3D> 'bar';
>
> sub import {
> my %params =3D @_;
> if ($params{constantA}) {
> # This should change constantA from 'bar' to 'foo'
> eval 'use constant constantA =3D> \''.$params{constantA}.'\'';
> warn $@ if $@;
> }
> }
> -----------------
>
> Any comments are highly appreciated.
While this appears to do what you want (at least it does after
modification), the warning about redefinition of a subroutine may be
hard to inhibit without changing constant.pm. One way would be to avoid
redefining any subroutines, e.g.
------------------------
use strict;
use warnings;
package myModule;
our %defaults =3D (constantA =3D> 'bar');
sub import {
my $module =3D shift;
my %params =3D @_;
foreach my $k (keys %defaults) {
my $val =3D defined($params{$k}) ? $params{$k} : $defaults{$k};
eval qq{use constant $k =3D> '$val'};
warn $@ if $@;
}
}
1;
--------------------------
Its not entirely clear what you are trying to achieve, but I don't think
that variable constants (i.e. constants that are not constant) is a good
way to do it.
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 =
immediately 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 =
London 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 7500=
9 =
Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement =
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. =
Toute copie, publication ou diffusion de cet email est interdite. Si cet =
e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir =
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de =
votre systeme. Le contenu de ce message electronique ne represente pas =
necessairement 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, =
enregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro =
425 100 =
294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Haussmann 75=
009 =
Paris France.
==================== =====3D=
================
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs =
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Redefining Constants
am 06.03.2008 05:29:06 von Foo JH
All I can say is:
Good luck. Have fun.
:)
Zarabozo, Francisco (GE, Corporate) wrote:
> Thank you for your answer.
>
> Yes, I thought so too. Constants are by definition not-variables. I wanted
> to know this for the following reasons:
>
> 1. All you know how a company asks you to change the less code possible
> whenever something is requested in critical applications.
> 2. I didn't desing the modules. The person who did it thought that using
> constants would be nice and he didn't think about something like this
> coming.
> 3. This module is superclass for other 15 modules that use its constants.
>
> So, I will have to modify such constants in all 16 modules to convert them
> in variables in order to make them configurable. I guess It's always better
> a clean long fix than a dirty short patch. :-)
>
> Thank you again.
>
> Cheers,
>
> Paco Zarabozo
>
>
>
>
>
> From: Brian Raven
> Sent: Wednesday, March 05, 2008 8:10 AM
> To: activeperl@listserv.ActiveState.com
> Subject: RE: Redefining Constants
>
>
> Zarabozo, Francisco (GE, Corporate) <> wrote:
>
>> Hello All,
>>
>> I'm having some trouble with a module where I need to implement a
>> change.
>> Basically, this module defines constants that other modules will use
>> at a later time.
>>
>> I need to detect parameters in the import() sub (that's the requested
>> change) and, if the case, redefine some of those constants.
>>
>> I'm trying with evals but all I'm getting is a warning about
>> "constant redefined", AND the constant is not really changing (it
>> keeps its previous value).
>>
>
> No. It will be complaining about a subroutine being redefined.
>
>
>> Is there a way to correctly redefine a constant at import() time?
>>
>
> I would hope not! That would subvert the whole concept of a constant.
> However, ...
>
>
>> Here is a simple example of the scene:
>>
>> Script.pl
>> -----------------
>> use strict;
>> use warnings;
>> use myModule constantA => 'foo';
>> -----------------
>>
>> myModule.pm
>> -----------------
>> package myModule;
>> use strict;
>> use warnings;
>> use constant constantA => 'bar';
>>
>> sub import {
>> my %params = @_;
>> if ($params{constantA}) {
>> # This should change constantA from 'bar' to 'foo'
>> eval 'use constant constantA => \''.$params{constantA}.'\'';
>> warn $@ if $@;
>> }
>> }
>> -----------------
>>
>> Any comments are highly appreciated.
>>
>
> While this appears to do what you want (at least it does after
> modification), the warning about redefinition of a subroutine may be
> hard to inhibit without changing constant.pm. One way would be to avoid
> redefining any subroutines, e.g.
>
> ------------------------
> use strict;
> use warnings;
> package myModule;
>
> our %defaults = (constantA => 'bar');
>
> sub import {
> my $module = shift;
> my %params = @_;
> foreach my $k (keys %defaults) {
> my $val = defined($params{$k}) ? $params{$k} : $defaults{$k};
> eval qq{use constant $k => '$val'};
> warn $@ if $@;
> }
> }
>
> 1;
> --------------------------
>
> Its not entirely clear what you are trying to achieve, but I don't think
> that variable constants (i.e. constants that are not constant) is a good
> way to do it.
>
> HTH
>
>
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Redefining Constants
am 11.03.2008 14:18:58 von cowboy
--===============1460488451==
Content-Type: multipart/alternative; boundary="0-1294378725-1205241538=:77464"
Content-Transfer-Encoding: 7bit
--0-1294378725-1205241538=:77464
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hi,
There are few things are missing; please check with the following co=
de:
package myModule;
use strict;
use warnings;
use constant constantA =3D> 'bar';
sub import {
shift; #The first argument is class name; so eliminate it
my %params =3D @_;
if (defined($params{'constantA'})) {
# This should change constantA from 'bar' to 'foo'
eval 'use constant constantA =3D> \''.$params{constantA}.'\'';
warn $@ if $@;
print $params{'constantA'} . "\n";
}=20
}
1; #this return statement is essential to every module
Thanks and Regards,
G. Indra
------------------------------------------------------------
=20
Hello All,
I'm having some trouble with a module where I need to implement a
change.=20
Basically, this module defines constants that other modules will use at
a=20
later time.
I need to detect parameters in the import() sub (that's the requested=20
change) and, if the case, redefine some of those constants.
I'm trying with evals but all I'm getting is a warning about "constant=20
redefined", AND the constant is not really changing (it keeps its
previous=20
value).
Is there a way to correctly redefine a constant at import() time?
Here is a simple example of the scene:
Script.pl
-----------------
use strict;
use warnings;
use myModule constantA =3D> 'foo';
-----------------
myModule.pm
-----------------
package myModule;
use strict;
use warnings;
use constant constantA =3D> 'bar';
sub import {
my %params =3D @_;
if ($params{constantA}) {
# This should change constantA from 'bar' to 'foo'
eval 'use constant constantA =3D> \''.$params{constantA}.'\'';
warn $@ if $@;
}
}
-----------------
Any comments are highly appreciated.
Thanks in advance,
Paco Zarabozo
=20
=20
---------------------------------
Bring your gang together - do your thing. Start your group.
--0-1294378725-1205241538=:77464
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hi,
There are few things are missing; please check w=
ith the following code:
pac=
kage myModule;
color: rgb(0, 0, 127);">use strict;
27);">use warnings;
e=3D"color: rgb(0, 0, 127);">use c=
onstant constantA =3D> 'bar';
;">
27);">sub import {
=3D"color: rgb(0, 0, 127);"> shift; #The first argument is class name; so=
eliminate it
olor: rgb(0, 0, 127);"> my %params =3D @_;
gb(0, 0, 127);"> if (defined($para=
ms{'constantA'})) {
style=3D"color: rgb(0, 0, 127);"> # This should change constantA from '=
bar' to 'foo'
olor: rgb(0, 0, 127);"> eval 'use constant constantA =3D> \''.$params=
{constantA}.'\'';
"color: rgb(0, 0, 127);"> warn $@ if $@;
, 0, 127);"> print $params{'const=
antA'} . "\n";
color: rgb(0, 0, 127);"> }
pan style=3D"color: rgb(0, 0, 127);">}
, 127);">
, 0, 127);">1; #this return statement is essential to every module
>
Thanks and Regards,
G.
Indra
--------------------=
tt>--------------------
t>--------------------
Hello All,
=
I'm having some trouble with a module where I need to implement a
=
change.
Basically, this module defines constants that other modules =
will use at
a
later time.
I need to detect parameters in t=
he import() sub (that's the requested
change) and, if the case, redef=
ine some of those constants.
I'm trying with evals but all I'm get=
ting is a warning about "constant
redefined", AND the constant is not=
really changing (it keeps its
previous
value).
Is there a=
way to correctly redefine a constant at import() time?
Here is a =
simple example of the scene:
Script.pl
-----------------
use=
strict;
use warnings;
use myModule constantA =3D>
'foo';
-----------------
myModule.pm
-----------------
p=
ackage myModule;
use strict;
use warnings;
use constant constant=
A =3D> 'bar';
sub import {
my %params =3D @_;
if =
($params{constantA}) {
# This should change constantA from 'ba=
r' to 'foo'
eval 'use constant constantA =3D> \''.$params{c=
onstantA}.'\'';
warn $@ if $@;
}
}
--------------=
---
Any comments are highly appreciated.
Thanks in advance,=
Paco Zarabozo
Bring your gang together - do your thing=
..
hoo.com/groups"> Start your group.
--0-1294378725-1205241538=:77464--
--===============1460488451==
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
--===============1460488451==--