[11682] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5282 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 2 01:04:42 1999

Date: Thu, 1 Apr 99 22:00:17 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 1 Apr 1999     Volume: 8 Number: 5282

Today's topics:
    Re: Active perl / Win98 and Apache <rmcvay@acm.org>
        ActivePerl win32 and fork() ?? Does it work on any win  (Davekonz)
    Re: Can you return hashes in subroutines? <jdf@pobox.com>
    Re: Can you return hashes in subroutines? (Krusty276)
    Re: Can you return hashes in subroutines? (Krusty276)
    Re: check to see if directory exists <tigrank@inreach.com>
    Re: create html (Ronald J Kimball)
    Re: multi-d array <perlguy@technologist.com>
    Re: multi-d array (Ronald J Kimball)
    Re: my random doesn't return number!! (Ronald J Kimball)
        newb quest about perl builds for win32 -- how to start? (Davekonz)
        Perl to C <hank@connor-miller.com>
    Re: Reading a line <jglascoe@giss.nasa.gov>
        RegEx question [part II: the input file (string?)] <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
        RegEx question <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
    Re: Retrieving  info after POSTing from a perl script <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
    Re: Retrieving  info after POSTing from a perl script (Bob Trieger)
    Re: Retrieving  info after POSTing from a perl script <gregm@well.com>
        simple request/question <syt@email*@sp\am|@|spa/m@*.com>
    Re: Sun Microsystems Sponsors Perl Mongers <jdf@pobox.com>
    Re: Sun Microsystems Sponsors Perl Mongers (David H. Adler)
    Re: Timing a download (David Efflandt)
        Washington DC Area Job in E-Commerce (Craig Vitter)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 02 Apr 1999 04:33:26 GMT
From: Ray McVay <rmcvay@acm.org>
Subject: Re: Active perl / Win98 and Apache
Message-Id: <37044027.59BF66F8@acm.org>

David Smith wrote:
> 
> I have the following installed
> 
> ActivePerl 509
> Win98
> Apache 1.3.6
> 
> It would seem that although the line :
> 
> perl prog.pl
> 
> will run the webserver does not want to run any scripts at all,

Do you have a #!/perl_directory/bin/perl in it?
Have you set the ScriptAlias correctly?
That's about all there is to it.

-- 

Ray
+--------------------------------------------------+
+ I've gone to look for myself. If I should return +
+ before I get back, keep me here!! - Bill the Cat +
+--------------------------------------------------+




------------------------------

Date: 2 Apr 1999 05:38:59 GMT
From: davekonz@aol.com (Davekonz)
Subject: ActivePerl win32 and fork() ?? Does it work on any win platform?
Message-Id: <19990402003859.06278.00001046@ng-ft1.aol.com>

Is fort() a working function on any win32 platform.  I know it is not on win95.
 Does it work on win98 or NT ( lets say 4.0 or later )..

Also does perl have a defined lock ( semiphor (?)) as part of the lang?

Thanks
  davekonz
Just trying to understand little by little.


------------------------------

Date: 01 Apr 1999 22:38:13 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: krusty276@aol.com (Krusty276)
Subject: Re: Can you return hashes in subroutines?
Message-Id: <m31zi3u1y2.fsf@joshua.panix.com>

krusty276@aol.com (Krusty276) writes:

>   (local %return_this_hash);

> Are hashes always global.  

No, but global variables (like those declared with local()) are always
global.  Perhaps you want my()?

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


------------------------------

Date: 2 Apr 1999 04:05:49 GMT
From: krusty276@aol.com (Krusty276)
Subject: Re: Can you return hashes in subroutines?
Message-Id: <19990401230549.10024.00001319@ng142.aol.com>

thanks for the help,
but how can I use the returned hash below


my $hash_ref = make_hash(\@array);

if I wanted to do
%hash= @$hash_ref;
print $#hash;

this didn't work when I tried it.  Any suggestions, also the @array in my
example has nothing to do with the hash I'm building.

Thanks

Dan Parker




sub make_hash {
    my $array_ref = shift;
    # non-trivial, but silly  ;^)
    my %hash = @$array_ref;
    return \%hash;
}

