Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 27631
Status: resolved
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: siddharth_chhabra [...] yahoo.com
Cc:
AdminCc:

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



Subject: perl parsing heredoc ?
Date: Mon, 18 Jun 2007 17:14:19 -0700 (PDT)
To: bug-PPI [...] rt.cpan.org
From: Siddharth Chhabra <siddharth_chhabra [...] yahoo.com>
hi I am submitting 2 files for a unit test tmp.pl and parsePerl the variable $sql1 does not show me the value. also the pdom look peculiar...everything is treated as whitespace (i think) i am a perl newbie. any help would be appreciated. is this a known/unknown bug? if not what am i doing wrong ? thanks a lot for your time. tmp.pl starts here ----------------------------------- #!/usr/local/bin/perl # ################################################################### use DBI; use Sys::Hostname; use Getopt::Long; use strict; use warnings; no warnings qw(uninitialized); $|++; my $sql1 = << "EOSQL"; commit; select mid, avgease = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_ease))/convert(numeric(28,0),count(avg_ease)))), avgselect = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_select))/convert(numeric(28,0),count(avg_select)))), avginfo = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_info))/convert(numeric(28,0),count(avg_info)))), avgprice = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_price))/convert(numeric(28,0),count(avg_price)))), avgsite = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_site))/convert(numeric(28,0),count(avg_site)))), avgavail = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_avail))/convert(numeric(28,0),count(avg_avail)))), avgprrep = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_prrep))/convert(numeric(28,0),count(avg_prrep)))), avgcusts = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_custs))/convert(numeric(28,0),count(avg_custs)))), avgprvcy = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_prvcy))/convert(numeric(28,0),count(avg_prvcy)))), avgship = convert(numeric(3,1),(convert(numeric(28,0),sum(avg_ship))/convert(numeric(28,0),count(avg_ship)))), avglikely = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_likely))/convert(numeric(28,0),count(avg_likely)))), avgoverall = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_overall))/convert(numeric(28,0),count(avg_OverAll)))), avgatt1 = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_att1))/convert(numeric(28,0),count(avg_att1)))), avgatt2 = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_att2))/convert(numeric(28,0),count(avg_att2)))), avgatt3 = convert(numeric(3,1), (convert(numeric(28,0),sum(avg_att3))/convert(numeric(28,0),count(avg_att3)))), avgatt4 = null, avgatt5 = null, avgatt6 = null from site_scores_retail where mid not in (27352,29849) group by mid; commit; rollback; EOSQL my $sql2 = ""; tmp.pl ends here ----------------------------------- parsePerl starts here ------------------------------- #!/usr/bin/perl use PPI; use PPI::Dumper; my $perlfile=$ARGV[0]; # Create a new empty document my $Document = PPI::Document->new; # Create a document from source #$Document = PPI::Document->new(\'print "Hello World!\n"'); # Load a Document from a file $Document = PPI::Document->new($perlfile); # Does it contain any POD? if ( $Document->find_any('PPI::Token::Pod') ) { print "Module contains POD\n"; } # Get the name of the main package #$pkg = $Document->find_first('PPI::Statement::Package')->namespace; # Remove all that nasty documentation $Document->prune('PPI::Token::Pod'); $Document->prune('PPI::Token::Comment'); # Create the dumper my $Dumper = PPI::Dumper->new( $Document ); # Dump the document $Dumper->print; # Save the file #$Document->save($perlfile.".stripped"); my $ST = $Document->find('Statement::Variable'); foreach my $Var ( @$ST ) { print $Var."\n"; } parsePerl ends here ------------------------------- Send instant messages to your online friends http://uk.messenger.yahoo.com
Since this is a very old newbie question i am closing it for now. If any help can still be rendered, please ask in the github issues. I promise we'll answer faster this time around. :)