Hello Monks!
I have a question and it may be quite elaborate. I've spent a day in this problem and maybe there isn't a straight forward solution or I may just be stupid!
So here I go: I've ActiveState Perl v5.8. I'm using WxPerl to create a GUI.
Lets say I have two text fields (WxTextCtrl) from which I take inputs. I then use WWW::Mechanize to fill in a web form with these two inputs and submit the form (consider the code below).

Now the problem is that it doesn't work! Its not a problem with HTTP or any other network related stuffs. When I just pass simple string value as follows for example "$title = "whatever"; and $commentfile = "file.htm"", the program works but when I take content of text box and fill in the form, it doesn't work.
The only explanation that I can think of is because WxTextCtrl->GetValue() returns WxString. Since WxString is derived from std::string I don't think this should happen!
Has anyone faced similar sort of problem?
I tried $title = sprintf("%s",$title) in attempt to convert $title from WxString to std::string, but to no avail (or was this stupid attempt :P).
sub __mechanize_http { $win = @_; $title = $win->{titleTxt}->GetValue(); #$win is the main window and +titleTxt is the name of one of the text field. GetValue() will return + the content of text field in WxString fromat. $commentfile = $win->{fileNameTxt}->GetValue(); #Wx::TextCtrl->GetValue() returns WxString. print "\nTitle: ",$title; print "\nOutput: ", $commentfile; my $url = "http://www.example.com/"; my $mech = WWW::Mechanize->new(autocheck => 1); $mech->agent_alias ( "Windows IE 6" ); $mech->get($url) or die "Can't even get $url: " . $mech->response->status_line unless ($mech->success); $mech->form_name('AddForm'); $mech->field(title => $title); $mech->field(commentfile => $commentfile); $mech->submit(); }

In reply to Question on WxString (WxPerl) and WWW::Mechanize by Ash Rai

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.