in reply to WWW::Mechanize help

$agent->field("COMMENT", join("\n", "$ARGV[4]"));

You're not even using the variable $form_comments in this line, and I don't see any connection to $ARGV[4] at all. (Why do you access @ARGV in a CGI script anyway? CGI.pm should take care of this.)

So either you have a simple thinko, or you're not showing the relevant part of the script.

Update: this: join("\n", "$ARGV[4]") is just the same as $ARGV[4], because "$ARGV[4]" is a scalar, thus join will do nothing to it.

Replies are listed 'Best First'.
Re^2: WWW::Mechanize help
by ZimCS (Novice) on Aug 19, 2008 at 20:59 UTC
    I thought I explained that. $form_comments is passed to another Perl script along with other parameters. When you use: system ("submit.pl", ...$form_comments does it not push that variable into ARGV? ?
      There is no such limitation, if you do it right:
      $ cat foo.pl #!/usr/bin/perl use strict; use warnings; use Data::Dumper; if (@ARGV){ print Dumper \@ARGV; } else { system $^X, $0, "a\nb"; } __END__ $ perl foo.pl $VAR1 = [ 'a b' ];

      You can see that the script calls a copy of itself, and both lines of a\nb are passed correctly to the second copy (tested on Linux).

      Which makes me think that you're doing something wrong.

Re^2: WWW::Mechanize help
by ZimCS (Novice) on Aug 20, 2008 at 15:12 UTC
    On your update, I took out the join statement and set it as  $agent->field("COMMENT", $ARGV[4]); . If what I fille in on my form is EzBR Warnings:
    - Klocwork Complexity:NOT OK (empty)
    - Klocwork Inforce:NOT OK (empty)
    - UnitTest enclosure:OK
    The only line from the text box that gets passed is "EzBR Warnings:" and none of the following lines. Any idea on how to make it all be passed? To summarize, there is a website we use at work that takes way too much time to fill out, so I made another site than has a form with fewer inputs, takes that input and then scrapes the original site with WWW::Mechanzie
      Again if you do it properly, it should work. Which means that you are not doing it properly. Which in turn means that your error is somewhere around line 42.

      Or in other words: If you don't show us the code, we can't tell.

      Show us a very simple, reduce example that demonstrates your problem. It doesn't have to use WWW::Mechanize at it, it can just pass around constant string.

        I will try and filter out the relative information so it isn't so long.
        #---------------------------------------------------- # use STATEMENTS #---------------------------------------------------- use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); #---------------------------------------------------- # Get input from website #---------------------------------------------------- my $query = new CGI; my $form_product = $query->param('product'); my $form_tested_on_build = $query->param('tested_on'); my $form_feature = $query->param('feature'); my $form_crs_resolved = $query->param('crs_resolved'); my $form_comments = $query->param('comments'); my $form_paths = $query->param('paths'); . . . system ("submit.pl", $id_line, $form_tested_on_build, $form_feature, $ +form_crs_resolved, $form_comments, $temp_paths);
        And then submit.pl contains:
        #------------------------------------------- # use STATEMENTS #------------------------------------------- use CGI::Carp qw(fatalsToBrowser); use CGI; use strict; use WWW::Mechanize; use Time::HiRes; . . . # Second page of WSDBuild $agent->field("ID_BUILD_TESTED", "$ARGV[1]"); $agent->select("ID_TEAM", "3456"); # Defaulted to CDMA Common Compone +nt $agent->field("HEADLINE", "$ARGV[2]"); $agent->field("CR_LIST", join("\n", "$ARGV[3]")); #$agent->field("COMMENT", join("\n", "$ARGV[4]")); $agent->field("COMMENT", $ARGV[4]); #$agent->field("PATHS", join("\n", $ARGV[5])); $agent->click(); # Saves submitted page whether successful or not $agent->save_content("$log_file");
        I am just concerned with the comments field for now, because the others are only 1 line. Let me know if there is anything else that will help. Thanks.