[21910] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4114 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 13 14:07:13 2002

Date: Wed, 13 Nov 2002 11:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 13 Nov 2002     Volume: 10 Number: 4114

Today's topics:
    Re: #!/usr/local/bin/perl <zzapper@ntlworld.com>
    Re: #!/usr/local/bin/perl <robertbu@hotmail.com>
    Re: [Q] Getting started with perl programming? (Joseph Nicholas)
    Re: A vision for Parrot (Cameron Laird)
    Re: A vision for Parrot (Cameron Laird)
    Re: A vision for Parrot <donal.k.fellows@man.ac.uk>
    Re: A vision for Parrot <goldbb2@earthlink.net>
        ASPN: negative PIDs? edgue@web.de
        Babelfish Webservice Bug w/ SOAP::Lite (Ted Smith)
    Re: DBI, mysql, how do I get the results into an array  <spam@digitaltension.com>
    Re: DBI, mysql, how do I get the results into an array  ctcgag@hotmail.com
    Re: Find perl modules in perl script <usenet@dwall.fastmail.fm>
    Re: Getopt::Long - Process @_ in subroutine? <ekulis@apple.com>
    Re: Getopt::Long - Process @_ in subroutine? <goldbb2@earthlink.net>
    Re: Help the script doesn't work <dover@nortelnetworks.com>
        Help with a regular expression (Emil)
    Re: Help with https and lwp <eweintra@jhmi.edu>
        How to send variable to CGI from browser <g0khaasa@cdf.toronto.edu>
    Re: Investigating perl compilers. Any help appreciated! <pkrupa@redwood.rsc.raytheon.com>
    Re: Keyboard mapping <ian_chapman@junk.net>
    Re: Keyboard mapping (Tad McClellan)
        mailto with "arguments" -- OT on cplm (was: "Re: mailto <bik.mido@tiscalinet.it>
    Re: mailto with "arguments" -- OT on cplm (was: "Re: ma <flavell@mail.cern.ch>
    Re: menu ? <mail@eircom.net>
        Newbie: sendmail <anthony.heuveline@wanadoo.fr>
    Re: Newbie: sendmail <Graham.T.Wood@oracle.com>
    Re: randomizing results from a mysql database <simon.andrews@bbsrc.ac.uk>
    Re: SAMIE module and frame (Henry Wasserman)
    Re: Simple question - What is unicode? <goldbb2@earthlink.net>
    Re: Socket client/server example not working on Windows <troc@netrus.net>
    Re: some help with a print statement requested - double <family2@aracnet.com>
    Re: UTF8 counting first octet hi bits <ekulis@apple.com>
    Re: Windows and nonblocking IO <goldbb2@earthlink.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 13 Nov 2002 15:41:41 +0000
From: zzapper <zzapper@ntlworld.com>
Subject: Re: #!/usr/local/bin/perl
Message-Id: <mhs4tugebma4vggr8rurur3dk0m5qarhh3@4ax.com>

On Fri, 08 Nov 2002 16:06:39 GMT, helgi@decode.is (Helgi Briem) wrote:

>On Fri, 8 Nov 2002 09:49:14 -0600, "Jerry Preston"
><g-preston1@ti.com> wrote:
>
>>Hi!,
>>
>>Is it passable to have a script look at two different startup 
>>lines in ascript:
>
>It is certainly passable, but is it possible?
>
>>#!/usr/local/bin/perl
>>#!/usr/bin/perl
>>
>>I have 20 servers with to many different locations for perl?
>
>Have a look at perldoc perlrun.
>
>You can trick it by using #!/usr/bin/env perl 
>
>A better way is to make a link from /usr/bin/perl and
>/usr/local/bin/perl to the real one on all the machines.
Hi has anyone got a win32 solution for this?

Activestate Perl & Apache 1.3.24 WinXP-Prof

zzapper

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://vim.sourceforge.net/tip_view.php?tip_id=305 "Best of Vim Tips"


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

Date: Wed, 13 Nov 2002 16:55:00 GMT
From: "robertbu" <robertbu@hotmail.com>
Subject: Re: #!/usr/local/bin/perl
Message-Id: <EtvA9.10807$6Z.10705@nwrddc01.gnilink.net>

> >>
> >>Is it passable to have a script look at two different startup
> >>lines in ascript:
> >
> >>#!/usr/local/bin/perl
> >>#!/usr/bin/perl
> >>
> >>I have 20 servers with to many different locations for perl?
> >

> Hi has anyone got a win32 solution for this?

No clean way I can think of, but a few hacks:
1) create a uniform share on the local machines
to the perl bin directory, and use the share in
the #! statement.
2) remove the lines and place perl.exe on the path
3) write an .exe that processes the file before passing it
(or a copy) off to perl, and then change the file
association for .pl

== Rob ==




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

Date: 13 Nov 2002 09:27:21 -0800
From: jnichola@itd.state.id.us (Joseph Nicholas)
Subject: Re: [Q] Getting started with perl programming?
Message-Id: <36d139b9.0211130927.6087e324@posting.google.com>

NOSPAMmdknight@pacific.net.sg (Sir Loin of Beef) wrote in message news:<3dd24088.10934131@news.pacific.net.sg>...
> Bernard
> >Don't you think that depends on what you want to do? After all,
> >modules are designed with specific tasks in mind. Having said that,
> >since you're just starting out you probably won't need any modules
> >other than the standard ones which came with your distro of Perl.
> 
> Well, I was thinking, do I need a web server or anything like that?