# example
my @array = ("one", 1, "two", 2);
my %hash = %{ make_hash(\@array) };

use Data::Dumper;
print Dumper \%hash;

	Jay Glascoe




------------------------------

Date: 2 Apr 1999 04:44:41 GMT
From: krusty276@aol.com (Krusty276)
Subject: Re: Can you return hashes in subroutines?
Message-Id: <19990401234441.29245.00001142@ng-fz1.aol.com>

I tried the following program

#!/usr/local/bin/perl


my @array = ("one", 1, "two", 2); #this has no meaning

#my $hash_ref = make_hash(\@array);
my %t_hash = %{ make_hash(\@array) };
print ("t_hash=$#t_hash\n"); #I want to see the value 2 here

sub make_hash {
    my $array_ref = shift;
     #non-trivial, but silly  ;^)
    my %hash = @$array_ref;
	$hash[2][1]="3";
    return \%hash;
}

### I get a hash= -1 for my output.  How can I pass back the hash??


------------------------------

Date: Thu, 01 Apr 1999 20:59:24 -0800
From: Tigran <tigrank@inreach.com>
Subject: Re: check to see if directory exists
Message-Id: <37044EAC.10F22A1C@inreach.com>

Use "opendir" and check return value, it's always works on Win32.

Tigran.

"Stephen M. Shelly" wrote:

> I am trying to see if a directory exists on an NT machine, and am having
> some troubles.
>
> Here is my test statement:
>
> if (!(-d "x:\\home\\$Name"))
>     print ("Need to create homedir for $Name");
>
> this is not working though.....
> Any ideas?



------------------------------

Date: Thu, 1 Apr 1999 21:54:43 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: create html
Message-Id: <1dplq38.6i44vfszpjuoN@[207.60.170.137]>

Philip Newton <Philip.Newton@datenrevision.de> wrote:

> He wanted to create a file, not display one on stdout:

So run the script I gave, and redirect the output to a file.  Duh.


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Thu, 01 Apr 1999 20:12:16 -0600
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: multi-d array
Message-Id: <37042780.73B99870@technologist.com>

Alvin Yong wrote:
> 
> how do I create an array-of-array or a multi-d array (I only need a 2-d
> array) Can I do something similar to what I do in C "Lol [i][j]"
> 
> it seems that ALL the references and stuff I read abt multi-dimensional
> array has to have to initialised values in each array as show
> "
> @Lol = (
> ["fred". "barney"],
> ["george", "jane", "elroy"],
> ["homer", "marge", "bart"]
> }
> "
> 
> can't I just create an array with null values and fill in the value with a
> counter (eg i)
> for (i=0; i < max; i++)
> for (j=0; j< max; i++)
> {
> @Lol[i][j] = "happy"
> }
> 
> pls I need help !!!

Yes, but you are a little off, try this instead:

 for ($i=0; $i < $max; $i++){
   for ($j=0; $j <$max; $j++){
     $Lol[$i][$j] = "happy";
   }
 }

Good luck!
Brent
-- 
Java?  I've heard of it, it is what I drink while hacking Perl! -me
+----------------------------------------+
|            Brent Michalski             |
|         -- Perl Evangelist --          |
|    E-Mail: perlguy@technologist.com    |
| Resume: http://www.inlink.com/~perlguy |
+----------------------------------------+


------------------------------

Date: Thu, 1 Apr 1999 21:54:44 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: multi-d array
Message-Id: <1dplqhh.n06jz71c74rbqN@[207.60.170.137]>

Alvin Yong <alyong@mbox3.singnet.com.sg> wrote:

> can't I just create an array with null values and fill in the value with a
> counter (eg i)
> for (i=0; i < max; i++)
> for (j=0; j< max; i++)
> {
> @Lol[i][j] = "happy"
> }

Yes, you can do that, except that it should be:

for ($i=0; $i < $max; $i++) {
  for ($j=0; $j < $max; $j++) {
    $Lol[$i][$j] = "happy";
  }
}

