Please help the scalar that is getting submitted for $input_data when this is submitted it is all one line. The file it reads in has line breaks. txtIncidentDescription is the description field that is having the issue. I am reading in the file with File::Slurp.
#!perl use strict; use warnings; use WWW::Mechanize; use Term::InKey; use Win32::Clipboard; use File::Slurp; my $ua = LWP::UserAgent->new; #DETERMINING END USER my $oldSSO = qx{whoami}; chomp $oldSSO; my ($sso) = $oldSSO =~ /.*(\w{2}\d{5})/; #PROMPTING FOR PASSWORD print "Enter Password: "; my $pass = &ReadPassword; chomp $pass; #SETTING DATA TO SUBMIT my $input_data = read_file( 'C:/temp/vpn_user.txt' ); #DECLARE URL VARIABLES my $url1 = "https://url1"; my $url2 = "https://url2"; my $url3 = "https://url3"; #TURN OFF SSL CHECKING $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; #MECHANIZE TO GET AND PRINT CONTENT my $mech = WWW::Mechanize->new(timeout => 60, autocheck => 1); #SET COOKIE JAR $mech->cookie_jar(HTTP::Cookies->new); #USER AGENT $mech->agent_alias( 'Windows IE 6' ); $mech->get($url1); $mech->form_name('Login'); $mech->field(USER => "$sso"); $mech->field(PASSWORD => "$pass"); $mech->click(); $mech->get($url2); #SET FORM VALUES $mech->form_name('frmTicketCreate'); $mech->field('ddlProducts' => 1245); $mech->field('txtIncidentDescription' => $input_data); $mech->field('ctrlAssignedGroupLookup_mTxtName' => "assigned team"); $mech->field('__EVENTTARGET', 'ctrlAssignedGroupLookup_mBtnSearch_lnkB +utton'); $mech->submit('ctrlAssignedGroupLookup_mBtnSearch_lnkButton'); my $content_login = $mech->content(); my ($number) = $content_login =~ /ctrlAssignedGroupLookup_mCBLLookupGr +oups\S value\S\S(\d+)/; #print $number, "\n"; $mech->field('ctrlAssignedGroupLookup_mCBLLookupGroups' => $number); #$mech->form_name('frmTicketCreateFileUpload'); #SUBMIT FORM $mech->form_name('frmTicketCreate'); $mech->field('__EVENTTARGET', 'btnSave_lnkButton'); $mech->submit();

In reply to mechanize submission is all one line and loses line breaks reading input by diamondsandperls

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.