Thanks to all my brothers /sisters who has assisted me so far.

My script is so far
package TWiki::Plugins::FogbugzTablePlugin; use strict; use DBI; use vars qw( $connection ); # cached connection # DBI specification of the connection to the database my $DB_PATH = "DBI:Sybase:server=192.168.70.56"; # DB user my $DB_USER = 'twiki'; # DB user's password my $DB_PASS = 'twiki'; # TWiki ihook sub initPlugin { return 1; } # TWiki hook; this is run on the text being translated to HTML, and is # your opportunity to expand any tags in that text. sub commonTagsHandler { my($text, $topic, $web ) = @_; #$_[0] refers to the first parameter to this function $_[0] =~ s/\bFog(\d+)/_link_to_bug($1)/ge; $_[0] =~ s/%FOG{(.*?)}%/_show_bugs($1)/ge; } # Connect to the DB sub _connect { my $this = shift; unless( $connection ) { $connection = DBI->connect( $DB_PATH, $DB_USER, $DB_PASS, { PrintError => 0, RaiseError => 1, }); } return $connection; } sub _show_bugs { my $args = shift; my @headers = map { "*$_*" } qw/ ID Title Priority Name fix_for Sta +te /; my $fmt = "| %s | %s | %s | %s | %s | %s |\n"; _connect(); my $sth =$connection->prepare(my $sql = "SELECT Bug.ixBug, Bug.sTitle, + Priority.sPriority, Person.sFullName, FixFor.sFixFor, Status.sStatus + FROM Bug, Priority, Person, FixFor, Status WHERE (Bug.ixPriority=Pri +ority.ixPriority) AND (Bug.ixPersonAssignedTo=Person.ixPerson) AND (B +ug.ixStatus = Status.ixStatus) AND (Bug.ixFixFor = FixFor.ixFixFor) A +ND (Bug.ixBug = $args)"); $sth->execute(); while (my @rows = $sth->fetchrow_array() ) { return join '', map {sprintf $fmt, @$_ } \@headers, \@rows; } $sth->finish; } sub _link_to_bug { my $bugid = shift; return '[[http://apwadev01/fogbugz/default.asp?'.$bugid.'][Fog'.$b +ugid.']]'; } 1;
Now the script bring back everything from one record (which is perfect) but the script is meant to take in a list of id numbers i.e 23,45,3564 and populate a whole table. I am starting to read about fetchrow from the dbi but it seems that will return more than one record that fit a criteria of a single search (am i right?) What i need is that the syntax %FOG{num1,num2,num3}% populates one table with three records the reading in off the numbers is correct but the script above fails becuase it can only do %FOG(num1,num2,num}% .

What should commands should i read that may be helpful apart from fetchall ? Plus where can i find an detailed explanation of map? I want to append the string 'FOG' to the begining of the first field of my result not to Headers or other subsequent fields in the table?

Thanks again


In reply to What do i need to read to .. by yoyomonkey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.