Skip Menu |
 

This queue is for tickets about the XS-Writer CPAN distribution.

Report information
The Basics
Id: 34456
Status: new
Priority: 0/
Queue: XS-Writer

People
Owner: Nobody in particular
Requestors: schwern [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Whitespace cleanup
Date: Wed, 26 Mar 2008 14:00:47 -0700
To: bug-XS-Writer [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Download (untitled) / with headers
text/plain 811b
Show quoted text
-------- Original Message -------- Subject: Re: XS::Writer Date: Fri, 21 Mar 2008 21:18:54 -0700 From: Tom Heady <tom@heady.org> To: Michael G Schwern <schwern@pobox.com> CC: Marvin Humphrey <marvin@rectangular.com> References: <47E38E25.6030802@pobox.com> Michael G Schwern wrote:
> Hey folks, you might be interested in a module I just whipped up to > generate the necessary XS code to make objects out of structs. > http://svn.schwern.org/svn/CPAN/XS-Writer/ >
Looks pretty good. We should come up with a more generic way to map types. I have a struct with uint32_t and uint64_t that are fairly easy to map. Attached patch is mainly whitespace cleanup cause I am anal, but there is one method call in a test file that was missing an a (heder_file => header_file) Tom -- Hating the web since 1994.
Index: t/Some-Employee/lib/Some/typemap =================================================================== --- t/Some-Employee/lib/Some/typemap (revision 4263) +++ t/Some-Employee/lib/Some/typemap (working copy) @@ -1,2 +1,2 @@ TYPEMAP -Some::Employee T_PTROBJ \ No newline at end of file +Some::Employee T_PTROBJ Index: t/struct.t =================================================================== --- t/struct.t (revision 4263) +++ t/struct.t (working copy) @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -use Test::More 'no_plan'; +use Test::More tests => 12; use Test::Differences; use File::Path; @@ -102,7 +102,7 @@ eq_or_diff join("", <$fh>), $xs; ok open $fh, $writer->header_file - or diag "Can't open @{[ $writer->heder_file ]}: $!"; + or diag "Can't open @{[ $writer->header_file ]}: $!"; eq_or_diff join("", <$fh>), <<"END"; /* Generated by XS::Writer $XS::Writer::VERSION */ Index: t/tryit.t =================================================================== --- t/tryit.t (revision 4263) +++ t/tryit.t (working copy) @@ -6,7 +6,7 @@ unless eval { require ExtUtils::CBuilder }; plan skip_all => "Need a working compiler" unless ExtUtils::CBuilder->new->have_compiler; -plan "no_plan"; +plan tests => 5; use File::Spec; my $perl = File::Spec->rel2abs($^X); Index: lib/XS/Writer.pm =================================================================== --- lib/XS/Writer.pm (revision 4263) +++ lib/XS/Writer.pm (working copy) @@ -72,7 +72,7 @@ # You must add this to lib/Some/typemap TYPEMAP - Some::Employee T_PTROBJ + Some::Employee T_PTROBJ # And finally in lib/Some/Employee.pm @@ -342,7 +342,7 @@ @{[ $self->xs_type ]}_new( char* CLASS ) CODE: RETVAL = (@{[ $self->struct_constructor ]}); - if( RETVAL == NULL ) { + if( RETVAL == NULL ) { warn( "unable to create new @{[ $self->package ]}" ); } OUTPUT: @@ -402,21 +402,21 @@ sub write_xs { my $self = shift; - + $self->write_xs_file; $self->write_header; } sub write_xs_file { my $self = shift; - + my $fh = $self->open_file(">", $self->xs_file); print $fh $self->make_xs; } sub write_header { my $self = shift; - + my $fh = $self->open_file(">", $self->header_file); print $fh <<"END"; /* Generated by XS::Writer $XS::Writer::VERSION */ @@ -431,13 +431,13 @@ sub open_file { my $self = shift; my($mode, $file) = @_; - + my $dir = dirname($file); mkpath $dir unless -d $dir; - + open my $fh, $mode, $file or die "Can't write to $file: $!"; - + return $fh; }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.