ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl.net
perl.net
RE: Perl.NET and com libraries
by Jan Dubois other posts by this author
Aug 25 2004 8:23AM messages near this date
view in the new Beta List Site
Re: Perl.NET and com libraries | Re: Perl.NET and com libraries
On Tue, 24 Aug 2004, Severan Rault wrote:
>  I am having a problem converting PerlNET::int64 back into a scalar...

PerlNET will treat an int64 as a scalar, so I guess I still don't
understand your usecase.

>  basically I have $val = bless( do{\(my $o = undef)}, 'PerlNET::Int64'

Please don't bless arbitrary references into PerlNET internal classes.
They are intentionally undocumented and their implementation is subject
to change between releases. What are you trying to accomplish?

>  ); If I do "print $val;" then it print the value because PerlNET call
>  ToString on it for me, right ? however if I try :

Yes, PerlNET will call ToString() on .NET objects if you use them in a
string context. It is the Perlish thing to do: treat them as a string in
string context and treat them as a number in numeric context. Actually,
PerlNET even handles boolean context specially. It is supposed to "do
what I mean" automatically.

Of course there is a limit on what Perl can do with int64 values in
numeric context, as Perl numbers don't have the same value range. We
have been thinking about implicitly converting them to Math::BigInt
objects if they cannot be represented accurately in either integers or
floating point numbers. Is this what you expect to happen?

>  my $res = $val->ToString(); print $res;
> 
>  It does not work.... ($res it undef...)

Well, according to your bless statement above, it is an undefined value...

>  I am trying to do a DataSet to pure perl Struct converter...

Can you provide some more information? Ideally a complete little sample
program that show the problem?

>  Do you have any idea?

Sorry, I still don't understand what you are trying to do. Don't try to
push PerlNET into the strongly typed language corner. It tries to stay
as close as possible to being dynamically typed and make decisions at
runtime based on actual types of variables at that point in time.

I'm very interested to learn if there is a gap in things you can do with
PerlNET. But I still don't get the problem. So please show me a complete
sample. Show me how to do something in C# and explain why you can't do
it in PerlNET.

Cheers,
-Jan


_______________________________________________
Perl.NET mailing list
Perl.NET@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Severan Rault
Severan Rault
Jan Dubois
Severan Rault

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved