[13622] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1032 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 10 16:05:49 1999

Date: Sun, 10 Oct 1999 13:05:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939585922-v9-i1032@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 10 Oct 1999     Volume: 9 Number: 1032

Today's topics:
    Re: add value of hidden field in the search query <gellyfish@gellyfish.com>
    Re: calling a dll from perl <jtolley@bellatlantic.net>
    Re: Counter <jcreed@cyclone.jprc.com>
    Re: Debugger and "O LineInfo=..." (Ilya Zakharevich)
        Help with parsing input etexas@my-deja.com
    Re: Help with parsing input (Larry Rosler)
    Re: help! (one more time)... <uri@sysarch.com>
    Re: howto load modules to an ISP website? <flavell@mail.cern.ch>
        I need some Perl help <Mob-Rules@home.com>
    Re: I need some Perl help <rasmusr@online.no>
        IO::Select->has_exception() <SternSZ@gmx.de>
    Re: Is $$variable allowed like in PHP ? (Larry Rosler)
    Re: Parsing Config File (Chris Fairbanks)
    Re: Perl - login to http site <jtolley@bellatlantic.net>
    Re: Perl - login to http site <gellyfish@gellyfish.com>
    Re: Perl Doc.. <gellyfish@gellyfish.com>
    Re: Prob. with cgi-script (need help) <jtolley@bellatlantic.net>
    Re: Question? Writing to file <ICEMOUNTAIN@prodigy.net>
    Re: Receiving e-Mail Messages via Mail::POP3Client, wit (Sean Dowd)
    Re: Receiving e-Mail Messages via Mail::POP3Client, wit (Sean Dowd)
    Re: Shell and Perl have different $? (Ilya Zakharevich)
    Re: Splash screen <edo@tin.it>
    Re: trouble with hash (Mark P.)
    Re: Unique ID <gellyfish@gellyfish.com>
    Re: URLs and what they mean, was Re: Help! (Abigail)
        We do complex Perl Programming at very competetive rate <info@findcollege.com>
    Re: We do complex Perl Programming at very competetive  (Kragen Sitaker)
    Re: We do complex Perl Programming at very competetive  <uri@sysarch.com>
    Re: while (<MAYA>) read 1 line of 2 ? <ltl@rgsun40.viasystems.com>
        Why's 'mailx' complaining? <suaai@csv.warwick.ac.uk>
        Win 32 and PERL installation problems dedalus@pressroom.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 10 Oct 1999 18:51:28 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: add value of hidden field in the search query
Message-Id: <7tqn7g$63s$1@gellyfish.btinternet.com>

On Sun, 10 Oct 1999 17:29:29 +0200 Sven Schoppen wrote:
> hi!
> 
> i want to modifiy a cgi-script that i use as a small search engine.
> http://technotrade.com/cgi/search.html
> 
> to search in sub categories i want to define a hidden field in the
> search-mask. the value of the hidden field should be submitted
> in the search string.
> 
> for that i have to modifiy the cgi skript to read the value of the
> hidden field together with the words the people tipe in the search
> mask.
> 
> here is the part of the script where i think i have to make the
> modifications. please check als the original skript:
> http://technotrade.com/cgi/search.html
> 
<snip>
> i know there are better ways to write the read routine (with CGI.pm)
> but i am simple not able to make this modifications.
> i just want to use the routine and want to modify the skript so that it
> reads the value of the hidden field and the words in the search mask.
> 
> do you have suggestions?

I cant see any reason why this shouldnt work.  Hidden fields are presented
as parameters in just the same way as any other form field.  Of course
if you want to know about CGI you should ask in another newsgroup as
these things are not peculiar to Perl.

[followups set]

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 10 Oct 1999 18:45:36 GMT
From: James Tolley <jtolley@bellatlantic.net>
Subject: Re: calling a dll from perl
Message-Id: <3800DE70.1E0FF1CD@bellatlantic.net>

Win32::API

tlars@my-deja.com wrote:

> Does anyone know if it's possible to call a dll in the Win32 version of
> perl?  If so, could you please direct me to the module that allows you
> to do this.
>
> Thanks,
>
> Tait
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: 09 Oct 1999 13:00:38 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: Counter
Message-Id: <a1vh8gjwp5.fsf@cyclone.jprc.com>

abigail@delanet.com (Abigail) writes:

> Rainer Jung (rj@dungeon.inka.de) wrote on MMCCXXVIII September MCMXCIII
> in <URL:news:slrn7vp2po.8n.rj@coyo.dungeon.inka.de>:
> () +--[ Frank de Bot ]---[ debot@xs4all.nl ]
> () | Maybe if you write your messages in English we could all understand.
> () 
> () That's the problem, when someone posts in a german and an international 
> () Newsgroup, ..
> 
> And posting in English in an international group is different because
> of what exactly?

