[albany-pm] Typeglobs help!

Patrick Cronin oshihuna at gmail.com
Fri Mar 28 07:52:54 PDT 2014


Well,

It turns that I CAN install the Scalar::Util. A good old college try finally got the XS version of Scalar::Util installed. I am not sure what originally prevented me from doing that several years ago (2008), but I was also running into this issue, so I was generally fed up with Scalar::Util at the time. This time from the cpan shell I 'look Scalar::Util' and make clean; perl Makefile.PL; make; make test; make install and it was smooth.

Net::OpenSSH doesn't have dualvar issues any more because now I have dualvar.

Thanks for your help (everyone) and it's great to know that there are monks on the list!

-Pat

	Patrick Cronin 
Computer Lover
Mobile: +1 518 336 5133
Email: oshihuna at gmail.com
Skype: patrickcronin12061 

P Please consider the environment before printing this e-mail / attachments 	 

On 28 Mar 2014, at 12:25 AM, Packy Anderson <packy at dardan.com> wrote:

> Another thought: you say for <REASONS> you can't upgrade "it".  Which item does "it" refer to, the "CentOS 5.10" or the "perl 5.8.8"?
> 
> Would it be possible to use perlbrew to install a parallel, newer version of perl that, perhaps, you CAN install the XS version of Scalar::Util into?  You wouldn't be upgrading either the OS or the system perl: you'd be installing a parallel perl installation which has it's own library of modules.  It's what I do when I'm on a system and need a better perl than what's in /usr/bin/perl; that way, I don't have to worry about screwing up anything that depends on the ancient version of perl that shipped with the OS.
> 
> Just a thought...
> 
> -packy
> 
> 
> On Thu, Mar 27, 2014 at 11:26 PM, Patrick Cronin <oshihuna at gmail.com> wrote:
> I have the book Mastering Perl, and a few months ago I thought I was pretty good. Now I just learned that Mastering Perl is only half of what Perl is all about.
> 
> Thanks for the info and the link!
> 
> 
> On Mar 27, 2014, at 10:26 PM, Benjamin Holzman <bholzman at gmail.com> wrote:
> 
>> 
>> Don't think there is a pure perl way to do a dualvar. It's got nothing to do with typeglobs, dualvars work by abusing the IVX slot of a PVIV scalar. See http://cpansearch.perl.org/src/RURBAN/illguts-0.36/index.html#svpviv
>> 
>> 
>> On Thu, Mar 27, 2014 at 9:46 PM, Patrick Cronin <oshihuna at gmail.com> wrote:
>> I manage a CentOS 5.10 server running perl 5.8.8. For <REASONS>, I can't upgrade it.
>> 
>> For some reason, I can't install the XS version of Scalar::Util, and so I'm stuck using the PP version. Net::OpenSSH relies on Scalar::Util's dualvar function (which is only available in the XS version of Scalar::Util) to create a single scalar holding both an integer and string value. When the scalar is used in a numeric context, the integer value comes out, and when the scalar is used in a string context, the string value comes out. I'm trying to write a quick and dirty PP version of dualvar so I can move on with my life.
>> 
>> I seem to remember seeing this being done, but no amount of googling is getting me there. I've looked up typeglobs and the *foo{THING} construct, but while THING can be SCALAR, it can't be NUMBER or STRING. Does anyone know the magic to make this happen?
>> 
>> I'm trying variations of the following:
>> 
>> my $int = 2;
>> my $string = "test";
>> 
>> my $typeglob = $int;
>> *typeglob{SCALAR} = ${ *string };
>> 
>> print ($typeglob + 2) . "\n";
>> print $typeglob . " YES!\n";
>> 
>> It just feels gross, and it's not working.
>> 
>> Does anyone have the magic?
>> 
>> 	Patrick Cronin 
>> Computer Lover
>> Mobile: +1 518 336 5133
>> Email: oshihuna at gmail.com
>> Skype: patrickcronin12061 
>> 
>> P Please consider the environment before printing this e-mail / attachments 	 
>> 
>> 
>> _______________________________________________
>> Albany-pm mailing list
>> Albany-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/albany-pm
>> 
> 
> _______________________________________________
> Albany-pm mailing list
> Albany-pm at pm.org
> http://mail.pm.org/mailman/listinfo/albany-pm
> 
> 
> 
> -- 
> Packy Anderson
> 
> Email:  packy at dardan.com
> GVoice: (646) 833-8832

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/albany-pm/attachments/20140328/4a0d9245/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.pm.org/pipermail/albany-pm/attachments/20140328/4a0d9245/attachment.bin>


More information about the Albany-pm mailing list