~hikibi/p5-cassandra-simple/master

« back to all changes in this revision

Viewing changes to lib/Cassandra/Composite.pm

  • Committer: Filipe Gonçalves
  • Date: 2012-12-10 11:02:25 UTC
  • Revision ID: git-v1:5a417b7c4c4d27d3f0982abf8ffc38d1ec731736
        * Proper error handling.
        * Updated thrift generated code.
        * Updated API for easier and more reliable debugging.
        * Updated examples to match the changes.
        * Introduced LazyQuery for easy iteration over all query results.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
sub composite {
26
26
        my @args = @_;
27
 
 
28
 
        #print "Input -> ". Dumper @{$args} ;
 
27
        
 
28
        @args = grep { defined($_) } @args;
 
29
        #print "Input -> ". Dumper \@args;
29
30
        my $res = join "", map {
30
31
                my $component = $_ || '';
31
32
                my $eoc       = "\x00";
48
49
        my $size = length($name);
49
50
        my @a;
50
51
        my $len = 0;
51
 
        do {
52
 
                my $off += unpack( 'n', substr $name, $len, $len + 2 );
 
52
        while ( $len < $size ) {
 
53
                my $off = unpack( 'n', substr $name, $len, $len + 2 );
53
54
                push @a, substr $name, $len + 2, $off;
54
55
                $len += $off + 3;
55
 
        } while ( $len < $size );
 
56
        };
56
57
 
57
58
        #print "Output ->". Dumper \@a;
58
59
        return \@a;