Sir Loin,

You do not need a web server to run perl programs.  You need only the
perl interpreter and a text editor.

Perhaps you would get a better answer if you explain why you want to
write perl programs and what operating system you wish to use.

-joe


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

Date: Wed, 13 Nov 2002 14:53:49 -0000
From: claird@lairds.com (Cameron Laird)
Subject: Re: A vision for Parrot
Message-Id: <ut4prtnorjgq87@corp.supernews.com>

In article <3DD16F04.517E6720@earthlink.net>,
Benjamin Goldberg  <goldbb2@earthlink.net> wrote:
			.
			.
			.
>Hmm, is there a way of making tcl dump the tcl-bytecodes to a file?
			.
			.
			.
There are at least a couple, but neither is particularly
handy, at this point; most common is to install TclPro
Compiler and let it do the work.  The other is to rebuild
a standard source distribution with a debugging flag 
enabled, then set a run-time flag to report on byte-code
flow.  Neither is as inviting at the corresponding ability
in, for example, Python.

I hope I'm wrong about this, that there's an easier way, 
and that someone will correct me.
-- 

Cameron Laird <Cameron@Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://phaseit.net/claird/home.html


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

Date: Wed, 13 Nov 2002 15:03:58 -0000
From: claird@lairds.com (Cameron Laird)
Subject: Re: A vision for Parrot
Message-Id: <ut4qeu2pg9fpde@corp.supernews.com>

In article <3DD16F04.517E6720@earthlink.net>,
Benjamin Goldberg  <goldbb2@earthlink.net> wrote:
			.
			.
			.
>Thinking a bit more, particularly about how Tcl often needs to interpret
>strings at runtime, I realize that no non-trivial Tcl program can work
>without having a string-to-bytecode compiler.  Needless to say, this
			.
			.
			.
Tangential remark:  yes, in the sense that Tcl is just
a big 'ole macro processor, where everything is a string.
Sure, at that level, Tcl is constantly interpreting strings,
in a way that seems creepy from a Perl perspective.  Perl's
executable references correspond in Tcl to "scripts" (most
often) which appear as callbacks to [after], [bind], 
[fileevent], and so on.

On the other hand, at the level of application development,
working programmers should *not* be doing much of the [eval]
kind of string interpretation that once was thought necessary
style in Tcl, as well as Lisp and very few other languages.
Source code should look straightforward and plenty
procedural, and, in general, will not "interpret strings" 
after a first round of bytecode compilation.
-- 

Cameron Laird <Cameron@Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://phaseit.net/claird/home.html


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

Date: Wed, 13 Nov 2002 16:35:51 +0000
From: "Donal K. Fellows" <donal.k.fellows@man.ac.uk>
Subject: Re: A vision for Parrot
Message-Id: <3DD27F67.AA0247FA@man.ac.uk>

Benjamin Goldberg wrote:
> Donal K. Fellows wrote:
>> OK, let's go for a more concrete question.  What sequence of bytecodes
>> would let me open a socket and talk to a remote host?  The Parrot I/O
>> operation opcodes don't mention anything about sockets and nor can I
>> tell how I would invoke a piece of helper C or C++ to do the job on my
>> behalf.
> 
> Just as there are "stdio", "unix", and "win32" ParrotIO layers, one
> would define a "socket" layer (and maybe an "xti" layer, for the really
> adventurous).  Obviously, this needs a bit more C code to be added.
> 
> Once that layer is added, you could read from and write to sockets just
> like you would from files.

OK, what sequence of bytecodes would instantiate and invoke those layers?  The
expositions I've found online so far have been rather too dry for me to actually
see how such a thing could be done.

Donal (fed up of hand-waving, particularly in his day job.  Must write code...)
-- 
"Windows is a car with square wheels (architecture) and a huge engine (hype,
 etc.), capable of of making the car move despite the square wheels.  Linux
 is a car with round wheels but a small engine, capable of making the car go
 despite the small engine."                  -- John Latham <jtl@cs.man.ac.uk>


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

Date: Wed, 13 Nov 2002 13:57:38 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: A vision for Parrot
Message-Id: <3DD2A0A2.CB933D95@earthlink.net>

Donal K. Fellows wrote:
> 
> Benjamin Goldberg wrote:
[snip Q: How to do sockets]
> > Just as there are "stdio", "unix", and "win32" ParrotIO layers, one
> > would define a "socket" layer (and maybe an "xti" layer, for the
> > really adventurous).  Obviously, this needs a bit more C code to be
> > added.
> >
> > Once that layer is added, you could read from and write to sockets
> > just like you would from files.
> 
> OK, what sequence of bytecodes would instantiate and invoke those
> layers?  The expositions I've found online so far have been rather too
> dry for me to actually see how such a thing could be done.

Umm, err, I don't know... I've merely looked (briefly) at the docs and
source of Parrot, and never programmed for it.  But <handwave>I'm sure
that it *can* be done</handwave>.

> Donal (fed up of hand-waving, particularly in his day job.  Must write
> code...)

Sorry about the handwaving, but it's the best I can offer.  If it can't
be done now, someone will add it in the future.

> "Windows is a car with square wheels (architecture) and a huge engine
> (hype, etc.), capable of of making the car move despite the square
> wheels.  Linux is a car with round wheels but a small engine, capable
> of making the car go despite the small engine."
>                                      -- John Latham <jtl@cs.man.ac.uk>