Now it's valid Perl.  :)


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Thu, 1 Apr 1999 21:54:46 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: my random doesn't return number!!
Message-Id: <1dplqng.1lx4ddg2kl2diN@[207.60.170.137]>

Bart Lateur <bart.lateur@skynet.be> wrote:

> Steve Linberg wrote:
> 
> >Did you try it?
> >
> >my @foo = (1, 2, 3, 4, 5);
> >for (1..50) {
> > print $foo[rand $#foo];
> >}
> >print "\n";
> >for (1..50) {
> > print $foo[rand scalar @foo];
> >}
> 
> Sounds overly complex.
> 
>   for (1..50) {
>     print 1+int(rand 5);
>   }
> 
> There.

Umm...  That works, but it kinda misses the point of comparing the
meaning of $#foo and scalar @foo, wouldn't you say?


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: 2 Apr 1999 05:35:34 GMT
From: davekonz@aol.com (Davekonz)
Subject: newb quest about perl builds for win32 -- how to start?
Message-Id: <19990402003534.06278.00001043@ng-ft1.aol.com>

Sorry, it's a day later and I've gotten the answer which is :  

If you take the default install,  the file type pl gets associated with the
perl interpreter, so just clicking on a xyz.pl file will be exected.

Or

In dos window, type 

perl xyz.pl 

and script will be exected.


Yes, it was in the documenation but, there is so much stuff in the
documentation, it just seemed like another thing.

Thanks all. 

bye

  davekonz


------------------------------

Date: 2 Apr 1999 02:35:31 GMT
From: "Hank Miller" <hank@connor-miller.com>
Subject: Perl to C
Message-Id: <7e1adj$dgd$1@comet3.magicnet.net>

I am looking for the perl to c compiler... any help would be greatly
appreciated...

--

-Hank...

http://www.connor-miller.com
hank@connor-miller.com

Office:
(407) 905-0600
(407) 905-0510 Fax

Home:
(407) 654-6031
(407) 654-6032 Fax





------------------------------

Date: Thu, 01 Apr 1999 20:46:09 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Tobias Weihmann <epyx.cjb.net@t-online.de>
Subject: Re: Reading a line
Message-Id: <37042160.AE9F72CD@giss.nasa.gov>

[courtesy copy of post sent to sys.stdin]

Tobias Weihmann wrote:
> 
> Hello,
> I am new to perl and would like to know if there is an
> easier way of reading lines from STDIN than to use
> the module Term::ReadKey as I do currently.
> Thanks in advance for any help!
> 
> Tobias

$line = <STDIN>;  # reads one line from STDIN
@lines = <STDIN>; # reads ALL lines from STDIN until end of file

# loop over incoming lines
while (<STDIN>) {
    print "you typed this line: ", $_;
}

	Jay Glascoe


------------------------------

Date: Fri, 02 Apr 1999 00:27:24 -0500
From: Ketan Patel <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
Subject: RegEx question [part II: the input file (string?)]
Message-Id: <3704553C.48DC2E1C@BLAHNOSPAMBLAHxwebdesign.com>

Oops... forgot to include a copy of the file...


HTTP/1.1 200 OK
Connection: close
Date: Fri, 02 Apr 1999 04:38:33 GMT
Server: Stronghold/2.3 Apache/1.2.6 C2NetUS/2010 mod_perl/1.15
Content-Type: text/html
Client-Date: Fri, 02 Apr 1999 04:38:35 GMT
Client-Peer: 128.197.27.22:80
Set-Cookie: SessionKey=fa0b8589ec74ec354dabbcd7dccfbe43:software6;
domain=.bu.edu; path=/
Title: University Class Schedule Report

<!-- ----------------------------------------------------------------
     This was generated for xi.pair.com                                  
     at Thu Apr  1 23:38:34
1999                                                                                         
     Boston University.                        
     Office of University Information Systems. 
     ----------------------------------------------------------------
-->

<META HTTP-EQUIV="Set-Cookie"
    CONTENT="SessionKey=fa0b8589ec74ec354dabbcd7dccfbe43:software6;
domain=.bu.edu; path=/"><HTML>
<HEAD>
<TITLE>University Class Schedule Report</TITLE>
</HEAD>
<BODY  BGCOLOR=#FFFFFF LINK=#CC0000 TEXT=#330000 VLINK=#CC0000
ALINK=#FF0000     >

<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0>
<TR>
  <TD><FONT SIZE=+1 COLOR=#660000 FACE="Verdana, Helvetica, Arial,
sans-serif"><B>UNIVERSITY CLASS SCHEDULE</B></FONT>
  <TD ALIGN=right>
<!-- Go Back In Window Include                   -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide ability to go  -->
<!-- back to prior cached image. This is useful  -->
<!-- in navigating back to an entry form.        -->

<A HREF="javascript:history.back()">Back</A> |
<!-- Go to Menu Include                          -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide ability to go  -->
<!-- to the most recently displayed menu in the  -->
<!-- URL history queue by substring matching.    -->

<A
HREF=https://www.bu.edu/link/bin/uiscgi_studentlink?ModuleName=menu.pl>Menu</A>
|
<!-- Registrar's Office Email Include            -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide an e-mail      -->
<!-- link to the Registrar's Office.             -->
<!--                                             -->
<SCRIPT LANGUAGE="JavaScript">
//
// Set variables required for e-mail call.
//  
RecipientDesc = "Registrar's Office";
RecipientID   = "regstrar@bu.edu";
</SCRIPT>

<!-- Email Call Include                          -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide a hyperlink    -->
<!-- button to invoke e-mail.                    -->
<!--                                             -->
<!-- Two parms must be set, via Javascript,      -->
<!-- prior to the include for this module...     -->
<!--   RecipientDesc: name/desc of e-mail target -->
<!--   RecipientID:   e-mail ID of e-mail target -->


<SCRIPT LANGUAGE="JavaScript">
//
// Append additional parms to query string of URL.
//  
function AppendURL(CurrentHref) {
  CurrentHref = CurrentHref
              + "&RecipientDesc=" + EncodeQuery(RecipientDesc)
              + "&RecipientID="   + RecipientID
              + "&TopicDesc="     + EncodeQuery(document.title);
  return CurrentHref;
  };
//
// Encode query string value. Space characters are translated
// to '+' and all other special characters are encoded.
//
function EncodeQuery(QueryValue) {
  var TempString   = QueryValue;
  var TempLen      = QueryValue.length
  var ResultString = "";
  while( TempString.indexOf(" ") != -1) {     
    var x = TempString.indexOf(" ");                              
    ResultString = ResultString + TempString.substring(0,x) + "+";  
    TempString  = TempString.substring(x+1,TempLen);
    TempLen     = TempString.length;
    };
  ResultString = ResultString + TempString;
  ResultString = escape(ResultString); 
  return ResultString;
  };
</SCRIPT>

<A HREF=https://www.bu.edu/link/bin/uiscgi_studentlink?applpath=mail1.pl
onClick='this.href=AppendURL(this.href)'>Help</A> |
<!-- Logoff Include                              -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide ability to go  -->
<!-- to logoff system.                           -->

<A HREF=http://www.bu.edu/link/bin/uiscgi_studentlink/logout>Logoff</A>
</TABLE>

<HR SIZE=4>

<TABLE>
<TR>
  <TH><FONT SIZE=-1>Class<BR>/Call
  <TH><FONT SIZE=-1>Title<BR>/Instructor
  <TH><FONT SIZE=-1>Open<BR>Seats
  <TH><FONT SIZE=-1>Type
  <TH><FONT SIZE=-1>Bld
  <TH><FONT SIZE=-1>Room
  <TH><FONT SIZE=-1>Day
  <TH><FONT SIZE=-1>Start
  <TH><FONT SIZE=-1>Stop
  <TH><FONT SIZE=-1>Notes


<TR ALIGN=center Valign= top>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman">CAS CS113
A2<BR>873834</FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman">C S II/intro
C<BR>Homer</FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman">  26</FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman">Lab</FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman"><A
HREF=http://www.bu.edu/link/bin/uiscgi_studentlink?applpath=bldg.pl&BldgCd=MCS
>MCS</A></FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman">B33</FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman">Thu</FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman"> 5:00PM
-</FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman">
6:00PM</FONT></TD>
  <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman"></FONT></TD></TR>
</TABLE>
<I><FONT SIZE=-1>* Asterisks indicate TelReg restricted</FONT></I>

<HR>

<FORM ACTION=https://www.bu.edu/link/bin/uiscgi_studentlink METHOD=POST
TARGET=_self>

<TABLE WIDTH=80% CELLPADDING=0>

<TR ALIGN=center VALIGN=top>

<TD> <IMG
SRC=https://www.bu.edu/link/web/prod/student/images/ball_pur.gif>

<TD ALIGN=left VALIGN=top> If you wish to see next portion of report,
    press <EM>More</EM> button.
<TD ALIGN=left> <INPUT TYPE=submit VALUE=MORE>

</TR>
</TABLE>

<INPUT TYPE=hidden NAME=applpath VALUE="univschr.pl">
<INPUT TYPE=hidden NAME=StartKey VALUE="FALL 99CASCS113 A3">
<INPUT TYPE=hidden NAME=MaxGetNbr VALUE="1">


</FORM>



<HR>

<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0>
<TR><TD ALIGN=right>
<!-- Go Back In Window Include                   -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide ability to go  -->
<!-- back to prior cached image. This is useful  -->
<!-- in navigating back to an entry form.        -->

<A HREF="javascript:history.back()">Back</A> |
<!-- Go to Menu Include                          -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide ability to go  -->
<!-- to the most recently displayed menu in the  -->
<!-- URL history queue by substring matching.    -->

<A
HREF=https://www.bu.edu/link/bin/uiscgi_studentlink?ModuleName=menu.pl>Menu</A>
|
<!-- Registrar's Office Email Include            -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide an e-mail      -->
<!-- link to the Registrar's Office.             -->
<!--                                             -->
<SCRIPT LANGUAGE="JavaScript">
//
// Set variables required for e-mail call.
//  
RecipientDesc = "Registrar's Office";
RecipientID   = "regstrar@bu.edu";
</SCRIPT>

<!-- Email Call Include                          -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide a hyperlink    -->
<!-- button to invoke e-mail.                    -->
<!--                                             -->
<!-- Two parms must be set, via Javascript,      -->
<!-- prior to the include for this module...     -->
<!--   RecipientDesc: name/desc of e-mail target -->
<!--   RecipientID:   e-mail ID of e-mail target -->


<SCRIPT LANGUAGE="JavaScript">
//
// Append additional parms to query string of URL.
//  
function AppendURL(CurrentHref) {
  CurrentHref = CurrentHref
              + "&RecipientDesc=" + EncodeQuery(RecipientDesc)
              + "&RecipientID="   + RecipientID
              + "&TopicDesc="     + EncodeQuery(document.title);
  return CurrentHref;
  };
//
// Encode query string value. Space characters are translated
// to '+' and all other special characters are encoded.
//
function EncodeQuery(QueryValue) {
  var TempString   = QueryValue;
  var TempLen      = QueryValue.length
  var ResultString = "";
  while( TempString.indexOf(" ") != -1) {     
    var x = TempString.indexOf(" ");                              
    ResultString = ResultString + TempString.substring(0,x) + "+";  
    TempString  = TempString.substring(x+1,TempLen);
    TempLen     = TempString.length;
    };
  ResultString = ResultString + TempString;
  ResultString = escape(ResultString); 
  return ResultString;
  };
</SCRIPT>

<A HREF=https://www.bu.edu/link/bin/uiscgi_studentlink?applpath=mail1.pl
onClick='this.href=AppendURL(this.href)'>Help</A> |
<!-- Logoff Include                              -->
<!--                                             -->
<!-- This HTML code fragment is INCLUDED in      -->
<!-- any HTML template to provide ability to go  -->
<!-- to logoff system.                           -->

<A HREF=http://www.bu.edu/link/bin/uiscgi_studentlink/logout>Logoff</A>
</TABLE>

</BODY>
</HTML>


------------------------------

Date: Fri, 02 Apr 1999 00:03:36 -0500
From: Ketan Patel <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
Subject: RegEx question
Message-Id: <37044FA8.5D481D8B@BLAHNOSPAMBLAHxwebdesign.com>

I get a file similar to the one at the bottom of the message after
doing:

my $response = $ua->request($request);
my $string = $response->as_string;
print $string;

Now, from $string I would like to get the values that are on the lines
similar to:

<TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman"><*****value is
here*****></FONT></TD>

There are 10 lines that match that format, and I'd like to get the
values that are in them... How would I do that on one long string?  How
could I narrow it down to just the values inside the HTML tags?

Thanks in advance for any help you can provide!


------------------------------

Date: Thu, 01 Apr 1999 21:35:55 -0500
From: Ketan Patel <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
Subject: Re: Retrieving  info after POSTing from a perl script
Message-Id: <37042D0B.76B5439F@BLAHNOSPAMBLAHxwebdesign.com>

I've been fiddling around with this code, but I keep getting an error:

Code:
-----
#!/usr/local/bin/perl5

use LWP::UserAgent;

my $next_url = "";
my $ua = LWP::UserAgent->new;
my $response = $ua->request(POST
"http://www.bu.edu/link/bin/uiscgi_studentlink",
   [Semester => 'FALL 99',
    CollegeCd => 'CAS',
    Dept => 'CS',
    Course => '113 ',
    Section => 'A2',
    MaxGetNbr => '1',
    StartKey => 'FALL 99CASCS113 A2',
    applpath => 'univschr.pl']);

if ($response->code == 302) {  # expected on first request
   $next_url = $response->header("Location");
}
while ($next_url) {
   $response = $ua->request(GET $next_url);
   print $response->as_string;
   # Process page
   # set "$next_url" to a URL if there are more pages, else ""
}


Error Message:
--------------
% perl5 post.cgi
String found where operator expected at post.cgi line 7, near "POST
"http://www.bu.edu/link/bin/uiscgi_studentlink""
        (Do you need to predeclare POST?)
syntax error at post.cgi line 7, near "POST
"http://www.bu.edu/link/bin/uiscgi_studentlink""
Execution of post.cgi aborted due to compilation errors.

Any ideas what the problem could be??

Thanks for the help!


------------------------------

Date: Fri, 02 Apr 1999 02:33:11 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Retrieving  info after POSTing from a perl script
Message-Id: <7e1a83$pjj$1@birch.prod.itd.earthlink.net>

Ketan Patel <ketanp@BLAHNOSPAMBLAHxwebdesign.com> wrote:
$>I've been fiddling around with this code, but I keep getting an error:
$>

[ snippizola ]

There is a great example of sending a POST request in the lwp doc. Check it 
out.

Bob Trieger
sowmaster@juicepigs.com       



------------------------------

Date: Thu, 01 Apr 1999 19:32:12 -0800
From: Greg McCann <gregm@well.com>
To: Ketan Patel <ketanp@xwebdesign.com>
Subject: Re: Retrieving  info after POSTing from a perl script
Message-Id: <37043A3C.813F3C7F@well.com>

I got it...

(based on Ketan's code + examples in the PM Resource Kit)

I don't understand though, how StartKey gets set.  On the form page it
is blank, but then on the results page it has a value.

Greg

#!/usr/local/bin/perl5

use LWP::UserAgent;

my $next_url = "";
my $ua = LWP::UserAgent->new;

$ua->agent('Mozilla/4.0');  # they require NetScape 2.0 or higher

my $request = new HTTP::Request 'POST',
'http://www.bu.edu/link/bin/uiscgi_studentlink';

$request->content_type('application/x-www-form-urlencoded');
$request->content('Semester=FALL+99&CollegeCd=CAS&Dept=CS&Course=113&Section=A2&MaxGetNbr=25&StartKey=FALL+99CASCS113+A2&applpath=univschr.pl');

my $response = $ua->request($request);
print $response->as_string;

Ketan Patel wrote:
> 
> I've been fiddling around with this code, but I keep getting an error:
> 
> Code:
> -----
> #!/usr/local/bin/perl5
> 
> use LWP::UserAgent;
> 
> my $next_url = "";
> my $ua = LWP::UserAgent->new;
> my $response = $ua->request(POST
> "http://www.bu.edu/link/bin/uiscgi_studentlink",
>    [Semester => 'FALL 99',
>     CollegeCd => 'CAS',
>     Dept => 'CS',
>     Course => '113 ',
>     Section => 'A2',
>     MaxGetNbr => '1',
>     StartKey => 'FALL 99CASCS113 A2',
>     applpath => 'univschr.pl']);
> 
> if ($response->code == 302) {  # expected on first request
>    $next_url = $response->header("Location");
> }
> while ($next_url) {
>    $response = $ua->request(GET $next_url);
>    print $response->as_string;
>    # Process page
>    # set "$next_url" to a URL if there are more pages, else ""
> }
> 
> Error Message:
> --------------
> % perl5 post.cgi
> String found where operator expected at post.cgi line 7, near "POST
> "http://www.bu.edu/link/bin/uiscgi_studentlink""
>         (Do you need to predeclare POST?)
> syntax error at post.cgi line 7, near "POST
> "http://www.bu.edu/link/bin/uiscgi_studentlink""
> Execution of post.cgi aborted due to compilation errors.
> 
> Any ideas what the problem could be??
> 
> Thanks for the help!

-- 

======================
Gregory McCann
http://www.calypteanna.com

"Be kind, for everyone you meet is fighting a great battle."  Saint
Philo of Alexandria


------------------------------

Date: Thu, 1 Apr 1999 21:20:13 -0600
From: "Jim" <syt@email*@sp\am|@|spa/m@*.com>
Subject: simple request/question
Message-Id: <7e1d1a$eb5$1@news3.infoave.net>

I'm pretty new to perl (gee, isnt it amazing how many posts in here start
out like that?).. and I need to do something that I cannot find any
reference to in the perl documentation.

It's fairly simple, all I want to do is add all the values between %7C and
%5E together from this string below

http://www.domain.com/script.cgi?calc=calc&case=pig%7C98.07%5E&cee2u=r+ix%7C
12.21%5E&board=22three95%7C12.21%5E&s_u_b_m_i_t=Calculate

I need to generically be able to add those numbers together without having
to specify a specific amount of numbers to add together or anything else.

Thanks for any help,
Jim / James Cole
If Replying by e-mail, use syt{at}email{dot}com




------------------------------

Date: 01 Apr 1999 22:36:34 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: dha@panix.com (David H. Adler)
Subject: Re: Sun Microsystems Sponsors Perl Mongers
Message-Id: <m34smzu20t.fsf@joshua.panix.com>

dha@panix.com (David H. Adler) writes:

> On 1 Apr 1999 05:33:47 GMT, brian d foy <comdog@computerdog.com> wrote:
> >SUN MICROSYSTEMS SPONSORS PERL MONGERS
> [snip]
> 
> >David Adler, Ruthless Dictator of NY.class and a director of
> 
> That's "Ruthless *Godless* Dictator", dammit!

Ah, but *who*, exactly, will damn it?

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


------------------------------

Date: 2 Apr 1999 00:47:00 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: Sun Microsystems Sponsors Perl Mongers
Message-Id: <slrn7g8mej.o28.dha@panix.com>

On 01 Apr 1999 22:36:34 -0500, Jonathan Feinberg <jdf@pobox.com> wrote:
>dha@panix.com (David H. Adler) writes:
>
>> On 1 Apr 1999 05:33:47 GMT, brian d foy <comdog@computerdog.com> wrote:
>> >SUN MICROSYSTEMS SPONSORS PERL MONGERS
>> [snip]
>> 
>> >David Adler, Ruthless Dictator of NY.class and a director of
>> 
>> That's "Ruthless *Godless* Dictator", dammit!
>
>Ah, but *who*, exactly, will damn it?

I was wondering who was going to pick up on that... :-)

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"I was under medication when I made the decision not to burn the
tapes." - President Richard Nixon


