[11981] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5581 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 6 12:10:52 1999

Date: Thu, 6 May 99 09:00:19 -0700
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, 6 May 1999     Volume: 8 Number: 5581

Today's topics:
        `Mother of Perl' Exhibition at the Clifford-Smith Galle <pas@unh.edu>
    Re: a tail of two hashes rjreilly@my-dejanews.com
        Emacs .info documentation for Perl? (Marek Rouchal)
    Re: Help using message boards (Andrea L. Spinelli)
    Re: HELP: Newbie in Need of Script <t-armbruster@ti.com>
    Re: how to round off numbers? <t-armbruster@ti.com>
    Re: how to round off numbers? <gellyfish@gellyfish.com>
    Re: how to round off numbers? <tchrist@mox.perl.com>
    Re: how to round off numbers? <tchrist@mox.perl.com>
    Re: Making executables from .pl files? <agjemmes@extremeonline.com>
    Re: Making executables from .pl files? ralawrence@my-dejanews.com
    Re: Ms Access database (Scott McMahan)
        perl embed <Philippe.Baduel@fth.net>
    Re: PerLDAP problems... michielpeene@my-dejanews.com
        perlfunc study - optimize input data for repeated searc <perlfaq-suggestions@perl.com>
    Re: procedure to convert sec to HH:MM:SS format (Juho Cederstrom)
    Re: processor time <t-armbruster@ti.com>
    Re: Q: checking defined/usable handles? <sf@tellux.de>
    Re: s///ge & $` <Allan@due.net>
    Re: syswrite() lies (Sam Holden)
    Re: Using LWP: getting the code for a website? <gellyfish@gellyfish.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 6 May 1999 15:07:48 GMT