I would say that Linux has an equally big engine, but a manual
transmission, which discourages folks who are used to automatic.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Wed, 13 Nov 2002 15:59:04 +0100
From: edgue@web.de
Subject: ASPN: negative PIDs?
Message-Id: <3DD268B8.8020709@web.de>

Hi folks,

just to make sure I get it right:
when fork()ing with ActivePerl on W2K, the
$PID of the child process is always negative; like -2100.

I guess: that is because it is not a true fork but an
emulated one? Correct?

regards,
eg



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

Date: 13 Nov 2002 10:57:15 -0800
From: bluearchtop@my-deja.com (Ted Smith)
Subject: Babelfish Webservice Bug w/ SOAP::Lite
Message-Id: <9d2caaf1.0211131057.878c512@posting.google.com>

I started getting XML parser errors when translating using the
Babelfish webservice w/ SOAP::Lite. I noticed this on the Babelfish
XMETHODS page:

BUGS

Currently, the service has trouble with some special
characters, such as those with umlauts, for the input
string.  For PERL client implementations that rely on
XML::Parser, this bug also will affect the parsing of
return strings.


My code is pretty straight forward:

my $result = SOAP::Lite
     -> uri('http://www.xmethods.net/xmethodsBabelFish')
     -> proxy('http://services.xmethods.net:80/perl/soaplite.cgi')
     -> encoding('ISO-8859-1')
     -> BabelFish($req->param('translate'),$string)
     -> result;


Is there anything that can be done for a workaround for this bug?


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

Date: Wed, 13 Nov 2002 08:33:40 -0800
From: "Brandon L" <spam@digitaltension.com>
Subject: Re: DBI, mysql, how do I get the results into an array without
Message-Id: <ut4vnqp6n89833@corp.supernews.com>

all i want out of this is if i am looking up "dsl" type customer callbacks,
I want an array with

array[0] =
name|phone|address|username
array[1] =
name|phone|address|username
etc, etc

then when i have my array, and each key has one line or entry, i say foreach
$key (@array) ($name, $phon, blah) = split(/\|/, $key) then i print my table
with the values.

and it all WORKS and does what i want, it just prints this error in the web
server logs for some reason, even though it spits out the correct results.

"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:vDmA9.9910$6Z.9364@nwrddc01.gnilink.net...
> Brandon L wrote:
> >> You are not using strict.  Ugh.
> > not using strict, well i am lazy and dont want to comment everything
> > out.
>
> Commenting out? All you have to do is to declare the variables, typically
> with "my".
> That shouldn't be too much to ask when it can save you A LOT of trouble.
>
> >> You are retrieving the results through a global variable, rather than
> >> as the return value of the subroutine.  Ugh Ugh.
> >
> > I never learned how to return values, LOL... some people would
> > probably be amazed some of my first code even worked, haha
> > can you give me a quickie?
>
> perldoc -f return
>
> sub foo {
>     # always returns "Hello World"
>     my $bar = "Hello World";
>     return $bar;
> }
> [...]
> >>>     @sqlArray = join ("|", @sqlArray);
> >>
> >> Ack.  Store scalars in scalars.
> > huh? en engles por favor? grassyass
>
> Did you check the man pages of the functions you are using (perldoc -f
> join)?
> The return value of join is a scalar (in case of join actually a string).
> You are assigning this scalar to an array.
> If you would have enabled warnings perl would have warned you about that.
>
> >>>     push(@sqlResults, "@sqlArray");
> >>
> >> double Ack.  why the quotes?
> > thought that was the proper syntax/format
>
> Why thought? Didn't you check the man page (perldoc -f push)?
> There it says
>         push ARRAY,LIST
>                 [...]
>
> What you are doing is first stringify the array, i.e. convert the array
into
> a string.
> And then because push expects a list this string will be converted into a
> one-element list.
> And then this one element will be pushed onto the array. I doubt this is
> what you want.
>
> jue
>
>




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

Date: 13 Nov 2002 17:29:33 GMT
From: ctcgag@hotmail.com
Subject: Re: DBI, mysql, how do I get the results into an array without
Message-Id: <20021113122933.372$YQ@newsreader.com>

"Brandon L" <spam@digitaltension.com> wrote:

[ re my complaint about using subroutines to wrap DBI methods. ]

> Ok, now through the generation of my page i make several sql queries, now
> why should i make a seperate connection each time,

You shouldn't make the connection each time, only have to make it once
and keep it.  (Although I see little point in making a subroutine to do
it, unless you put that subroutine in a module).  It's the query results
subroutines that I object to.  And not for no reason, either.

> plus its less coding.
> instead i just build my query as $query and then send this off to my
> subroutine, so it does the work

Well, not in this case, it doesn't work :)


