Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
"be consistent"
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

So, I have some code, that always errors, this is the error:No -label at C:/strawberry/perl/site/lib/Tk/Widget.pm line 256. Here is the code that does causes it, it gets annoying. I Updated the code listing on here.

#!/usr/bin/perl ############################################# # Call List Manager, Copyright 2012 Sam # # Flint, linuxkid@linux.com. # # Licensed under the GNU GPLv3 # ############################################# # PMDF # # Version: 1.0 # # License: GNU GPLv3 # # Name: Call List Manager # # File: clm.pl # # Author: Sam Flint, linuxkid@linux.com # # Maintainer: Sam Flint, linuxkid@linux.com # # Commenting: verbose # ############################################# #Extensions Needed use Tk; use PDF::Reuse; use YAML::Tiny; use Tk::Tree; use Tk::ROText; use Tk::LabEntry; use Tk::Text; $iparse = YAML::Tiny->new(); $Mw = MainWindow->new(-title=> "Calling List Manager"); $menuitems = [ [Cascade => "File", -menuitems=> [ [Button => "~Open", -command=> \&open], [Button => "~Save", -command=> \&savefile], [Button => "Save ~As", -command=> \&saveas], #[Seperator => ""], [Button => "E~xit", -command=> \&exitprog], ] ], [Cascade => "Edit", -menuitems=> [ [Button => "Add Calle~r", -command=> \&acaller], [Button => "Add Calle~e", -command=> \&acallee], #[Seperator => ""], [Button => "Remove Caller", -command=> \&rcaller], [Button => "Remove Callee", -command=> \&rcallee], #[Seperator => ""], [Button => "~Generate Call Lists", -command=> \&generate], [Button => "~Mail Call Lists", -command=> \&mailout], #[Seperator => ""], [Button => "~Preferences", -command=> \&prefs], ] ], [Cascade => "Help", -menuitems=> [ [Button => "~About", -command=> \&about], [Button => "~Help", -command=> \&help], ] ] ]; $menubar = $Mw->Menu(-menuitems => $menuitems); $Mw->configure(-menu => $menubar); $wframe = $Mw->Frame()->pack(-side=>'top', -fill=>'both', -expand => 1 +); $tree = $wframe->Scrolled( 'Tree', -relief => 'flat', -scrollbars => 'osoe', -borderwidth => 0, -separator => '.', -drawbranch => 'true', -indicator => 'true', )->pack(-side => 'top', -fill => 'both', -expand => 1); $inf = $Mw->Frame()->pack(-side=> "top", -fill=> "x", -expand=> 1); $inf->Label(-text=> "Status:")->pack(-side=>'left', -expand=> 1); $inf->Label(-textvariable=> \$message)->pack(-side=>'left', -fill=>'x' +, -expand=> 1); $inf->Label(-text=> "Save State")->pack(-side=>'left', -fill=>'x',, -e +xpand => 1); $inf->Label(-textvariable=> \$savestate)->pack(-side=>'left', -fill=>' +x', -expand => 1); #openprefs(); MainLoop(); # main Subs $helptext = <<EOF; EOF sub ginf { $tree->info('selection'); } sub openfile { our $file = $Mw->getOpenFile(); our $data = $iparse->read($file) || $Mw->Dialog(-title=> "File Open + Error", -text=>"$!: Cannot Open File: $file!", -buttons=>["Ok"], -de +faultbutton=>"Ok", -bitmap=> "warning")->show();; our @list; our @callers; foreach (<FH>) { if ($type eq "caller") { $id = shift @fields; $phnum = shift @fields; $email = shift @fields; $address = shift @fields; $notes = shift @fields; $data->{$id}->{type} = 'caller'; $data->{$id}->{name} = $id; $data->{$id}->{phnum} = $phnum; $data->{$id}->{email} = $email; $data->{$id}->{addr} = $address; $data->{$id}->{notes} = $notes; push @list, $id; push @callers, $id; } elsif($type eq "callee") { $caller = shift @fields; $name = shift @fields; $phnum = shift @fields; $email = shift @fields; $address = shift @fields; $notes = shift @fields; $id = $caller.'.'.$name; $data->{$id}->{type} = 'callee'; $data->{$id}->{name} = $name; $data->{$id}->{phnum} = $phnum; $data->{$id}->{email} = $email; $data->{$id}->{addr} = $address; $data->{$id}->{caller} = $caller; $data->{$id}->{notes} = $notes; push @list, $id; } else { next; } } redotree(); } sub redotree { $tree->delete(0, 'end'); my $col = 0; foreach $node (@job_list) { $node_name = (split('.', $node))[-1]; $node_name = $node if ($node_name eq ''); $tree->add($node); $tree->itemCreate( $node, $col, -text => $node_name, -itemtype => 'text'); } $tree->autosetmode(); } sub savefile { $sfile = $file; $sfile ||= shift; $data->write($sfile); } sub saveas { savefile($Mw->getSaveFile()); } sub exitprog { savefile(); $Mw->Withdraw(); exit; } sub acaller { editentry("boogie", "new", "caller"); } sub acallee { editentry("boogie", "new", "callee"); } sub rcaller { } sub rcallee { } sub generate { } sub mailout { } sub prefs { } sub about { $tlw = $Mw->Toplevel(-title=> "About"); $info = $tlw->ROText()->pack(-side => 'top', -fill => 'both', -expa +nd => 1); $info->insert('end', "Calling List Manager, Copyright, 2012 Sam Fli +nt.\n"); $info->insert('end', "Version 1.0\n"); $info->insert('end', "Registered to $conf->{registered}\n"); $tlw->Button(-text=> "Ok", -command=> sub { $tlw->withdraw })->pack +(); } sub help { $tlw = $Mw->Toplevel(-title=>"Help"); $info = $tlw->ROText()->pack(-side => 'top', -fill => 'both', -expa +nd => 1); $tlw->Button(-text=> "Ok", -command=> sub { $tlw->withdraw })->pack +(); $info->insert('end', $helptext); } sub editentry { $path = shift; $stat = shift; $type = shift || $data->{$path}->{type}; if ($stat eq 'new') { $tlw = $Mw->Toplevel("New Entry"); if ($type eq "caller") { $tlw->LabEntry(-text=>"Name", -textvariable=>\$id)->pack(-fil +l=>'x'); $tlw->LabEntry(-text=>"Phone Number", -textvariable=>\$phnum) +->pack(-fill=>'x'); $tlw->LabEntry(-text=>"Email", -textvariable=>\$id)->pack(-fi +ll=>'x'); $tlw->LabEntry(-text=>"Address", -textvariable=>\$id)->pack(- +fill=>'x'); $tlw->Text(-text=>"Name", -textvariable=>\$notes)->pack(-fill +=>'x'); $tlw->Button(-text=> "Ok", -command=> sub { $data->{$id}->{name} = $name; $data->{$id}->{type} = 'caller'; $data->{$id}->{phnum} = $phnum; $data->{$id}->{email} = $email; $data->{$id}->{addr} = $address; $data->{$id}->{notes} = $notes; })->pack(-fill=>'x'); } elsif($type eq "callee") { } else { $tlw->withdraw(); } } elsif($stat eq 'old') { $tlw = $Mw->Toplevel(-title=> "Edit Entry"); } else { redotree(); } } sub openprefs { open FH, "~/clm.conf"; bless our $conf; foreach (<FH>) { ($key, $value) = split /:/; $conf->{$key} = $value; } } __END__
Please ignore unwritten subs, I have to get the interface working, otherwise it won't matter.

--linuxkid

imrunningoutofideas.co.cc

In reply to Code Review Time! by linuxkid

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (6)
    As of 2014-04-20 11:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (485 votes), past polls