Maybe if you write your messages in Esperanto, we could all understand.

---Jason


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

Date: 10 Oct 1999 18:13:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debugger and "O LineInfo=..."
Message-Id: <7tqkvt$jf9$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Chris Fedde
<cfedde@fedde.littleton.co.us>],
who wrote in article <BVUL3.59$F3.172436480@news.frii.net>:
> Now if I start perl -d t.pl and set "O LineInfo=|catit" at the
> DB<1> prompt, then hit "n" and <enter> a few times /tmp/file will
> contain  something like the following
> 
>     t.pl:3:0
>     t.pl:4:0

Are you sure there are no control chars in this output?

> But if I "export PERLDB_OPTS="LineInfo=|catit" and redo the previous steps
> /tmp/file contains the following:
> 
>     main::(t.pl:1): print "one\n";
>     main::(t.pl:3): for (1..10) {

This looks like a difference in program-oriented output and
Human-oriented one.  Piping lineinfo switches to program-oriented
output.  Creating interactive prompt switches to human-oriented one.
Which one do you *want*?

[ Hmm, I checked and the proper answer happens to be RTFM! ]

This behaviour probably may be changed by an assignment to
$DB::emacs.  Make an alias if you need to do this often.

Do people want to have the style of the output settable from `O'?

Ilya


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

Date: Sat, 09 Oct 1999 17:03:33 GMT
From: etexas@my-deja.com
Subject: Help with parsing input
Message-Id: <7tnsgu$ka9$1@nnrp1.deja.com>

We need to be able to parse and read a pipe
delimited string response from another server and
take action based on two of the fields by either
logging the total response string to a flat file
DB or print an error message to screen.

The response looks like this:

34|hbhf76|755|hf7|||||||||565||33g|y

and the first two fields are the important ones.

We had the script working when resonse was in
<form input name/value pairs format, but how do
parse a delimited string only with no name value?

Below is our current code:
**************************
if ($form_data{'x_response_code'} eq "1")
  {
  $cart_id = $form_data{'x_cart_id'};
  $sc_cart_path =
"$sc_user_carts_directory_path/${cart_id}.cart";
  &logOrder;
  exit;
  }

elsif ($form_data{'x_response_code'} eq "2" ||
$form_data{'x_response_code'} eq "3")
  {
  $cart_id = $form_data{'x_cart_id'};
  $sc_cart_path =
"$sc_user_carts_directory_path/${cart_id}.cart";
  print "I'm sorry, an error has occurred. Please
<a
href=\"javascript:history.go(-3)\">return to the
orderform</a>, check
your data, and try again.";
  exit;
  }

else
  {
  &output_frontpage;
  exit;
  }
************************


Please help!!

Thanks in advance,

Robert Hughes
robert@etexas.net


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 10 Oct 1999 12:32:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help with parsing input
Message-Id: <MPG.126a899ff83d1fba98a068@nntp.hpl.hp.com>

In article <clUAOG3lgEeDfBXRx+4SUsHRwUyU@4ax.com> on Sun, 10 Oct 1999 
10:02:37 +0100, Dave Cross <dave@dave.org.uk> says...
> On Sat, 09 Oct 1999 17:03:33 GMT, etexas@my-deja.com wrote:

 ...

> >The response looks like this:
> >
> >34|hbhf76|755|hf7|||||||||565||33g|y
> >
> >and the first two fields are the important ones.

 ...

> You need the split function. Try somthing like this:
> 
> my $response = '34|hbhf76|755|hf7|||||||||565||33g|y';
> 
> my ($first, $second) = split([\|], $response);

I wouldn't try 'something like' that.  I would try 'something' that 
compiled without a syntax error.  If you want to use regex delimiters 
other than slashes, you must also use the 'm' operator.

Also, if only the first two fields are of interest, why split the entire 
string?

  my ($first, $second) = split /\|/, $response, 3;

 ...

> my @response = split([\|], $response);

And similarly for the regex.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 10 Oct 1999 15:10:00 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: help! (one more time)...
Message-Id: <x7k8ovm3qv.fsf@home.sysarch.com>


i appreciate your using proper quoting and posting decent answers but
could you edit your quotes some? i don't need or want to see the whole
orginal post and much below find the relevant parts of yur followup. a
common and prefered style is to leave only the important parts of the
quote and intersperse your comments between those sections. it makes for
an easier to follow train of thought. and with most newbie posts, only a
few lines are ever critical and most is verbose please help me and
unclear explanations of their problem.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Sun, 10 Oct 1999 19:07:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: howto load modules to an ISP website?
Message-Id: <Pine.HPP.3.95a.991010185703.7619F-100000@hpplus01.cern.ch>

On Sun, 10 Oct 1999, Dan Baker wrote:

> > That's a FAQ, isn't it?

> gee Abigail... if you KNOW its a fact, how about a little hint on where
> to find it rather than just make a comment that has no positive helpful
> content?!   What FAQ, and what topic maybe?

You lose.  It takes less time to type e.g

perldoc -q module

and scan the answers, amongst which is:

  =head2 How do I keep my own module/library directory?

beneath:

  =head1 Found in /usr/local/lib/perl5/5.00503/pod/perlfaq8.pod

than it does to post the original question.  And then when it's pointed
out, you still fail to use the available tools, as if you hadn't seen
these tools being pointed out dozens of times a day on this very group,
preferring to come back here whining.  You might want to think about the
fact that your postings will likely now be ignored by an even greater
proportion of the people who would be able to help you when you really
_do_ need it. 




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

Date: Sun, 10 Oct 1999 18:05:28 GMT
From: Mob-Rules <Mob-Rules@home.com>
Subject: I need some Perl help
Message-Id: <3800D57B.2847C103@home.com>

I have a list of names in a file and I need to know how many times each
name appears and what the name is but can't figure out how to do it in
Perl.
Can someone help?  Thanks




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

Date: Sun, 10 Oct 1999 22:01:29 +0100
From: "Rasmus Rimestad" <rasmusr@online.no>
Subject: Re: I need some Perl help
Message-Id: <8i6M3.3183$nU4.14843@news1.online.no>

Example:
@names = ("Jim","Per","Ole","Jim","Smith","Jon","Ole");

foreach $name (@names) {
    $countNames{$name}++;
}

foreach $name (keys(%countNames)) {
    print("$name occured $countNames{$name} time(s)\n");
}

Greetings from
   Rasmus Rimestad
   Bullshit Productions: http://bullshitprod.virtualave.net

Mob-Rules wrote in message <3800D57B.2847C103@home.com>...
>I have a list of names in a file and I need to know how many times each
>name appears and what the name is but can't figure out how to do it in
>Perl.
>Can someone help?  Thanks
>
>




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

Date: 10 Oct 1999 21:18:19 +0200
From: Benjamin Schweizer <SternSZ@gmx.de>
Subject: IO::Select->has_exception()
Message-Id: <m3d7undnyc.fsf@anthrax.local.net>

Hi there,

Iīve installed the latest Perl-release from the sources, but
IO::Select->has_exception() still not exists. As some people said that
5.005_3 would include this method I also grepīd the source tree. Has
anybody an idea? May be that this method is part of the CPAN?

My script crashes if the connection is cutted and I hope this function
can help me to handle an exception...



regards
  -Benjamin

-- 
              MICROSOFT (MSFT) announced today that the official
              release date for the new operating system "Windows 2000"
              will be delayed until the second quarter of 1901


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

Date: Sun, 10 Oct 1999 12:04:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Is $$variable allowed like in PHP ?
Message-Id: <MPG.126a830ecdc3f6c898a067@nntp.hpl.hp.com>

In article <krjpt7.11q.ln@magna.metronet.com> on Sun, 10 Oct 1999 
04:47:48 -0400, Tad McClellan <tadmc@metronet.com> says...
> Jonathan Stowe (gellyfish@gellyfish.com) wrote:
> : On Fri, 08 Oct 1999 11:59:20 -0700 David Cassell wrote:
> 
> : > <The Brain>
> : > Are you pondering what I'm pondering?
> : > </The Brain>
> : > 
> : > Can PHP be the cause of all these "I want to do $$name = value"
> : > questions that show up here?
> 
> : No I think its the inability of people to analyse the problem they are trying
> : to solve sufficiently.  I dont believe I have ever heard anyone who has
> : trained as a programmer ask this question.
> 
> : I think the question is why people want to do it in Perl and not in C,
> : COBOL or BCPL ?
> 
> 
>    The answer to that one is simple.
> 
>    Because those languages have such a high barrier to entry,
>    that there are very few folks who can get anywhere with
>    them unless they have trained as a programmer.

I disagree completely.

I think the answer is simply that symbolic referncing can be done in 
Perl, but not in the other languages you name.

Personal confession introduced as evidence:

In my very first Perl program (three years ago), which used hand-crafted 
CGI, it seemed very natural that the final line of the parameter-parsing 
loop be '$$name = $value;'.  After all, I had control over the contents 
of '$name', so nothing could go wrong, go wrong, go wrong...  (I also 
saw the symbolic reference as a model in one of the dumb books that I 
bought first and soon threw away.)

It took reading this newsgroup to show me the error of my ways, and why 
to replace that assignment by '$_{$name} = $value;' ( :-), and 
(concommitantly), why to 'use strict;'.  Even the Blue Camel has lots 
about Symbolic References and little about 'use strict;', or about 'use 
CGI;', for that matter.  I eventually gave in to 'use CGI;' when 
confronted with the need to do a file upload.

So for me the issue has nothing to do with programming training or 
experience -- I am a rather experienced programmer.  It has to do with 
the nature of the Perl language (the easy accessibility of the symbol 
tables); the nature of the programming models (most of which come from 
the script kiddies, remember); the nature of the books (the best of 
which focus on system-level programming more than application 
programming); and the fact that most Perl programmers don't subscribe 
here  :-).

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 10 Oct 1999 19:07:28 GMT
From: chrisf@removethis.winterlink.net (Chris Fairbanks)
Subject: Re: Parsing Config File
Message-Id: <3800e2b2.349181@news.wli.net>

Jonathan,

	Actually, I need this so I can split the Combined log file
right into the users home directory.  I'll redo it, so it does not
print out in the format, but uses the hash to split out the logs.
Currently I do this by having another file that contains virtual web
site and the home directory info.  But it is another step that is
needed to setup a site, so I want to eliminate it.  Thanks for the
help!

	-Chris


On 10 Oct 1999 12:11:25 -0000, Jonathan Stowe
<gellyfish@gellyfish.com> wrote:
>
>Well I dont think that what you want to is particularly useful in a general
>sense so I present here a quick way of getting all of the Directives and
>values for VirtualHost from an httpd.conf (I have deliberately ignored
>any <Directory> sections (and probably should for any other embedded sections
>but the httpd.conf I tested with didnt have any)):
>
>
>#!/usr/bin/perl -w
>
>use strict;
>
>
>my %virthosts;
>my $invirthost;
>my $currhost;
>my $skipit;
>
>while(<>)
>{
>  chomp;
>  if (/<VirtualHost\s+([^\s>]+)\s*>/)
>    {
>     $invirthost++;
>     $currhost = $1;
>    }
>  elsif ( m#</VirtualHost>#)
>    {
>      $invirthost = 0;
>    }
>  elsif ( $invirthost )
>    {
>      $skipit++,next if ( /<Directory/ );
>      $skipit = 0, next if (m#</Directory#);
>      next if ($skipit);  
>      s/^\s+//g;
>      my ($attr,$value) = split / /,$_,2;
>      $virthosts{$currhost}->{$attr} = $value;
>    }
>}
>
>my $host;
>foreach $host (keys %virthosts)
> {
>   print $host,":\n";
>   my $config;
>   foreach $config (keys %{$virthosts{$host}})
>     {
>       print "\t$config :\t $virthosts{$host}->{$config}\n";
>     }
>}
>
>Of course to do what you want you will want to replace the last foreach with:
>
>my $host;
>foreach $host (keys %virthosts)
>{
>  print $virthosts{$host}->{'ServerName'},':',
>        $virthosts{$host}->{DocumentRoot},"\n";
>}
>
>/J\



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

Date: Sun, 10 Oct 1999 17:46:11 GMT
From: James Tolley <jtolley@bellatlantic.net>
Subject: Re: Perl - login to http site
Message-Id: <3800D083.98A2E0B1@bellatlantic.net>

try the LWP modules:

LWP::UserAgent
HTTP::Request
HTTP::Response

works every time.

James



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

Date: 10 Oct 1999 18:33:45 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl - login to http site
Message-Id: <7tqm69$63o$1@gellyfish.btinternet.com>

On Sun, 10 Oct 1999 15:50:56 GMT merksperks@hotmail.com wrote:
> I am trying to find a way to log in automatically (via a script) to a
> web site that requires a login.  I am using Activestate Perl 5005 build
> 520.  I am not sure what the syntax would be.  If anyone can help I'd
> appreciate it.
> 

If you are using LWP::UserAgent (as you should be) then this is explained
in the lwpcook.pod documentation.  You should be able to access this by:

  perldoc lwpcook

at the command line.  It is remarkably simple - if you have any further
difficulty please post the smallest snippet of code that you find not to
work as a followup to this.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 10 Oct 1999 20:04:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl Doc..
Message-Id: <7tqrfg$649$1@gellyfish.btinternet.com>

On 8 Oct 1999 18:22:27 GMT Ilya Zakharevich wrote:
> [A complimentary Cc of this posting was sent to Martien Verbruggen
> <mgjv@comdyn.com.au>],
> who wrote in article <WAgL3.162$u83.8870@nsw.nnrp.telstra.net>:
>> > It's a secret. Part of the fun of learning Perl is to figure out which
>> > commands there are, and how they work. It would be silly to include 1200+
>> > pages of man pages, available as 'man perl'. That would be for wussies!
>> 
>> After all, the number of combinations of legal characters that could
>> make up a command is limited. Large, but limited. You could try them
>> all..
> 
> Unfortunately, one cannot find the limit without giving this
> secret-cabal 7-finger salute
> 
> 	  man perl
> 

I can't do that as seven convenient keystrokes because the little finger
on my right hand is useless/purely cosmetic. Could we have 'man bert'
instead ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 09 Oct 1999 17:09:03 GMT
From: James Tolley <jtolley@bellatlantic.net>
Subject: Re: Prob. with cgi-script (need help)
Message-Id: <37FF7644.20E6F2F7@bellatlantic.net>

Hi,

Premature end of script headers usually means that the Content-type header
is not being sent before the first blank line. When that happens, the
browser does not know what kind of a file it's receiving. It cannot rely on
the '.cgi' extention and assume it's html, because cgi scripts can output
any kind of data. So the browser chokes on the input..

Here's a script to test the entire response from the server, headers and
all. It should help you to figure out what's going wrong.

hth

James

###########################
###########################
#use strict;
$| = 1;
use IO::Socket;

print "usage: sock.pl <www.host.org/path/resource.ext>" and exit unless
@ARGV;

$ARGV[0] =~ /^(?:http:\/\/)?([^\/]+)\/?(.*)$/;

my $http_host = $1;
my $host = $http_host.":80";
my $resource = $2 || '';

print qq{Getting:
host:  $host
resource: /$resource
};

my $q = '';

my $socket = new IO::Socket::INET
    PeerAddr => $host;
    Proto  =>  'tcp',
    Type  => SOCK_STREAM;
die "no socket: $!" unless $socket;
my $request = qq{GET /$resource HTTP/1.1
host: $http_host

};
print $socket $request;
print qq{Here's the request:<<EOF;
$request};
print "EOF\n...and here's the response:\n\n";
print, $q = <STDIN> while (<$socket>); # pause after each line



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

Date: Sun, 10 Oct 1999 15:34:28 -0400
From: <ICEMOUNTAIN@prodigy.net>
Subject: Re: Question? Writing to file
Message-Id: <7tqprv$2pac$1@newssvr04-int.news.prodigy.com>

I fixed it after reading the perlfaq's and looking at another script.




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

Date: Sun, 10 Oct 1999 18:23:36 GMT
From: dowd@spam-free.home.com (Sean Dowd)
Subject: Re: Receiving e-Mail Messages via Mail::POP3Client, with MacPerl.
Message-Id: <dowd-1010991320200001@0.0.0.0>

In article <1dzch5f.1yzenb928za4iN@dialup0225-pri.voicenet.com>,
sleidy_keinSpam_@_bitte_voicencet.com (Samuel) wrote:

> I have written the followoing:

--- script deleted ---

> Results of running the above Code:
> 
> ----- Results starts here -----
> 
> Attempting Connection....
> State of Connection: DEAD
> 
> Connection is 'alive'!
> State of Connection: AUTHORIZATION
> 
> Number of Messages: -1
> Mailbox Size: -1
> Finished.
> 
> ----- Results ends here -----
>
> Question(s):
> I have many e-Mail Messages sitting on the Server - so why am I
> receiving a 'Number of Messages: -1 Reply?
> 
> Am I actually conversing with the Server at all?
> 
> What am I obviously missing from the above 'Source Code' to make it
> actually work?


Get version 2.2.  It fixes this problem for MacPerl (having to do with
extra CRs sitting on the socket connection, causing matches to fail).

It should be on CPAN soon.  If you can't wait, you can grab it from
http://www.dowds.net/POP3Client


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

Date: Sun, 10 Oct 1999 18:34:43 GMT
From: dowd@spam-free.home.com (Sean Dowd)
Subject: Re: Receiving e-Mail Messages via Mail::POP3Client, with MacPerl.
Message-Id: <dowd-1010991331270001@0.0.0.0>

In article <yzxL3.1761$N64.48858@dfw-read.news.verio.net>,
schinder@leprss.gsfc.nasa.gov wrote:

> Last time I looked, Mail::POP3Client wasn't platform portable.  There are
> end-of-line issues; the author doesn't seem to know that there's a difference
> between "\r\n" and "\015\012".
> 
> --
> Paul J. Schinder 
> NASA Goddard Space Flight Center 
> schinder@leprss.gsfc.nasa.gov 

Wow.  Slammed by someone at NASA about a conversion issue.  Now *that* hurts!


FYI: from perldoc perlfaq8:

end of line 

Some devices will be expecting a "\r" at the end of each line rather than
a "\n".  In some ports of perl, "\r" and "\n" are different from their
usual (Unix) ASCII values of "\012" and "\015".  You may have to give the
numeric values you want directly, using octal ("\015"), hex ("0x0D"), or
as a control-character specification ("\cM").

          print DEV "atv1\012";       # wrong, for some devices
          print DEV "atv1\015";       # right, for some devices

Even though with normal text files, a "\n" will do the trick, there is
still no unified scheme for terminating a line that is portable between
Unix, DOS/Win, and Macintosh, except to terminate ALL line ends with
"\015\012", and strip what you don't need from the output. This applies
especially to socket I/O and autoflushing, discussed next. 



POP3Client uses "\015\012" (which conforms with RFC1939), but you can
certainly change it by passing an EOL option to the ctor.

The problem referenced in the original post had to do with extra CRs on
the socket (and is fixed in 2.2), not "\015" vs "\r".


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

Date: 10 Oct 1999 18:18:40 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Shell and Perl have different $?
Message-Id: <7tqla0$jgh$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Philip 'Yes, that's my address' Newton
<nospam.newton@gmx.net>],
who wrote in article <38007e9e.70253337@news.nikoma.de>:
> >> $ia = system("rcp $file_to_copy user\@machine:/path/$file_remote");
> >> print "\$? = $?      \$ia = $ia \n";
> >
> >I think this is more or less equivalent to
> >
> >  (rcp file.x user@machine:/path/somedir/copy.x)
> >
> >Use multiarg-system() instead.
> 
> Does this imply that using multi-arg system puts rcp's exit status
> into $?, whereas single-arg system puts the shell's exit status into
> $? ?

Definitely.

> In that case, $? == 0 would (sort of) make sense for an rcp
> failure; after all, the shell itself exited successfully (or does it
> propage $? ?).

Shells do propagate simple things (when the lower byte is 0).  If the
lower byte of the kid exit status is non-0, shells have no way to
propagate *this* (unless they kill themselves with the same signal ;-).

Most shells use some funny convention for reporting such things, which
makes exits from programs in the range 128..255 somewhat unreliable.
This *is* discussed in the FM.

Ilya


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

Date: Sun, 10 Oct 1999 11:52:54 +0200
From: Edo <edo@tin.it>
Subject: Re: Splash screen
Message-Id: <mlnpt7.b8g.ln@scatolinux.it>

ItsMe9905 <itsme9905@aol.comnojunk> wrote:
> Edo,

> If by "visualize" you mean if you can have a Perl script write out an HTML page
> for you then the answer is yes.

I actually didn't mean that! (My English's betraying me <G>!)
I meant this:
I have a script, which doesn't have anything to do with html. When it is
launched, I'd like it to show this splash screen.
To give an example, think about programs like free agent on win or the
gimp on linux/unix: when they're launched, you see that kind of
"presentation screen", and that's what I'd like to have!

Thanks!
Edo


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

Date: Sun, 10 Oct 1999 18:57:51 GMT
From: mag@imchat.com (Mark P.)
Subject: Re: trouble with hash
Message-Id: <3800e0c1.48233355@news.ionet.net>

On 10 Oct 1999 13:51:34 GMT, mgjv@wobbie.heliotrope.home (Martien
Verbruggen) wrote:

>On Sun, 10 Oct 1999 01:07:51 -0700,
>	Larry Rosler <lr@hpl.hp.com> wrote:
>> In article <slrn8008dg.36a.mgjv@wobbie.heliotrope.home> on 10 Oct 1999 
>> 05:20:43 GMT, Martien Verbruggen <mgjv@wobbie.heliotrope.home> says...
>
>> > @new_answer = @$answer{$question};
>> > 
>> > This will work. ...
>> 
>> Well, no, it won't.  I know you know this; you just took your eye off 
>> the ball.  The answer he got, and which works, is:
>> 
>>   @new_answer = @{$answer{$question}};
>
>You are right. Thanks for the correction.
>
>That'll teach me to quickly finish posting while the 2 year old
>daughter is demanding play time :)
>

	Thanks for all the answers. I will take a look at the
documentation now. I've already fixed the problem, but theirs learning
to do. When I searched dejanews I came accross all kinds of references
to multiple arrays and hashes, but nothing I read included those
braces. 
Thanks again!!!                      | 



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

Date: 10 Oct 1999 18:27:35 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Unique ID
Message-Id: <7tqlqn$63l$1@gellyfish.btinternet.com>

On Sun, 10 Oct 1999 17:53:57 +0200 Joe wrote:
> Hi,
> 
> I need to be able to obtain a unique ID from within a program -any
> suggestions as how to do this in Perl?
> 

I would suggest searching <http://www.deja.com> as this question comes up
regularly but doesnt seem to have made the FAQ yet :

How unique, how long you want ?

$id = $$ . time;
print $id,"\n";
$id = "@{[rand(time)]}@{[rand($$)]}@{[time]}";
print $id,"\n";

etc etc ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 10 Oct 1999 14:37:26 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: URLs and what they mean, was Re: Help!
Message-Id: <slrn801qna.cs7.abigail@alexandra.delanet.com>

Alan J. Flavell (flavell@mail.cern.ch) wrote on MMCCXXXI September
MCMXCIII in <URL:news:Pine.HPP.3.95a.991010155458.7619B-100000@hpplus01.cern.ch>:
%% On 9 Oct 1999, Abigail wrote:
%% 
%% > The assumption that URLs point to files is false.
%% 
%% Certainly.  And the URLs 'anything' and 'anything/' _could_ point
%% to two totally different and unrelated resources.  In theory, anyhow.
%% It would seem perverse to do that in practice, other than as a means of
%% calling people's attention to the stealth-redirection issue.

It actually happens each time when you're using well-known servers
like Apache or the NCSA server and you alias a directory to another
directory. I've used this to have 'http://...../abigail' point
to something else than 'http://..../abigail/'.  Not sure if it
still the case, but 'http://www.perl.com/CPAN' was different from
'http://www.perl.com/CPAN/'. Didn't w3c have such tricks as well?

%% Don't you agree, even if you wanted it expressed differently?

Oh, yeah. I just wanted to point out that URL don't necessarely have
to map to files. In fact, http://192.168.1.1/foo/bar/baz seldomly points
to a file called /foo/bar/baz. Some mapping occurs somewhere.



Abigail
-- 
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sat, 9 Oct 1999 22:51:16 +0530
From: "Findcollege" <info@findcollege.com>
Subject: We do complex Perl Programming at very competetive rates
Message-Id: <7tp250$b0u$1@news.vsnl.net.in>

We do complex Perl Programming at very competetive rates ($20/hour).We have
offices in US and in India and as the developmet would be done in India we
give high quality perl programming at very low rates. Vist our company's
web-site at
www.enabling-information.com





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

Date: Sun, 10 Oct 1999 18:06:48 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: We do complex Perl Programming at very competetive rates
Message-Id: <YA4M3.2986$UG5.212215@typ11.nn.bcandid.com>

In article <7tp250$b0u$1@news.vsnl.net.in>,
Findcollege <info@findcollege.com> wrote:
>We do complex Perl Programming at very competetive rates ($20/hour).We have
>offices in US and in India and as the developmet would be done in India we
>give high quality perl programming at very low rates. Vist our company's
>web-site at
>www.enabling-information.com

I don't see any Perl code on your web site that would allow us to
critique your expertise.  I do see:

- links to sites that are supposedly "under construction" that don't
  yet exist;
- a link to www.findmatch.com, which evidently had its HTML written
  with "Microsoft Frontpage 3.0", suggesting you don't know HTML;
- stuff on your front page suggesting your HTML was written with
  Frontpage, again suggesting you don't know HTML;
- stuff on www.findmatch.com that talks about the "science of
  astrology", suggesting that you are scientifically illiterate;
- www.findmatch.com uses JavaScript for ordinary links, suggesting you
  don't know HTML;
- ironically, one of those links is about security, bragging about how
  secure your secure server is.  Said secure server appears to be
  running Stronghold 2.2, an ancient version of Stronghold with
  security holes, and has a site certificate that doesn't match the URL
  (indicating that the site is being spoofed, or is just very poorly
  set up).  (I'm assuming said secure server is on
  https://www.findmatch.com:443/.)
- Trying to "register" with the name "Kragen Sitaker" gives the error:
                Name Field should have a length of 4-35 Ch.
  So I couldn't give you an (incorrect) credit card number to verify
  that https://www.findmatch.com:443/ is indeed the secure server
  you're talking about.   However, the server to which I submitted my
  name, birthdate, age, height, weight, marital status, income,
  religion, culture, nationality, information about my desired partner
  and myself, and my mailing address, among other things, did not use
  an encrypted connection.  This suggests to me that you don't care
  much about your clients' privacy, or that you don't know much about
  security, either.  (Not surprising if you don't know much about HTML
  or science.)
- Your site has some, um, interesting insight about the nature of the
  Internet (http://www.enabling-information.com/inet_services.html):
   The Internet is not just boxes and wires. The Internet is a promise a
   wealth beyond the dreams of avarice.
  This suggests you don't know much about the Internet (or English,
  either, but that's forgivable -- even Americans, who typically use
  English almost exclusively during their childhoods, make similar
  mistakes).
- You have apparently progressed to Microsoft Frontpage 4.0 for your
  www.findcollege.com project.  I registered as a user so I could try
  you out.  I requested that you not send my username and password to
  me by email, for security reasons.  You did anyway.  This suggests you
  don't know much about software testing.
- Both of the web sites of yours I've looked at require registration to
  use.  This suggests you don't know much about the Web.
- You use POST forms for your "unique two speed (simple and advanced)
  search engine" on www.findcollege.com.  This suggests you don't know
  much about HTTP.
- on www.findcollege.com, you appear to be trying to enforce the
  registration system by using a 'hidden' form input called 'id'.  But
  your CGI scripts don't bother to check 'id' for a valid value.  Why
  don't you just let anybody use the search engine then?  This suggests
  you don't know much about Web security.

In short: you don't know much about HTML, HTTP, English, security, or
the Internet.  I doubt you know much about Perl.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sun Oct 10 1999
30 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 10 Oct 1999 15:15:59 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: We do complex Perl Programming at very competetive rates
Message-Id: <x7g0zjm3gw.fsf@home.sysarch.com>


:-)

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 10 Oct 1999 15:45:04 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: while (<MAYA>) read 1 line of 2 ?
Message-Id: <7tqca0$e75$1@rguxd.viasystems.com>

Vampiloup <vampiloup@crosswinds.net> wrote:
:>I verified : The file contain all the lines.

:>But if i read by this program :

:>*****************
:>while (<MAYA>){	#<<<--- Reads a line and puts it in $_
:>$var = <MAYA>;    #<<<--- Reads another line and puts in $var
:>print "$var\n";
:>print "<br>\n";
:>}
:>*******************

while (<MAYA>) {
	print $_, "\n<br>\n";
}

I'm overwhelmed and can't think of what to tell you to read.

Start by typing

perldoc perlop

and pay attention to the section on I/O operators, which happens
to be near the end of that document.

If you would prefer a tutorial in your native language, you may
be able to find a pointer to one if you search on
http://www.perl.com/.

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Sun, 10 Oct 1999 19:24:06 +0100
From: MTW <suaai@csv.warwick.ac.uk>
Subject: Why's 'mailx' complaining?
Message-Id: <Pine.GSO.4.10.9910101922270.28817-100000@mimosa.csv.warwick.ac.uk>

Hi - I'm about 72 hours into learning perl, and I've got quite far (for
me, anyhow :) but have come up against this brick wall:

I'm writing a simple mail rebroadcasting service for the members of my
society (see .sig :-)

I get a raw mail message flowing into my perl program, and parse the
header to find out the subject and originator (so that he/she doesn't get
a copy of the mail they sent out)

I can construct code such as

# parse header
 .
 .
# done

open(MAIL, "|mailx -s '$parsed_subject' -b '$personlist'");

# parse body:
while (<STDIN>) {
	print MAIL $_;
}
close(MAIL);

but then mailx complains that 'the arguments you specified are only used
for sending mail' or something like that. NB $personlist is a
space-delimited, correctly formatted (ie name\@host) string of people that
the message needs to go to - no problems there!

Doesn't the open(FILEHANDLE, "|program"); syntax keep the program open for
input via STDOUT/IN?

I've managed to get it working by writing the body of the mail message to
a file, then invoking a system("cat 'tempfile' | mailx -s '$subject' -b
'$personlist'"), but that uses a tempfile that needs cleaning up - and
anyway, it looks messy :-)

Am I missing something? Or is this not possible except via a 'cat file | .
 . .' command?

thanks in advance for any help!

jC

Music Theatre Warwick
write: c/o Music Centre, University of Warwick, Coventry CV4 7AL, England
mailto:mtw@warwick.ac.uk
http://www.warwick.ac.uk/society/mtw/




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

Date: Sat, 09 Oct 1999 15:07:50 +0000
From: dedalus@pressroom.com
Subject: Win 32 and PERL installation problems
Message-Id: <37FF5A46.89CA4F94@pressroom.com>

Hi, my name is Mike and I am having a tough time getting Perl to run on
my webserver. What I am running is Win 98 on a PIII with PWS 4.0  and
Cold Fusion 4.0 installed. I have also installed ActivePerl build 520,
and edited the registry by adding a .pl key under
HKLM/system/currentcontrolset/services/w3svc/parameters/scriptmap. This
key refers to [the current location of perl on my drive] %s %s, and this
should get the program to work through PWS. But what is happening is the
page times out after about 30 seconds and the following error is
generated in the PWS log:

10/8/99, 23:39:13, The script started from the URL '/SCRIPTS/hello.pl'
with parameters '' has not responded within the configured timeout
period.  The HTTP server is terminating the script. [0]


I've tried running the script with a ? after it, I've tried running it
through the DOS shell (where it works fine), and I've even tried
offering the computer money to get it to tell me what the problem is.
Now, after my PC has extorted piles of cash from my wallet and left me a
cold and hungry scripter with PERL not working as a web service, I turn
to you kind people in the hopes that someone, anyone can help me with
what should be a simple installation. Please, please help!

Michael Haggerty
dedalus@pressroom.com



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

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


Administrivia:

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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 1032
**************************************


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