> > > sub sqlQuery {
> > >   undef(@sqlResults);
> > >
> > >   $myQuery = "$_[0]";
> > >
> > >   $sth = $dbh->prepare($myQuery);
> > >   # Shouldnt this fix the fethrow_array failed without execution
> > >   error? $rv = $sth->execute or die "executing: ", $dbh->errstr;
> >
> > That depends on what is causing the error.  I bet you call sqlQuery
> > with a query of "Update blah" or "Insert blah" at some point.  The
> > execute succeeds, so there is no error to catch at this point.  On the
> > other hand, the query was not a select, so it doesn't set itself up for
> > future invokation of fetch.
>
> i call sqlQuery by creating my query like
>
> $query = qq~INSERT INTO database blah blah~; sqlQuery($query);

Right.  sqlQuery is only for select queries, not DML.  You have to
write a new subroutine for DML, or use the one DBI wrote for you:

$dbh->do($query) or die ;

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
                    Usenet Newsgroup Service


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

Date: Wed, 13 Nov 2002 17:07:40 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Find perl modules in perl script
Message-Id: <Xns92C57B5ECD6DFdkwwashere@216.168.3.30>

JZ <ibm_97@yahoo.com> wrote on 12 Nov 2002:

> How to find installed perl modules in system (Unix or Linux) by using Perl?

There are several solutions in this thread from a couple of years ago:
http://groups.google.com/groups?threadm=8vd4ec%24r56%241%40nnrp1.deja.com

-- 
David K. Wall - usenet@dwall.fastmail.fm
"Oook."


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

Date: Wed, 13 Nov 2002 09:25:10 -0800
From: Ed Kulis <ekulis@apple.com>
Subject: Re: Getopt::Long - Process @_ in subroutine?
Message-Id: <B9F7CAF6.4A67%ekulis@apple.com>

On 11/1/02 3:16 PM, in article
Pine.GSO.4.21.0211011512540.18151-100000@mtwhitney.nsc.com, "Steven Kuo"
<skuo@mtwhitney.nsc.com> wrote:

> On Fri, 1 Nov 2002, Ed Kulis wrote:
> 
>> Hi,
>> 
>> I'd like create perl script which reads options from a file.
>> 
>> The options would be like
>> 
>> -days_old 1.5 -mv_to_storage
>> 
>> I'd like have a top perl script that reads these options from the file and
>> then passes them to a subroutine where Getoptions would parse @_.
>> 
>> It seems from the Camel Book that Getoptions only operates on perl command
>> line options.
>> 
>> Now I can
>>     qx{script.pl -days_old 1.5 -mv_to_storage}
>> 
>> with the script name that calls another perl script but I'd like to just
>> have 1 script if I can.
>> 
>> Any suggestions?
>> 
>> -ed
> 
> 
> 
> 
> 
> Copy @_ to a local version of @ARGV within the subroutine:
> 
> 
> #! /usr/local/bin/perl
> use strict;
> use warnings;
> use Getopt::Long;
> 
> # args read from file (DATA)
> my @args = map { chomp; split; } <DATA>;
> 
> # pass args to subroutine
> marine(@args);
> 
> sub marine {
>   {
> my ($string, $number);
> local @ARGV = @_;
> GetOptions (
>    'string=s' => \$string,
>    'number=i' => \$number
> );
> 
> if ($string and $number) {
>    print "You gave me $string and $number\n";
> } else {
>    print "Incomplete specification\n";
> }
>   }
> }
> 
> __DATA__
> --string ONE
> --number 2
> 


local @ARGV !!! 
Yes, Of course, if it's syntactically symmetrical, Perl has it.

Thank you very much,

-ed



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

Date: Wed, 13 Nov 2002 14:04:23 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Getopt::Long - Process @_ in subroutine?
Message-Id: <3DD2A237.6FBA83AA@earthlink.net>

Steven Kuo wrote:
[snip]
> # args read from file (DATA)
> my @args = map { chomp; split; } <DATA>;

This doesn't allow you to have any embedded spaces in the arguments,
even if you try and quote those spaces.  I would suggest:

   use Text::Shellwords;
   my @args = shellwords(do { local $/; <DATA> });


-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Wed, 13 Nov 2002 10:19:33 -0600
From: "Bob Dover" <dover@nortelnetworks.com>
Subject: Re: Help the script doesn't work
Message-Id: <aqttud$op6$1@bcarh8ab.ca.nortel.com>

"Nick Richards" wrote ...
> This doesn't work I'm wanting to set the values of each element in
> $replace[1] to the value of temp can anyone help?

So, what does it do?  Define "doesn't work"...




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

Date: 13 Nov 2002 10:58:59 -0800
From: spiff_swipnet@hotmail.com (Emil)
Subject: Help with a regular expression
Message-Id: <7c7e06b6.0211131058.45ca0ab8@posting.google.com>

I've used the following line to replace all words between double
colons (::word::) with a <img>-tag.

$line =~ s!::(\S*)::!<img src=\"$1.gif\">!gi;

If $line was set to "hello bla bla ::smile::";

::smile:: will be changed to <img src="smile.gif">

Now to my problem, if $line consist of multiple ::smile:: written
together after each other (::smile::::smile::::smile::) it doesn't
work as I want it to do.

They all will be replaced with <img
src="smile::::smile::::smile.gif">, when I want it to be 3 img-tags
after each other, like this <img src="smile.gif"><img
src="smile.gif"><img src="smile.gif">

How do I fix this?


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

Date: Wed, 13 Nov 2002 13:12:10 -0500
From: ETAN WEINTRAUB <eweintra@jhmi.edu>
Subject: Re: Help with https and lwp
Message-Id: <Pine.GSO.4.44.0211131142450.12866-100000@pine>

Just some added info:
Running on Solaris 8
Perl 5.8.0
OpenSSL 0.9.6g
Convert-ASN1 0.15
MIME-Base64 2.12
URI 1.21
Digest-MD5 2.20
Digest-SHA1 2.01
libnet 1.12
Bundle-libnet 1.00
HTML-Parser 3.26
libwww-perl 5.65
Net_SSLeay.pm 1.20
IO-SocketSSL 0.81 (Can't go higher! IO-SocketSSL versions higher that
 .81 don't work properly with LDAPS)
Authen-SASL 2.02
perl-ldap 0.26
String-Random 0.198
Devel-Symdump 2.03
Crypt-TripleDES 0.24

Anyhelp would be MUCH appreciated...

On Wed, 13 Nov 2002, ETAN WEINTRAUB wrote:

> Nope, https:// does work at the site. Checked that before I even thought
> of posting here....
>
> On Wed, 13 Nov 2002, Bob Walton wrote:
>
> > ETAN WEINTRAUB wrote:
> >
> > ...
> > > It works if I use http:// instead of https://, however I need it to work
> > > with https://. When I switch it to https://, I get the following message:
> > >
> > > ----------------------------------------------------------------
> > > File: local.cshrc
> > > 500 (Internal Server Error) Can't connect to localhost:443 ()
> > > Client-Date: Tue, 12 Nov 2002 20:32:21 GMT
> > >
> > > ----------------------------------------------------------------
> > >
> > > Any ideas???
> >
> >
> > Does the https://... work at the site using your favorite web browser?
> > If not, then it is a web server problem, not a Perl problem.  Looks to
> > me like that is probably the case.
> >
> >
> > ...
> > > -Etan Weintraub
> >
> > ...
> > --
> > Bob Walton
> >
> >
>
>





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

Date: Wed, 13 Nov 2002 18:38:32 GMT
From: Asad <g0khaasa@cdf.toronto.edu>
Subject: How to send variable to CGI from browser
Message-Id: <Pine.LNX.4.30.0211131338170.1689-100000@b210-02.cdf>

How can I send a variable to a perl script. I know how to do that if I am
using a form, but what if I have a hyperlink as follows:

<a href="cgi-bin/fetchMovies.pl" target="content">Movies</a><br/>

and I want to send in a variable that holds lets say the string "movies".
How can I do that?




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

Date: Wed, 13 Nov 2002 17:52:13 +0000
From: "Peter A. Krupa" <pkrupa@redwood.rsc.raytheon.com>
Subject: Re: Investigating perl compilers. Any help appreciated!
Message-Id: <3DD2914D.53A8503D@redwood.rsc.raytheon.com>

I've used both perl2exe (http://www.indigostar.com/perl2exe.htm) and
perlapp
(http://aspn.activestate.com/ASPN/Reference/Products/PDK/PerlApp/PerlApp.html),
which is included in ActiveState's PerlDev Kit.  Without tuning perl2exe
produces a 672K executable from a "Hello, world!" Perl script;  perlapp
produces a 424K executable from the same input.  But whereas PerlDev Kit
costs $195, perl2exe only costs $50 for a single user.  My management
decided to go with perlapp for no particular reason.  You don't get a lot
extra for the price difference.



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

Date: Wed, 13 Nov 2002 10:46:06 -0500
From: Ian Chapman <ian_chapman@junk.net>
Subject: Re: Keyboard mapping
Message-Id: <3DD273BE.22438CF6@junk.net>

Martien Verbruggen wrote:

> You could consider reporting this as a bug (use the perlbug tool) to
> the p5p. Make sure to include the versions of your djgpp environment
> as well. It might be an issue that people know about.

What is this tool? what is p5p?

> In DOS you should be able to use ctrl-Z. if that doesn't work, then I
> suspect there is something more fundamental wrong.

This I know

> Have you tried getting the input from files? Have you tried (in bash)
> to do something like:

> That was okay

> $ perl myprogram <<EOF
> > line 1
> > line 2
> > EOF
>
> ? Does that work?

Not sure what you are asking of me to type?  Is this at the shell command lilne?

I've changed my perl call from #!/home/bin/perl -w to #!/home/bin/perl -wC and now
if I give CR <ctl Z> CR it does what <ctl D> was documented to do. I guess this
should be considered as a workround?

        Many thanks for your support.  Regards Ian.



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

Date: Wed, 13 Nov 2002 11:06:54 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Keyboard mapping
Message-Id: <slrnat51le.3n5.tadmc@magna.augustmail.com>

Ian Chapman <ian_chapman@junk.net> wrote:
> Martien Verbruggen wrote:
> 
>> You could consider reporting this as a bug (use the perlbug tool) to
>> the p5p. Make sure to include the versions of your djgpp environment
>> as well. It might be an issue that people know about.
> 
> What is this tool? 


It is a program used for reporting bugs that is installed along 
with perl itself.

You can view the program's documentation by typing:

   perldoc perlbug


> what is p5p?


The Perl 5 Porters, ie. the people that fix bugs internal to perl.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 13 Nov 2002 16:20:15 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: mailto with "arguments" -- OT on cplm (was: "Re: mailto: links, [...]")
Message-Id: <sbo4tu07viic5ohckkcjobndgthnpajh1o@4ax.com>

On Sun, 10 Nov 2002 21:31:59 +0100, "Alan J. Flavell"
<flavell@mail.cern.ch> wrote in comp.lang.perl.misc:

>> but at least as of
>> IE4.0+ a link like the following one should work reliably
>
>Not so reliably if the browser has been set up to use an external mail
>program (Tools->Internet Options->Programs->E-mail).

Are you sure? Did you try it? I've set up Eudora as an external client
and it's launched with no problems.

>> <a href="mailto:someone@somewhere.com?body=This is more or less what
>> you should write...">mail me</a>
>
>Uncoded spaces are _never_ allowed in URLs.  Not even if they give an
>impression of doing what you wanted in the browser setup which you
>happen to use.

I'm far from being an expert, but... I *think* that an URI/URL allows
unencoded spaces as of RFC2396; what I don't know is if they are
allowed within the mailto scheme.

The fact that *it has been reported* that a link like the one I
suggested above should work reliably and the fact that indeed it did
work reliably in at least one test I did (with one browser/email
client setup) *suggest* that spaces are allowed for this scheme.

Otherwise it is a nonstandard MSIE extension only, but then I wrote
"as of IE4.0+" above...


Michele
-- 
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth.  See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel on sci.math, thread "Why numbers?"


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

Date: Wed, 13 Nov 2002 17:04:32 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: mailto with "arguments" -- OT on cplm (was: "Re: mailto: links, [...]")
Message-Id: <Pine.LNX.4.40.0211131638380.32753-100000@lxplus072.cern.ch>

On Nov 13, Michele Dondi inscribed on the eternal scroll:

> Are you sure? Did you try it?

When I tried it, it launched the external client, yes, but the extra
stuff in the query string had no effect.  Sure, RFC2368 specifies this
usage, I can't deny that, but there are still practical issues with
it.

> I'm far from being an expert, but... I *think* that an URI/URL allows
> unencoded spaces as of RFC2396;

It would surely have been quicker, and less total effort for all
concerned, to call up the RFC in question, since you evidently have
one in mind, and read the relevant clause before composing your
followup:

 2.4.3. Excluded US-ASCII Characters
[...]
  The space character is excluded because [...]

> what I don't know is if they are allowed within the mailto scheme.

I already knew that they are excluded for _any_ scheme; this cannot be
revoked by the definition for a specific scheme.

> The fact that *it has been reported* that a link like the one I
> suggested above should work reliably and the fact that indeed it did
> work reliably in at least one test I did (with one browser/email
> client setup) *suggest* that spaces are allowed for this scheme.

It *suggests* only that the client in question is tolerant (some might
say _too_ tolerant) of what, according to the RFC, is invalid syntax.

> Otherwise it is a nonstandard MSIE extension only, but then I wrote
> "as of IE4.0+" above...

But you said it "should" work, which implies more than merely giving a
practical impression of working due to an error fixup.  The RFC
certainly does not support the belief that it "should" work, although
it doesn't actually require client software to reject it. But surely
you can see that an error fixup is no substitute for genuinely
working?

all the best



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

Date: Wed, 13 Nov 2002 18:06:41 -0800
From: "Linux.ie" <mail@eircom.net>
Subject: Re: menu ?
Message-Id: <aqu0k5$dsd$1@dorito.esatclear.ie>

Thanks all.




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

Date: Wed, 13 Nov 2002 16:02:57 +0100
From: "Anthony" <anthony.heuveline@wanadoo.fr>
Subject: Newbie: sendmail
Message-Id: <aqtpj5$1nj$1@wanadoo.fr>

Hi,

    I have a perl program which uses sendmail and I would like to know how
to get detailed error messages when the sending process fails. For example,
how to get back the exit status with Perl with such a function:

sub send_mail {
    my($to, $from, $subject, @body)=@_;

    # Change this as necessary for your system
    my $sendmail="/usr/lib/sendmail -t -oi -odq";

    open(MAIL, "|$sendmail") || die "Can't start sendmail: $!";
    print MAIL<<END_OF_HEADER;
From: $from
To: $to
Subject: $subject

END_OF_HEADER
    foreach (@body) {
            print MAIL "$_\n";
    }
    close(MAIL);
}

Thank you in advance.

Anthony.




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

Date: Wed, 13 Nov 2002 15:52:55 +0000
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: Newbie: sendmail
Message-Id: <3DD27557.1E3308C8@oracle.com>

Anthony wrote:

> Hi,
>
>     I have a perl program which uses sendmail and I would like to know how
> to get detailed error messages when the sending process fails.

<snip>

>    open(MAIL, "|$sendmail") || die "Can't start sendmail: $!";

You can't directly get output from the process you opened for sending input to
unless you use IPC::Open2.

Your life might be simpler if you use the Mail::Sendmail module instead of
calling sendmail in the shell.  This would give you easy access to any error
messages. +Here is an extract from the docs for Mail::Sendmail:

use Mail::Sendmail;

  %mail = ( To      => 'you@there.com',
            From    => 'me@here.com',
            Message => "This is a very short message"
           );

  sendmail(%mail) or die $Mail::Sendmail::error;

  print "OK. Log says:\n", $Mail::Sendmail::log

Hope this helps

Graham.




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

Date: Wed, 13 Nov 2002 16:37:52 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: randomizing results from a mysql database
Message-Id: <3DD27FE0.487A9E72@bbsrc.ac.uk>

kramer wrote:
> 
> i have a people matching script which accesses a mysql database of
> elements and returns matches one at a time based on some parameter
> ranges (so the user gets a return match, clicks next, gets another,
> etc...).  what is the most efficient way to return those results
> randomly and minimize or eliminate repeating matches.

It depends on how many matches you are potentially choosing from, and
how many times you expect someone to ask for another one, also the
complexity of the select statements required to generate your list of
hits will be a factor.  

One approach would be to use an SQL statement which returned the primary
keys from the database for all valid matches into an array, then
randomly select one (perldoc -q "random element").  You then use a
separate query to get the required details and display them.  For future
requests you could maintain a list of previously viewed keys in a hidden
field on the returned page, and exclude those when selecting a new one.

There are many other ways to do this but this approach is fairly
straightforward and isn't obviously open to abuse.

Hope this helps

Simon.


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

Date: 13 Nov 2002 08:39:44 -0800
From: hwasserm@yahoo.com (Henry Wasserman)
Subject: Re: SAMIE module and frame
Message-Id: <570a1a21.0211130839.27478074@posting.google.com>

u8526505@ms27.hinet.net (derek chen) wrote in message news:<85789064.0211120308.25e8c649@posting.google.com>...
> Downloaded the module and played it a bit.quite cool! But I don't know
> how to use it to manipulate controls in frames.any tip? thanks.
> 
> Derek

I have just checked in a new SAM.pm that does frames automatically -
sort of.

There is a little setup here, but after getting it working you'll get
the feel for it and will be able to automate pages that contain
frames, without too much monkeying around.

The problem starts because Microsoft does not always reset the
ReadyState = 4 value when downloading on a page that contains frames.

When ReadyState remains at 4 the WaitForDocumentComplete function get
fooled into thinking that the page has completed downloading when it
actually has not.

This can cause your code to get off the track so to speak.

We have a work around for this problem.

WaitForDocumentComplete will take an optional parameter. The parameter
will change the WaitForDocumentComplete to count the number of frames
downloading instead of wait for ReadyState = 4.  You just add the
number of frames to the call like this for example:

WaitForDocumentComplete(4);

How do you know how many frames are coming in?  You have to set the
WaitForDocumentComplete() function to wait for a large number of
frames first, like so...

WaitForDocumentComplete(100);

Now you need a debug statement to display the DOM URLS so you can
count them.
Unstub the following comment in the Win32::SAM::Event subroutine
(found in SAM.pm)

#print "pushing arg " . $Args[0]->Document->URL . "\n";

After unstubbing this debug statement, you will be able to count the
number of frames coming into samie.  Now change your
WaitForDocumentComplete(100) blocking code to contain the proper
number of frames coming in...
maybe, WaitForDocumentComplete(4) for example and Walla, samie is back
on track.

Further...

Sometimes, in order to re-use the original frames samie found, later
in your code, you have to save them off in the %URLHash so samie won't
delete them on a new WaitForDocumentComplete call...

$URLHash{"http://myframe1.html"} = 1;
$URLHash{"http://myframe2.html"} = 1;

Now these frames will not get deleted when you do a new
WaitForDocumentComplete.

If you send me the URL you are trying to automate, I will send you
back a working example that uses WaitForDocumentComplete() with
frames.

Henry Wasserman


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

Date: Wed, 13 Nov 2002 13:46:23 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Simple question - What is unicode?
Message-Id: <3DD29DFF.22BD6241@earthlink.net>

Bart Lateur wrote:
> 
> pkent wrote:
> 
> >So rather than a literal ;left single
> >smart quote' you have to put '&#150;' or whatever in your XML.
> 
> That is not right. The numerical value you put in there should be the
> character's *Unicode* ordinal number. For a list for the Windows
> character set, see
> 
> http://www.unicode.org/Public/
>                        MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT
> 
> There you can see that the "left single smart quote" is hex 0x91, or
> decimal 145, in Windows (150 is the "ndash"); but hex 0x2018, decimal
> 8216 in Unicode. So the correct numerical entity would be "&#8216;".
> But you may use hex as well, with an "x" between the "#" and the
> digits: "&#x2018;"

If you include an appropriate DTD, you can write XML which is slightly
more legible to a human looking at it, through the use of named
entities, such as &lsquo;, &rsquo;, &ldquo;, and &rdquo;.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Wed, 13 Nov 2002 16:06:47 -0000
From: Rocco Caputo <troc@netrus.net>
Subject: Re: Socket client/server example not working on Windows 2K
Message-Id: <slrnat4u4k.8ma.troc@eyrie.homenet>

On 12 Nov 2002 11:23:27 -0800, John Ramsden wrote:
> I prepared a short pair of prototype socket client-server
> programs, planning to expand them into what is required
> for a project I am engaged on at work.
> 
> On Unix (SunOS) everything works fine with one or more clients
> each with a TCP socket connection to the server at once, which
> is the intention.
> 
> On Windows 2K (using ActiveState Perl v5.6.1 build 631,
> MSWin32-x86-multi-thread) the pair work fine with a single
> client; but if _two_ clients are started then the server
> displays all output from the first client immediately, 
> but buffers all output for the second client (and only
> displays this when the first client disconnects).

Unless this is an exercise to learn BSD sockets, consider using
IO::Socket::INET to build them rather than the low-level calls.

What status messages does the server print when the second client
connects?  Tracing through them might help determine the problem.

If fork() is misbehaving under MSWin32-- and it may be, because fork()
is implemented with threads on that platform-- consider using
IO::Select to multiplex the connections in a single process.

IO::Socket::INET and IO::Select are standard modules that come with
Perl.

-- Rocco Caputo - troc@pobox.com - http://poe.perl.org/


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

Date: Wed, 13 Nov 2002 07:21:42 -0600
From: Abernathey Family <family2@aracnet.com>
Subject: Re: some help with a print statement requested - double quotes giving    me trouble!
Message-Id: <3DD251E6.683BA627@aracnet.com>

Philip Lees wrote:
> 
> On Tue, 12 Nov 2002 11:59:32 -0800, Paul Spitalny
> <no_spam@no_spam.com> wrote:
> 
> >Hi,
> >I am trying to print a line and I want quotation marks in the output
> >line. The exact output line I want to print, to the output file, is:
> >
> >       .options probefilename="output.dat"
> >
> >I tried to print the line using the following perl code:
> >
> >       print TEMP ".options probefilename="output.dat"\n";
> >
> >But,this does not work.
> >
--snip--

I believe you can escape the double-quotes you want printed, like:

print TEMP ".options probefilename=\"output.dat\"\n";


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

Date: Wed, 13 Nov 2002 09:20:24 -0800
From: Ed Kulis <ekulis@apple.com>
Subject: Re: UTF8 counting first octet hi bits
Message-Id: <B9F7C9D8.4A63%ekulis@apple.com>

On 11/12/02 7:48 PM, in article 1YjA9.13283$TL6.10002@nwrddc02.gnilink.net,
"Jürgen Exner" <jurgenex@hotmail.com> wrote:

> Ed Kulis wrote:
>> I'm trying to decode UTF-8 so that I can protect various conversion
>> functions from characters that they can't deal with
> 
> Just an idea: what about asking Text::Iconv to do the conversion for you. If
> there are characters, which are not representable (like Japanese characters
> in let's say ISO-8859-1) then Iconv will fail with an error code.
> I don't quite see why you want to roll your own code.
> 
> jue

I haven't tried Text::Iconv yet all I know (and I may not know much) is that
Text::Iconv is an interface to Unix iconv.

I have tried iconv and in my hands it just fails to convert characters that
it doesn't know about like NO BREAK SPACE UTF8: 194.160 and when it does
fail it just fails with no indication where in the file or where in a record
that it fails. 

If you know of a working example of the use of Text::Iconv or of Unix iconv,
I'd appreciate a reference.

BUT:

The text conversion standard is not the problem.  The problem is that every
element in a "channel" that text moves through has it's own idea of good and
bad characters and it's own conversion mapping.

Take this channel

    Person
    ->Macintosh            # uses UTF8 for apple logo
    ->Vantive_CRM_Client   # makes up an illegal UTF 6 octet code for apple
    ->Oracle_UTF8_DB         # stores 6 octet string
    ->Vitra_Oracle_to_Oracle_messaging # won't process illegal char
    ->Oracle_ISO-8859-1      # couldn't store char even if it got it
    ->Unix_text              # 6 funny looking characters on screen
    ->VTIMS_Unix_to_Unix_messaging  # honest and transfers bits.
    ->EDI_B2B_messaging  # won't process chars; also doesn't like asterisks
    ->PC_Text_file       # uses different code for apple logo anyway
    ->PC_excel_spreadsheet  # who knows what it displays


So, the problem is that for every interface to a channel there will be
arbitrary character problems only some of which can be anticipated.

So what we need to to analyze the bits in the character at points in the
channel and then look up the bytes in a code in a set of tables that has the
set of bad bytes for each channel/recipient.  The data structure will
formalize what's done now and what's done now it to hack look up tables into
the code on an ad hoc basis to solve a problem.

With a data structure in a database when a problem arises it's not a
programming problem it's a data entry problem.

"Oh, Fry's PC's don't like the UTF8 Apple Logo?"
Open the config screen;
Look up Fry's channel;
Enter the codes that the extractor script will use to turn the UTF8 Apple
Logo into a PC Apple Logo before you send it.

Please let me know if there's an approach that I'm missing.

-ed

 




> 
> 



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

Date: Wed, 13 Nov 2002 13:32:00 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Windows and nonblocking IO
Message-Id: <3DD29AA0.9D8A1AE3@earthlink.net>

edgue@web.de wrote:
> 
> Benjamin Goldberg wrote:
> 
> > Does the program hang, or exit cleanly without printing anything?
> 
> The later one.
[snip]
>  > D:\test\perl\server>perl nonblocking_sockets.pl
> 
>  > D:\test\perl\server>

Ok, that's odd.  Add in some debugging statements, like "Created
socket", "Socket was set to nonblocking", "connect was initiated",
"about to perform select", "There are %d sockets in \@reachable",
"Checking socket $sock [port $port] for SO_ERROR", "Doing final call to
do_timeouts", "In print_results, there are %d ports in \@ports_reached",
"Doing final call to print_results".  (I think you can figure out where
these go).

> >>With Perl 5.8 it tells me "Couldn't set nonblocking:"
> >>right away.
> 
> > With nothing in $^E or $! ?  How strange.  Try changing the die
> > statement to:
> >   die sprintf "Couldn't set nonblocking:\n" .
> >              "\t\$! = %d %s\n\t\$^E = %d %s\n\t", $!, $!, $^E, $^E;
> 
> Result:
> 
> Couldn't set nonblocking:
>          $! = 0
>          $^E = 0
>           at nonblocking_sockets.pl line 29.

Hmm... For ioctl() to return undef, but not set errno, is a bug.

I would suggest you report it using perlbug.  (Give a *minimal* perl
script which shows this).

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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 V10 Issue 4114
***************************************


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