------------------------------

Date: 2 Apr 1999 03:01:30 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Timing a download
Message-Id: <slrn7g8cls.ha.efflandt@efflandt.xnet.com>

On Wed, 31 Mar 1999 14:54:16 -0600, Justis <justisd@mnl.com> wrote:
>Hello,
>
>I am wondering how to go about capturing the amount of time it takes to
>download a certain file from a web browser.  I would like to be able to
>run a script that would start when a download link is selected from the
>browser, send the requested file to the client, then time this
>transaction.

Although, you can time how long it takes to send a file from a perl
script, this will not tell you how long it actually takes to download it,
since the server is usually buffered and you probably have no idea what
size the buffer is or how much of it is in use at the time.  So small
files may appear to go instantly and multi-meg files will pace out until
the buffer can handle the remainder.  At any rate it would not be very
precise.

As an example, when I upload a file in ncftp, it sometimes reports
transfer rates over a meg/sec which I know is impossible on a modem with a
26.4K tx rate.  But something in the system (Linux) is buffering the data 
transfer.

-- 
David Efflandt    efflandt@xnet.com
http://www.xnet.com/~efflandt/


------------------------------

Date: Fri, 02 Apr 1999 03:35:34 GMT
From: craig@vitter.com (Craig Vitter)
Subject: Washington DC Area Job in E-Commerce
Message-Id: <7e1ach$j47@dfw-ixnews3.ix.netcom.com>