From: Paul A Sand <pas@unh.edu>
Subject: `Mother of Perl' Exhibition at the Clifford-Smith Gallery, Boston
Message-Id: <7gsb84$jak$1@tabloid.unh.edu>

The Boston Globe reports today that an exhibition entitled `Mother of
Perl' is at the Clifford-Smith Gallery in Boston.  The artist is Regina
Frank, a German dressmaker and visiting faculty member at the
School of the Museum of Fine Arts. The exhibit is part of 
something called a `Cyberarts Festival', and (looks like) it
goes through May 15.

The Globe reports that the title is `a play on the name of a computer
programming language and the beads that oysters make' and that Ms
Frank `uses both in her work'. 

The article goes on to explain that

    Frank's dresses become a metaphor for the self and a costume for
    society. They reference oppression, but also tender undercurrents
    of the soul and a person's need to thrive and connect.

Unfortunately, there's a lack of detail about how she codes this.

The article is online at (all one line)
http://www.boston.com/dailyglobe2/126/living/Window_dressing_real_and_conceptual++.shtml

-- 
-- Paul A. Sand                 | I don't want the cheese,
-- University of New Hampshire  | I just want out of the trap.
-- pas@unh.edu                  |     (Spanish Proverb)
-- http://pubpages.unh.edu/~pas | 


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

Date: Thu, 06 May 1999 15:32:17 GMT
From: rjreilly@my-dejanews.com
Subject: Re: a tail of two hashes
Message-Id: <7gscm1$1jd$1@nnrp1.deja.com>

sorry, my data follows: %dmn  = (  1 => 'east.foo.com',  2 => 'west.foo.com',
 3 => 'south.foo.com',	4 => 'north.foo.com'  ); %dmnid = (3345 => '1', 3346
=> '1', 3347 => '4' , 3349 => '2', 3398=> '3', 23399 => '2');

%dmn   key is the domainname id and value is the domain name.
%dmnid key is a unique database id and value is domainname id.

what i would like to do is print  the key from %dmnid and the value from %dmn
where the domainid is the same..If i was using SQL i would do a join.

i hope this is a little clearer.

--regards
Robert Reilly
Oxford Health Plans
roreilly@oxhp.com





#$dmn{$id}   = domainnameID{domainname}
#$dmnid{$id} = databaseid{domainnameID}
> :
> : by binding the two hashes on the common domainnameID.
> : I have just ventured into the world of hashes and appreciate any help.
>
> I find your question a little confusing.  Maybe it would help if you
> gave us a small example to illustrate what you're trying to do.
>
> Greg
> --
> A little poison now and then: that makes for pleasant dreams. And
> much poison at the end for a pleasant death.
>     -- Nietzsche
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 6 May 1999 17:13:50 +0200
From: Marek.Rouchal@hl.siemens.de (Marek Rouchal)
Subject: Emacs .info documentation for Perl?
Message-Id: <7gsbje$jp7@tamarix.HL.Siemens.DE>

Dear all,

I've searched the Web and the Perl distribution and the Perl Home
Page for information on Emacs .info documentation for Perl.
Is there any available or is there a convertor .pod -> .info?
The only thing I found is the very fine cperl mode for emacs,
but I couldn't get context-sensitive help on Perl commands to 
work. Anyone who can help?

Thanks for your efforts,

Marek



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

Date: Thu, 06 May 1999 15:14:27 GMT
From: aspinelli@ismes.it (Andrea L. Spinelli)
Subject: Re: Help using message boards
Message-Id: <3731af84.9155531@news.inet.it>

On Thu, 6 May 1999 01:22:02 -0400, "Donboy"
<webmaster@roleplayinggames.net> wrote:
>  while($line=<FILE>) { if ($line =~ $FORM{'userid'}) { $access=1; } }
Using regular expressions for string comparison is quite
an overkill, I think.  Moreover, if your user types '....',
any four-letter password will do (!!!)

I would instead try

while( <FILE> ){
	chop;
	$access = ($_ eq $FORM{'userid'} );
}

or better

while( <FILE> ){
	chop;
	last if($access = ($_ eq $FORM{'userid'} ));
}


Also, when your users will be a lot, consider using a persistent
DB like DB_File.

HTH
  Andrea

--
Andrea Spinelli, Ismes SpA, Via Pastrengo 9, 24068 Seriate BG, Italy
e-mail: aspinelli@ismes.it Phone: +39-035-307209  Fax: +39-035-302999


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

Date: Thu, 6 May 1999 10:42:17 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: HELP: Newbie in Need of Script
Message-Id: <xPiY2.45$zh2.2537@dfw-service1.ext.raytheon.com>


Nelson Kulz wrote in message
<18401-3731199C-82@newsd-112.bryant.webtv.net>...

>Does anyone have a script written in Perl5 that allows access to telnet
>If ANYONE has a script which can do this, output HTML, and NOT use Java


system("telnet");
print "HTML";




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

Date: Thu, 6 May 1999 10:23:50 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: how to round off numbers?
Message-Id: <eyiY2.43$zh2.2620@dfw-service1.ext.raytheon.com>


Cim wrote in message <3732ac01.98382674@news.uninet.ee>...
>On 6 May 1999 14:33:02 +0100, Jonathan Stowe <gellyfish@gellyfish.com>
>wrote:
>
>Actually I have a similar problem. ceil() rounds 3.123 to 4 and
>floor() to 3. But i need one that does it like round() function in
>Excel - if it's 3.4 it rounds to 3 and if it's 3.6 it rounds to 4.
>?

Add .5 to your number






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

Date: 6 May 1999 16:19:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to round off numbers?
Message-Id: <3731b2eb@newsread3.dircon.co.uk>

Cim <cim@online.ee> wrote:
> On 6 May 1999 14:33:02 +0100, Jonathan Stowe <gellyfish@gellyfish.com>
> wrote:
> 
>>What happened when you tried it ?
>>
>>You ought to check out perlfaq4:
>>
>>  Does Perl have a round() function?  What about ceil() and floor()?  
>>  Trig functions?
> 
> Actually I have a similar problem. ceil() rounds 3.123 to 4 and
> floor() to 3. But i need one that does it like round() function in
> Excel - if it's 3.4 it rounds to 3 and if it's 3.6 it rounds to 4.
> ?
> 

Sorry which part of that FAQ or the functions it describes dont you 
understand ?

What happens if you do this:

    printf("%.0f %.0f\n",$number1,$number2);

With your example numbers for instance ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 6 May 1999 09:32:33 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: how to round off numbers?
Message-Id: <3731b611@cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

Cursed to submit his posting via Mozilla/4.51 [en] (Win98; I),
in comp.lang.perl.misc, lamj@softhome.net writes:

:I am trying to round off some numbers from say 123.123456 to 123.12, I know I
:can do it by printf but what is the syntax format? 

A newsgroup is not a manpage server.  man perlfunc, search for sprintf.

Bye.

--tom
-- 
pos += screamnext[pos]  /* does this goof up anywhere? */
    --Larry Wall, from util.c in the v5.0 perl distribution


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

Date: 6 May 1999 09:33:36 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: how to round off numbers?
Message-Id: <3731b650@cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    cim@online.ee (Cim) writes:
:Actually I have a similar problem. ceil() rounds 3.123 to 4 and
:floor() to 3. But i need one that does it like round() function in
:Excel - if it's 3.4 it rounds to 3 and if it's 3.6 it rounds to 4.

man perlfunc.  find sprintf.  read it.  

Bye.

--tom
-- 
Comments on data are usually much more helpful than on algorithms.  --Rob Pike


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

Date: Thu, 6 May 1999 17:17:58 +0200
From: "Asbjorn Gjemmestad" <agjemmes@extremeonline.com>
Subject: Re: Making executables from .pl files?
Message-Id: <KmiY2.298$7I.534@news1.online.no>

What makes you hot-shots think all the webmasters out there are just a smart
as you are? Is it such a stupid thought that 90% of webmasters don't have a
cluse about Perl, let alone how do decompile a program?

Most webmasters just want to put a site on the web, perhaps with a few
scripts to make things easier. Your average webmaster doesn't know how to
create an average operating system (although most of you people seem to
think you can).

Anywayz, people WILL be aware of the way the copy protection system contacts
our server, but 99% of those who use the script won't care! The last 1% can
choose not to buy the product if they don't want to!

And if the people out there are as smart as you claim (although one in a
hundred thousand is), why don't they write their own program? It'll be a lot
easier than decompiling and changing mine...

And IF someone should create a cracked version and distribute it, I'll still
have my copyright and licensing agreement - meaning that I've still got my
legal rights (but I won't have to bother looking around for unauthorized
copies all the time!)

Those who have a close are those most likely to change the script so they
won't have to pay for it. That's why it would be extremely foolish to give
them the code!

Asbjorn

Sam Holden skrev i meldingen ...
>Asbjorn Gjemmestad <agjemmes@extremeonline.com> wrote:
>>It seems like I'm not the one with the attitude problem...
>>
>>When selling a commercial product, would you want other people to mess
with,
>>change, and possibly redistribute your product? Me and my partner have
>>developet a neat copy protection system which contacts our server, and
thus
>>people won't be able to do anything about it if the code is pre-compiled.
>
>Assuming your users are all idiots and don't know how to have a look
>at network packets going back and forth from their machine and your server.
>Assuming your users are all idiots and don't know how to set up a proxy.
>Assuming your users are all idiots and don't know how to spoof your machine
>and their _local_ network.
>Assuming your users are all idiots and don't know how to patch a binary.
>
>One non-idiot user will be able to package up the 'cracked' version and
>distribute it by those famous ftp sites...
>
>Then again you might just assume your users are honest, in which case why
>bother.
>
>>Also, it makes installation a lot easier as you just upload the file to
your
>>server (without worrying about perl location), and do all the
configuration
>>through a web form.
>>
>>It's a matter of user friendliness. Not all people are smart enoguh to
>>develop their own programming language, and many webmasters want to use
Perl
>>without even knowing how to set the path correctly.
>
>If it's targetted at servers then requiring perl to be installed is not
>such a big deal anyway. A desktop program might be different, but any
>server without perl just isn't worth its salt ;)
>
>But that isn't your reason, as indicated by the second paragraph above. And
>if it was you would allow those whho did have a clue and had perl installed
>to install the much smaller script.
>
>--
>Sam
>
>PC's are backwards ... throw them out! Linux is ok though.
> --Rob Pike (on the subject of CR/LF etc)




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

Date: Thu, 06 May 1999 15:10:39 GMT
From: ralawrence@my-dejanews.com
Subject: Re: Making executables from .pl files?
Message-Id: <7gsbdb$d9$1@nnrp1.deja.com>

In article <ylhfpq1yxy.fsf@windlord.stanford.edu>,
  Russ Allbery <rra@stanford.edu> wrote:
>
> In my experience, people usually try to hide their code and prevent people
> from modifying it because they're not good enough programmers to write
> code that's worth sharing.  Take this as you will.
>

Congratulations on managing to insult all those that have released free
software without open source code. I assume after that little gem you're going
to delete every bit of free software that you have that doesn't come with
source code because after all "it isn't worth sharing"?

Rich.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 6 May 1999 15:11:39 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Ms Access database
Message-Id: <3731b12b.0@news.new-era.net>

Marco Vlemmings (marcov@ctrl-v.nl) wrote:
> hi all,

> I have a question about Ms Access. I want to write a perl script which
> makes a '.mdb' file. Why would i make a '.mdb' file, because i don't
> have a Window NT webserver but a Unix webserver. I want to know the
> content of  a 'mdb' file.Can someone help me?

An MDB file is a COM storage, and the file format is very, very
hairy. You'd be better off designing a better alternative.
It could take years to reimplement a COM storage subsystem
and the Access file format. By then, they'd change it
anyway :)

Scott


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

Date: Thu, 06 May 1999 17:46:43 +0200
From: Philippe Baduel <Philippe.Baduel@fth.net>
Subject: perl embed
Message-Id: <3731B963.9013B94B@fth.net>

Hello,

I would like to carry out a program which can load in memory several
modules Perl with same interpreter Perl. I followed the documentation of
Perl which says to use:

int main(int argc, char **argv, char **env)
{
    char ** embedding = { "" , "module.pm" };

    myPerl = perl_alloc() );
    perl_construct( myPerl );
    perl_parse( myPerl, NULL, 2, Embedding , (char **)NULL ));
    ...
}

but if I declare other modules in the variable " embedding " of this
program, such as for example:
    char ** embedding = { "" , "module1.pm" , "module2.pm" ,
"module3.pm" }
it charges in memory only " module1.pm ".

Is it possible to do it? and if so, how?


I have also another problem.  If the module that I load in memory have
one " use Net " or well one " use DBI ", when the program run, the
program me say that it arrive not to load the module indicate behind the
" use ". On the other hand, if it is one " uses strict " that goes.

What be necessary it that I make so that it charge well in report all
the module declare by some " use " in the module that I wish charge in
memory?

Thank you in advance.

Philippe Baduel.




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

Date: Thu, 06 May 1999 15:16:50 GMT
From: michielpeene@my-dejanews.com
Subject: Re: PerLDAP problems...
Message-Id: <7gsbos$jo$1@nnrp1.deja.com>

In article <7gqcqq$a1t$1@nnrp1.deja.com>,
  harasty@my-dejanews.com wrote:
> In article <7fpth2$qio$1@nnrp1.dejanews.com>,
>   michielpeene@my-dejanews.com wrote:
>
> If you said this:
>
> > I've installed PerLDAP-1.0 on my Win95 machine ...

I'm using windows NT by now...

> > Btw I'm using Active Perl build 515 ...
>
> Then why are you doing this?:

I always say: You never know...

>
> > I've installed PerLDAP-1.0 ... by typing "perl install-bin"
>
> I think that is the stuff from Mozilla.org that worked with the "Standard
> Perl", that is, a version of Perl that predates the convergence of "Standard
> Perl" with ActiveState's Perl.
>
> ActiveState Perl comes with the "Perl Package Manager", or PPM.  Run PPM from
> the command line, read the docs (both the ActiveState Perl docs and the
> embedded help commands), and realize that "typing 'perl install-bin'" is no
> longer needed... you can simply type "install Perldap" from inside PPM, and
> the app will go out on the net to ActiveState's site and load the most recent
> package.
>
> If you're not on the net when you run PPM, you need to download the package
> in zip format (http://www.activestate.com/packages/zips/), and follow the
> Readme in the zip.
>
> That's the good news.
>

I've used PPM, but I couldn't install PerLDAP. I did find another suitable
module however, called Net::LDAP. I've installed it via CPAN (although I had
to force the installation, because some tests failed) and this one works fine
with in my script. I use it to authenticate a user, to look up its email
address and to see if he's member of a predefined group (e.g. technician,
administrator or just a normal user).

> Here's the bad news:
>
> I'm finding that even the most recent version of PerLDAP installed with PPM
> is flakey with ActiveState Perl 515.  Sometimes my whole script with 40 LDAP
> calls will work.  Sometimes none of them work and Perl dies with "Error:
> Runtime exception".  Sometimes some of the calls work and then I get "Error:
> Runtime exception".  Once, Perl died and NT put up a dialog saying that the
> process running Perl had an access violation.
>
> The thing is, all my Perl scripts were working just fine with PerLDAP 1.0 and
> Standard Perl 5.004_02...
>
> Anyone out there involved with ActiveState or PerLDAP that can tell me (us)
> what this "Runtime exception" is?
>
> - Dan Harasty

Well, as I didn't install the PerLDAP, I don't know why you get this message,
bu t you might give Net::LDAP a try.

Michiel


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 6 May 1999 09:56:16 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: perlfunc study - optimize input data for repeated searches
Message-Id: <3731bba0@cs.colorado.edu>

(This excerpt is from the perlfunc manpage, part of the standard set of
documentation included with every valid Perl distribution--like the one on
your own system.  See also http://language.perl.com/newdocs/pod/perlfunc/
if your negligent system adminstrator has been remiss in his duties.)

NAME
    study - optimize input data for repeated searches

SYNOPSIS
    study SCALAR

    study

DESCRIPTION
    Takes extra time to study SCALAR (`$_' if unspecified) in
    anticipation of doing many pattern matches on the string before it
    is next modified. This may or may not save time, depending on the
    nature and number of patterns you are searching on, and on the
    distribution of character frequencies in the string to be searched-
    -you probably want to compare run times with and without it to see
    which runs faster. Those loops which scan for many short constant
    strings (including the constant parts of more complex patterns)
    will benefit most. You may have only one `study' active at a time--
    if you study a different scalar the first is "unstudied". (The way
    `study' works is this: a linked list of every character in the
    string to be searched is made, so we know, for example, where all
    the `'k'' characters are. From each search string, the rarest
    character is selected, based on some static frequency tables
    constructed from some C programs and English text. Only those
    places that contain this "rarest" character are examined.)

    For example, here is a loop that inserts index producing entries
    before any line containing a certain pattern:

        while (<>) {
            study;
            print ".IX foo\n"       if /\bfoo\b/;
            print ".IX bar\n"       if /\bbar\b/;
            print ".IX blurfl\n"    if /\bblurfl\b/;
            # ...
            print;
        }

    In searching for `/\bfoo\b/', only those locations in `$_' that
    contain `"f"' will be looked at, because `"f"' is rarer than `"o"'.
    In general, this is a big win except in pathological cases. The
    only question is whether it saves you more time than it took to
    build the linked list in the first place.

    Note that if you have to look for strings that you don't know till
    runtime, you can build an entire loop as a string and `eval' that
    to avoid recompiling all your patterns all the time. Together with
    undefining `$/' to input entire files as one record, this can be
    very fast, often faster than specialized programs like fgrep(1).
    The following scans a list of files (`@files') for a list of words
    (`@words'), and prints out the names of those files that contain a
    match:

        $search = 'while (<>) { study;';
        foreach $word (@words) {
            $search .= "++\$seen{\$ARGV} if /\\b$word\\b/;\n";
        }
        $search .= "}";
        @ARGV = @files;
        undef $/;
        eval $search;               # this screams
        $/ = "\n";          # put back to normal input delimiter
        foreach $file (sort keys(%seen)) {
            print $file, "\n";
        }

-- 
Tactical?  TACTICAL!?!?  Hey, buddy, we went from kilotons to megatons
several minutes ago.  We don't need no stinkin' tactical nukes.
(By the way, do you have change for 10 million people?) --lwall


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

Date: Thu, 6 May 1999 17:54:13 +0300
From: cederstrom@kolumbus.REMOVE_THIS.fi (Juho Cederstrom)
Subject: Re: procedure to convert sec to HH:MM:SS format
Message-Id: <slrn7j3b8l.mv.cederstrom@vortex.cede.net>

On Wed, 05 May 1999 15:29:38 +0200, 
peter <godzila@freemail.nl> wrote:

> Can some one tell me how can I convert sec to a normal time format
> hh:mm:ss.

my @time = gmtime( $seconds );
my $formatted = 
	sprintf( "%02d:%02d:%02d", $time[2], $time[1], $time[0] );


You can't use localtime instead of gmtime, because that won't give you
correct results if you don't live in GMT.

-- 
# This perl script will show juhoc's real email address
$_ = 'my e-mail address is NOT fi@cederstrom.kolumbus';
s/N\S+\s//g;s/(\S+)\@(\w+)\.(\w+)$/$2\@$3\.$1\n/;print;



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

Date: Thu, 6 May 1999 10:28:20 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: processor time
Message-Id: <sCiY2.44$zh2.2456@dfw-service1.ext.raytheon.com>

You posted this yesterday, and received a response (from me).  Please do not
clog the newsgroup with duplicate posts.


Todd Smith wrote in message <373186FB.1F04AF7@viper.net>...
>How can i make a program that does infinite loops not use 99% of the
>processor?
>





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

Date: Thu, 06 May 1999 17:28:41 +0200
From: Sebastian Frankfurt <sf@tellux.de>
Subject: Re: Q: checking defined/usable handles?
Message-Id: <3731B529.80772DC5@tellux.de>

William Blasius #42722 wrote:
> 
> use strict;
> use FileHandle;
> my $p_out = new FileHandle;
> open $p_out, ">&STDOUT";
> $p_out->autoflush(1);
> my ($win, $wout, $eout);
> vec($win, fileno($p_out), 1) = 1 if defined fileno($p_out);
> if ( 0 < select( undef, $wout=$win, $eout=$win, 0 ) ) {
> $wout ? print $p_out "some nice output\n" : die "some nasty error";
> } else {
> print "no select\n";
> }
> 
> and it prints 'some nice output'. Select(2) normally returns -1 for
> an error. Do you get an error in $! - like 'Bad file number'? IMHO,
> you will get strange results in you select a closed fh - the result
> bitstring is set to the input bitstring and confusion is likely the
> result, so don't do that! ;-)
> 
> If you can't run that code snippet, let us know the results.

okay, okay, this little code snippet is running... _but_ if I
use something like this:

use strict;
use FileHandle;
use IPC::Open3;

my $p_out = new FileHandle;
my $p_in  = new FileHandle;

# this program-call let the bc-program terminate with
# an error
my $cmd   = "bc bla";

#open $p_out, ">&STDOUT";
IPC::Open3::open3('BC_WRITE', 'BC_READ', '', "$cmd 2>&1\n") ||
    die ("Unable to open connection to BC");

$p_out = *BC_WRITE;
$p_in  = *BC_READ;

$p_out->autoflush(1);
$p_in->autoflush(1);


my ($win, $wout, $eout);
vec($win, fileno($p_out), 1) = 1 if defined fileno($p_out);
if ( 0 < select( undef, $wout=$win, $eout=$win, 0 ) ) { 
  if ($wout) {
    print $p_out "some nice output\n";
    print "some nice output\n";
  } else { 
    die "some nasty error";
  }
} else {
  print "no select\n";
}


I use bc in this example, cause I'm sure, you don't have the
prog I am really calling, but it demonstrates exact the same
results:

If the bc program has been startet ab well using $cmd="bc"
gives the 'some nice output' on screen, _but_ when you call
bc with wrong arguments $cmd="bc bla" you will get the
same result: "some nice output".

And... what is wrong now?

cu,
Sebastian


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

Date: Thu, 6 May 1999 11:11:28 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: s///ge & $`
Message-Id: <7gsb0i$vbg$1@nntp1.atl.mindspring.net>

Andrew Allen wrote in message <7gpne1$d3k$1@fcnews.fc.hp.com>...
:so the following code:
:  perl5 -e '$a="abcd"; $a=~s/./print "$`-";"x"/ge;'
:prints out:
:  -a-ab-abc-
:which I find surprising, at best. Obviously, the man behind the
:curtains is doing the "substitutions" on the old string while building
:the new string. But is there any way of getting the "real" $` (i.e.,
:the one with the substitutions I've already made?)
:


Well, I am not sure I follow what you are asking for but will either of
these do what you want?

$a=~s/(.)/$x.=$1;print "$x-";/ge;
$a=~s/(.)/print "$1-";/ge;

HTH

AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
An old pond-
The sound of the water
When the frog jumps in
 - Basho





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

Date: 6 May 1999 15:01:13 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: syswrite() lies
Message-Id: <slrn7j3bll.sgs.sholden@pgrad.cs.usyd.edu.au>

On Thu, 6 May 1999 07:28:29 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>In article <slrn7j2vg4.b8v.sholden@pgrad.cs.usyd.edu.au> on 6 May 1999 
>11:33:24 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> says...
>... 
>> This can't be fixed in perl. Since then syswrite would be broken for
>> those who want to use it to write a text file.
>> 
>> The function does work. It works as documented. binmore also works. It also
>> works as documented. The problem is that the platform that requires the
>> use of binmode, is the platform which has the highest proportion of 
>> people who don't bother reading the documentation to find out.
>> 
>> I'll just say again. The brokeness is not perl's problem, and can not
>> be fixed by perl. It is a 'feature' of the platform. 
>
>It *can* be fixed -- in Perl documentation -- just as it has been 
>'fixed' in the C Standard.  When one opens a binary file using C, one 
>uses mode "ab" or "rb" or "wb".  When one opens a binary file using 
>Perl, one uses binmode().  Period.  That is The Way To Do It!
>
>Nowhere in the paragraph above does the word 'platform' appear (nor the 
>words 'broken' or 'brain-dead').  Programs that don't use binmode() are 
>not portable.  Period.

My references to brokeness were just using the same language as the post
I was replying to. Although I used 'feature' since I can't see why using
two characters for one logical character could have been thought of as
a good thing to do given the technical reasons for doing so no longer
applied.

>Perl writers and teachers can eliminate this problem once and for all 
>(at least for newcomers to Perl), at the cost of instructing people 
>*always* to include a line of code that happens to be a no-op in some 
>environments.  binmode() should appear in every book and in every 
>tutorial and in every snippet as The Way To Do It.  Period.  Then even 
>"people who don't bother reading the documentation to find out" will use 
>it naturally, just as they use open().

Strangely enough I already do that (aside from the teaching and book bit).
The problem is that most examples and almost all FAQs that aren't directly
related to reading and writing binary files involve text files. 

Thus binmode doesn't get used in those. Since that is what people see
they don't use binmode when manipulating binary files as well. Unless
they happen to have read the documentation instead of

The problem I was referring to with reading documentation was :

Windows people don't seem to read the documentation as much (I have no
evidence, it's my opinion - I'm probably wrong) as unix people.

Unix people read about binmode in that documentation and then should use
it (many write non-portable code and don't use it, but that is OK in a lot
of situations (code that does very unixy things for example)).

Windows people don't read about binmode and thus don't use it.

If it was unix that needed binmode all would be well. If it was unix people
that didn't read the documentation all would be well. But we have the
wrong mix, and thus we have this mistake happening over and over again.

>
>The C Standard is by design platform-independent.  The Unix origins of 
>the C Library are quite apparent, but the functions are documented for 
>program portability.  So should Perl functions be!  (If there were to be 
>a Perl Standard and I were to be on the Technical Committee, they would 
>be.  But don't anyone hold their breath until that happens.  :-)

The perl documentation tends to treat the whole world as unix, and anything
else as wrong. Thus in the open documentation it mentions binmode but says
that you don't need it on 'modern operating systems'. In my opinion that
isn't very helpful, since most people would consider Windows 98 to be more
modern than unix (I don't care about the histories of both, it's general
opinion I'm talking about).

I doubt it will change, I'm not going to submit a documentation bug about it,
TomC would strike me down for possibly hinting that unix users should do
something to make it easier for windows users ;)



-- 
Sam

Another result of the tyranny of Pascal is that beginners don't use
function pointers.
	--Rob Pike


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

Date: 6 May 1999 16:24:53 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Using LWP: getting the code for a website?
Message-Id: <3731b445@newsread3.dircon.co.uk>

Joseph4829 <joseph4829@aol.com> wrote:
> How can I make this simple when all I want is the end product ($code) ? I want
> to speed it up. I could really care less about the Netscape stuff.
> 

Ok I will delete the lines you dont need for you :

> use LWP::UserAgent;
> 
> $url = "$siteurl";
> 
> my $ua = LWP::UserAgent->new();
> 
> my ($req) = new HTTP::Request ('HEAD', $url);
> my ($res) = $ua->request($req);
> $code = $res->code;

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

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 5581
**************************************

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