Mailing List Archive

Re: by-module, by-category
> From: Kenneth Albanowski <kjahds@kjahds.com>
>
> On Fri, 6 Oct 1995, Tim Bunce wrote:
>
> > I don't know enough about these to add them:
> >
> > > NWINT/SHA- 99 SHA
> > > GSAR/Dumper- 99 Dumper
> > > KJALB/SetDualVar- 99 SetDualVar
>
> SetDualVar sets a variable to have different string and numeric values. I
> have no idea where it would best fit in the modulelist.
>
It probably belongs as an example in the perlapi or perlguts pods
and not as an extension.

Could you produce a patch to a pod for that?

Tim.
Re: by-module, by-category [ In reply to ]
On Mon, 9 Oct 1995, Tim Bunce wrote:

> It probably belongs as an example in the perlapi or perlguts pods
> and not as an extension.
>
> Could you produce a patch to a pod for that?

Yes, I suppose so. It snuggles half-way well in at the end of perlapi.
More expository stuff could be included, though.

> Tim.

*** perlapi.pod.save Mon Oct 9 18:24:03 1995
--- perlapi.pod Mon Oct 9 18:28:57 1995
***************
*** 954,957 ****
--- 954,1010 ----


+ =head1 ANOTHER EXAMPLE
+
+ SetDualVar changes a normal scalar into a doubly-typed scalar.
+
+ File C<SetDualVar.xs>:
+
+ #include "EXTERN.h"
+ #include "perl.h"
+ #include "XSUB.h"
+
+ MODULE = SetDualVar PACKAGE = SetDualVar
+
+
+ void
+ SetDualVar(variable,string,number)
+ SV * variable
+ SV * string
+ SV * number
+ CODE:
+ {
+ SvPV(string,na);
+ if(!SvPOKp(string) ||
+ (!SvNOKp(numeric) &&
+ !SvIOKp(numeric)) ) {
+ croak("Usage: SetDualVar variable,string,number");
+ }
+
+ sv_setsv(variable,string);
+ if(SvNOKp(number)) {
+ sv_setnv(variable,SvNV(number));
+ } else {
+ sv_setiv(variable,SvIV(number));
+ }
+ SvPOK_on(variable);
+ }
+
+ File C<SetDualVar.pm>:
+
+ package SetDualVar;
+
+ require Exporter;
+ require DynaLoader;
+
+ @ISA = qw(Exporter DynaLoader);
+ @EXPORT = qw( SetDualVar );
+ @EXPORT_OK = qw( );
+
+ bootstrap SetDualVar;
+
+ 1;
+ __END__
+
+
=head1 AUTHOR



--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
Re: by-module, by-category [ In reply to ]
On Wed, 11 Oct 1995, Paul Marquess wrote:

> > Yes, I suppose so. It snuggles half-way well in at the end of perlapi.
> > More expository stuff could be included, though.
>
> I thing perlguts would be a better place for it.

Dean Roehrich has mentioned this to me, and is generally talking about
reorganizing perlapi and perlguts a little. Hopefully that chunk of code
can find a good home -- it's a simple example of both guts _and_ XS,
unfortunately.

> Paul

--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
Re: by-module, by-category [ In reply to ]
From: Kenneth Albanowski <kjahds@kjahds.com>
>
> On Mon, 9 Oct 1995, Tim Bunce wrote:
>
> > It probably belongs as an example in the perlapi or perlguts pods
> > and not as an extension.
> >
> > Could you produce a patch to a pod for that?
>
> Yes, I suppose so. It snuggles half-way well in at the end of perlapi.
> More expository stuff could be included, though.

I thing perlguts would be a better place for it.

Paul