Hey, somebody asked me today where we could find some experienced coders for 
our e-commerce development group and I thought... hey, we need another Perl 
person on board so here it goes, my lame attempt at writing an employment 
screening test...

#!/usr/bin/perl

$your_points = 0;
$extra_credit = 0;
open(FILE, "you.db") || die "A very bad sign, maybe you should try again.\n";
while(<FILE>) {
        $record = $_;
        chomp($record);

        ($experience, $attitude, $languages, $databases, $ecom_packages)
        = split(/\t/, $record);

        if($experience =~ /web/i && $experience =~ /ecommerce/) {
                $your_points++;
        }       
        if($attitude =~ /fun/i && $attitude =~ /workaholic/) {
                $your_points++;
        }
        if($languages =~ /java/i || $languages =~ /c/ || $languages =~         
        /javascript/) {
                $your_points++;
        }
        if($languages =~ /icl/i || $languages =~ /perl/) {
                $your_points++;
                $extra_credit++;                
        }
        if($languages !~ /sql/i || $languages !~ /html/i) {
                $your_points = $your_points - 2;
        }
        if($databases =~ /oracle/i) {
                $your_points++;
                $extra_credit++;
        }
        if($databases =~ /sybase/i || $databases =~ /sqlserver/i) {
                $your_points++;
        }
        if($ecom_packages =~ /iCat/i || $ecom_packages =~ /siteserver/i ||     
            $ecom_packages =~ /intershop/i ||                                 
            $ecom_packages =~ /opensite/i) {
                $your_points++;
                $extra_credit++;
        }
}
close(FILE);

$total_points = $your_points + $extra_credit ;

if($total_points == 10) {
        print "Wow, and you need a job? Write me today -         
cvitter\@infomech.com\n";
}
elsif($total_points >= 5) {
        print "Pretty good, send your resume to cvitter\@infomech.com\n";
}
elsif($total_points < 5) {
        print "Thanks for playing!\n";
}

If you made it this far, InfoMech is an e-commerce firm developing online 
solutions in Opensite, iCat, SiteServer, Intershop and other packages for a 
wide variety of companies including Fortune 500's. We're small but growing 
quickly and we need more developers to keep up with the work that is pouring 
through the front door. If you are interested and the test was child's play, 
drop me a line at cvitter@infomech.com (if you send a resume make it plain 
ASCII please) or stop by and see us at IEC 99 in New York at the end of the 
month.

take it easy, and thanks for playing,
Craig


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5282
**************************************

home help back first fref pref prev next nref lref last post