[18324] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 492 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 15 09:05:47 2001

Date: Thu, 15 Mar 2001 06:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984665112-v10-i492@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 15 Mar 2001     Volume: 10 Number: 492

Today's topics:
    Re: Duplicate entry problem in mysql using DBI <peb@bms.umist.ac.uk>
    Re: Echo client one step behind server response? (socke nobull@mail.com
    Re: FAQ 7.12:   What's a closure? (Anno Siegel)
        Getting contents of a URL <cmon_209@hotmail.com>
    Re: HTTP Client Question (Logan Shaw)
    Re: HTTP Client Question (Miguel Cruz)
    Re: HTTP Client Question (Martien Verbruggen)
    Re: HTTP Client Question <spohn@bigfoot.com>
    Re: HTTP Client Question (Anno Siegel)
    Re: Is there a shorter way for this? <bart.lateur@skynet.be>
    Re: Is there a shorter way for this? (Martien Verbruggen)
    Re: Is there a shorter way for this? <alun.moon@unn.ac.uk>
    Re: Is there a shorter way for this? nobull@mail.com
    Re: JUMPING (Tony L. Svanstrom)
        newbie: CGI Error gives path of website <SorryGot@DirtyMail.com>
        Passing Parameters plop740@mail.ru
    Re: Passing Parameters (Paul Tomblin)
        Perl 4 <kiwitter@qns.de>
    Re: Perl 4 (Anno Siegel)
    Re: Perl 4 (Martien Verbruggen)
    Re: Perl 4 <kiwitter@qns.de>
    Re: Perl FAQ? <thunderbear@bigfoot.com>
    Re: Print own "die" message <bart.lateur@skynet.be>
    Re: problem passing dir names to glob <Peter.Dintelmann@dresdner-bank.com>
    Re: puzzling do{} and map interaction <david.bouman@nl.xo.com>
    Re: puzzling do{} and map interaction (Anno Siegel)
        QUE: Serial port interrupt handling from perl <mtsouk@freemail.gr>
    Re: Signals and parent/child/child processes (Anno Siegel)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Mar 2001 10:26:52 +0000
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: Duplicate entry problem in mysql using DBI
Message-Id: <3AB098EC.9878E399@bms.umist.ac.uk>

Meyrick wrote:
> My perl script generates the following error on accessing mysql:
> 
> DBD::mysql::db do failed: Duplicate entry '0000-00-00' for key 1 at
> ./minky.pl line 120
> Database handle destroyed without explicit disconnect.
> 
> Now, I know from using shell scripts to access this database that mysql
> likes to have date format wrapped in single quotes - so that is what I
> have done in perl - but it complains!
 
> Here is the code fragment from my script:
<snip>

I don't think the mysql server is griping about the single quotes.

Do you have the date field set as a primary key?  The above error looks
like it's generated by an attempt to insert either the same data over
the top of itself (i.e. you've run the script twice without going into
the database and deleting the previous attempt).

>                $dbh->do("INSERT INTO ED1 VALUES(date,2output,2op_strike,
                                           ^^^^^^
don't you need this to come later?  You are referring to columns not
values at this point.

>                        1output,1op_strike,atm,atm_strike,1outcall,
>                        1oc_strike,2outcall,2oc_strike,expiry,underlying)",
>                        ($db_date,$out_put2,$dn_strike2,$out_put1,
                    ^^^^^^

should really be here shouldn't it?

e.g. $dbh->do("INSERT INTO ED1(date,2output) VALUES ($db_date,
$out_put2)");

HTH

Paul


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

Date: 15 Mar 2001 08:34:44 +0000
From: nobull@mail.com
Subject: Re: Echo client one step behind server response? (socket question)
Message-Id: <u97l1rgxsf.fsf@wcl-l.bham.ac.uk>

Daniel Berger <djberge@uswest.com> writes:

> Subject: Echo client one step behind server response? (socket question)

Question has absolutely nothing to so with sockets. You will see
exactly the same effect if you do:

perl -pe '$_ = reverse $_' <infile >outfile

The first line of outfile is now blank, the (n)th line of outfile is
the (n-1)th line of infile reversed.  (The last line of outfile lacks
a terminator).

This is because if you reverse a string that ends with "\n" the
reversed string starts with "\n".

>       while(my $msg_in = <$clientSock>){
>          my $msg_out = (scalar reverse $msg_in);
>          print $clientSock $msg_out;
>       }

Change to 

       while(my $msg_in = <$clientSock>){
          chomp $msg_in;
          my $msg_out = (scalar reverse $msg_in);
          print $clientSock "$msg_out\n";
       }

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 15 Mar 2001 09:44:18 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FAQ 7.12:   What's a closure?
Message-Id: <98q2ti$kr5$1@mamenchi.zrz.TU-Berlin.DE>

According to PerlFAQ Server  <faq@denver.pm.org>:
 
>     Closures are documented in the perlref manpage.
> 
>     *Closure* is a computer science term with a precise but hard-to-explain
>     meaning. Closures are implemented in Perl as anonymous subroutines with
>     lasting references to lexical variables outside their own scopes. These
>     lexicals magically refer to the variables that were around when the
>     subroutine was defined (deep binding).

[...]

This FAQ excerpt, as well as other places in the documentation,
insist that a closure be an anonymous subroutine.  In my view, the
characteristic property of a closure is that it keeps lexicals alive
that would otherwise have gone out of scope.  But that is also true
with a named subroutine that is defined inside a bare block:

    {
        my $state = 0;
        sub toggle { $state = not $state; }
    }

So would this not be a closure?  If it said "$toggle = sub { ...}"
instead, would it be?

It's true that the more interesting applications of closures are
generated at run time, with individual incarnations of the lexicals
for each copy.  The basic mechanism however seems to be the same
in both cases.

Anno


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

Date: Thu, 15 Mar 2001 13:49:34 GMT
From: Chandramohan Neelakantan<cmon_209@hotmail.com>
Subject: Getting contents of a URL
Message-Id: <OL3s6.3624$54.4058@www.newsranger.com>

Hi.

I am trying to obtain the contents of a URL like 

http://www.cyberspace.org/index.html

into a variable $contents.

I used the get() method in LWP::Simple module but got the folloing message

"Your vendor has not defined Socket Macro AF_INET in Socket.pm"

I tried reinstalling the module but , it gave the same message.Now I have
written off that module and I want to know if 

1.it can be developed on my own
2 other modules are available to accomplish the same 

For Option 1 ,i would consider it a great help if somebody can give me tips on
how to proceed.



Am clueless as far as the LWP module is concerned.There werent   any
error/warning messages while  the module was being installed.
I am looking for suggestions for alternate methods to get the above task done.  



Thanx 



Chandramohan Neelakantan

"A journey of a thousand miles begins with a single step"
                                           - Japanese Proverb


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

Date: 15 Mar 2001 02:29:47 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: HTTP Client Question
Message-Id: <98puhr$nou$1@boomer.cs.utexas.edu>

In article <slrn9avi7u.bch.dha@panix2.panix.com>,
David H. Adler <dha@panix2.panix.com> wrote:
>Of course, the fact that abigail is one of the more knowledgeable
>posters here, and that many of the other experts may well have followed
>suit silently, is unimportant.

I'm not sure if I'm an expert or not, but I generally make my own
decisions about whether to include someone in a killfile.  In fact,
of all the newsgroups I read (too many, of course), all except one
killfile is empty, and that one only has one person in it.

That doesn't mean I read every article, though.

  - Logan
-- 
whose?  my  your   his  her   our   their   _its_
who's?  I'm you're he's she's we're they're _it's_


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

Date: Thu, 15 Mar 2001 08:39:42 GMT
From: mnc@admin.u.nu (Miguel Cruz)
Subject: Re: HTTP Client Question
Message-Id: <id%r6.2707$vc.1568220@typhoon2.ba-dsg.net>

Al Spohn <spohn@bigfoot.com> wrote:
> And contrary to your earlier comment, the extent to which one is
> knowledgeable *is* unimportant when it comes down to basic courtesy or
> making the distinction between silly nit-picking and constructive
> suggestions concerning group etiquette.  If getting slammed every time one
> posts imperfectly is what the rules are all about, then yes, I guess I do
> expect people to follow different rules - but hopefully not for just me,
> but also for the next poor slob who happens along looking for help and
> ends up committing some typographical/semantic sin that gets him/her in
> deep poop with the local post militia.

When I come to a new newsgroup, I always read at least a few days' worth of
old posts to get a sense of:

  A) The rules
  B) The personalities
  C) Whether my burning question was just answered for someone else
  D) How to best put my burning question

Works a treat.

miguel


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

Date: Thu, 15 Mar 2001 20:08:54 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: HTTP Client Question
Message-Id: <slrn9b11l6.kjn.mgjv@martien.heliotrope.home>

On Wed, 14 Mar 2001 16:55:46 GMT,
	Bob Dilworth <avast@hortonsbay.com> wrote:
> On 13 Mar 2001 22:28:10 GMT, abigail@foad.org (Abigail) wrote:
> 
>>Al Spohn (spohn@mayo.edu) wrote on MMDCCLI September MCMXCIII in
>><URL:news:98m58p$5ie$1@tribune.mayo.edu>:
>>.. 
>>.. There, now I'm no longer "perl free."
>>
>>Instead, you're Jeopardy compliant.
>>
>>*plonk*
> 
> Al:
> 
> The above little worthless commentary from one of the members of the
> clpm Taliban indicates that you've violated on of their favorite

I love it when people volunteer for this.

*thud*

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd.   | bundled with your Microsoft product.
NSW, Australia                  | 


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

Date: Thu, 15 Mar 2001 06:40:45 -0600
From: "Al Spohn" <spohn@bigfoot.com>
Subject: Re: HTTP Client Question
Message-Id: <tb1e2bsqagtdf1@corp.supernews.com>


Miguel Cruz <mnc@admin.u.nu> wrote in message
news:id%r6.2707$vc.1568220@typhoon2.ba-dsg.net...
> Al Spohn <spohn@bigfoot.com> wrote:
> > And contrary to your earlier comment, the extent to which one is
> > knowledgeable *is* unimportant when it comes down to basic courtesy or
> > making the distinction between silly nit-picking and constructive
> > suggestions concerning group etiquette.  If getting slammed every time
one
> > posts imperfectly is what the rules are all about, then yes, I guess I
do
> > expect people to follow different rules - but hopefully not for just me,
> > but also for the next poor slob who happens along looking for help and
> > ends up committing some typographical/semantic sin that gets him/her in
> > deep poop with the local post militia.
>
> When I come to a new newsgroup, I always read at least a few days' worth
of
> old posts to get a sense of:
>
>   A) The rules
>   B) The personalities
>   C) Whether my burning question was just answered for someone else
>   D) How to best put my burning question
>
> Works a treat.

Good idea.  Although in the past decade or so of posting, careful observance
of item C has always kept me out of trouble.  Then again, I guess I'd never
posted to this group.  Thanks for the feedback Miguel, I'll put it to good
use!

- Al




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

Date: 15 Mar 2001 13:29:12 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HTTP Client Question
Message-Id: <98qg38$28g$1@mamenchi.zrz.TU-Berlin.DE>

According to Al Spohn <spohn@bigfoot.com>:

[...]

> committing some typographical/semantic sin that gets him/her in deep poop
> with the local post militia.

"Post militia", eh?  In another thread, or another branch of this one,
it was "Taliban".  I seriously don't get why this kind of imagery is
so popular, considering that no usenet poster has *any* power over
any other poster.  How can you expect to be taken seriously with
metaphors so blatantly off the mark?

Anno


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

Date: Thu, 15 Mar 2001 08:24:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Is there a shorter way for this?
Message-Id: <vvu0btk5r60vu843rmi6a0iu55uoirqki3@4ax.com>

John Lin wrote:

>> Note that thanks to the map() you can't use $_ for the matching string.
>
>Doesn't matter.  It's "local"ized within map.

It DOES matter. You can't use $_ both for the main string and for the
indexes, at the same time.

>$_ = 'abc';
>my @x = map {$_} 1..3;
>print "$_ @x";
>
>__END__
>abc 1 2 3

Please tell me how you can make this return ("abc1", "abc2", "abc3"),
without help of another variable. That would be an accomplishment.

-- 
	Bart.


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

Date: Thu, 15 Mar 2001 20:06:46 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is there a shorter way for this?
Message-Id: <slrn9b11h6.kjn.mgjv@martien.heliotrope.home>

On Thu, 15 Mar 2001 08:24:29 GMT,
	Bart Lateur <bart.lateur@skynet.be> wrote:
> John Lin wrote:
> 
>>$_ = 'abc';
>>my @x = map {$_} 1..3;
>>print "$_ @x";
> 
> Please tell me how you can make this return ("abc1", "abc2", "abc3"),
> without help of another variable. That would be an accomplishment.

@x = map { "abc$_" } 1..3;
print "@x";

;)

Martien
-- 
Martien Verbruggen              | Since light travels faster than
Interactive Media Division      | sound, isn't that why some people
Commercial Dynamics Pty. Ltd.   | appear bright until you hear them
NSW, Australia                  | speak?


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

Date: 15 Mar 2001 09:28:07 +0000
From: Alun Moon <alun.moon@unn.ac.uk>
Subject: Re: Is there a shorter way for this?
Message-Id: <ud7bjgz4o.fsf@unn.ac.uk>

merlyn@stonehenge.com (Randal L. Schwartz) writes:
> Looks to me like
> 
>         @result = /\S+?=(\S+), /g;
> 
> gets you 90% of the way there, except you have to split apart a few of
> the subentries.  Easy enough with splice.

Presuming to try and better on the holy rit of Randal ;-)

Would
	%result = /(\S+)?=(\S+), /g;
be any better?

If I'm right, then the matched parentheses come out in name/value
pairs then the list context assignment to the hash populates the keys
and values in the right pairing.

Knowing which values need spliting, they could then be replaced with
an array reference...like

	$result{char} = [ split('/', $result{char})];

Now I'm having to teach Perl as well as hack-it, I'm trying to flex my
muscles a little more and get really creative in how I use it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dr Alun Moon            Senior Lecturer in Computing
                        School of Computing and Mathematics
alun.moon@unn.ac.uk     D.204 Ellison Building
(0191) 227 3643         University of Northumbria at Newcastle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 15 Mar 2001 12:23:50 +0000
From: nobull@mail.com
Subject: Re: Is there a shorter way for this?
Message-Id: <u9wv9rfcfd.fsf@wcl-l.bham.ac.uk>

Alun Moon <alun.moon@unn.ac.uk> writes:

> 	%result = /(\S+)?=(\S+), /g;

Surely you mean:

 	%result = /(\S+?)=(\S+), /g;

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 15 Mar 2001 13:17:56 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: JUMPING
Message-Id: <1eqbea3.1q0tso11iqh8sbN%tony@svanstrom.com>

Shane McDaniel <shanem@ll.mit.edu> wrote:

> You would then need to print a redirection HTML statement.  This is an
> HTML issue.

No!

This is a CGI-issue[*]; you don't start messing with meta-tags for such
a thing when you have better tools available to you.


        /Tony
[*] well, HTTP-issue if you want to be 100% correct 'bout it. =)


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

Date: Thu, 15 Mar 2001 13:36:31 +0100
From: "marc" <SorryGot@DirtyMail.com>
Subject: newbie: CGI Error gives path of website
Message-Id: <98qd5q$st1$1@news1.xs4all.nl>

Hi,

this is probably a simple one, whenever I try to type a cgi
file that does not exist I get a page telling me:

Can't open perl script "C:\Inetpub\...  and so on...

How do I turn the path info off?

Any help will be appreciated.

Marc




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

Date: Thu, 15 Mar 2001 04:45:31 +0000
From: plop740@mail.ru
Subject: Passing Parameters
Message-Id: <q6i0bt8el3so1jq4t04pr7md06j0ecatsa@4ax.com>

I need to pass one parameter when I call a cgi script by a html form
(POST), and that parameter to be used in the script.

I suppose the method is to call script.cgi?parameter or something like
that, but how to use it after, in the script ?

You have guessed that I am a newbie, I suppose :-)

Thanks !

Igor


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

Date: 15 Mar 2001 13:58:07 GMT
From: ab401@freenet.carleton.ca (Paul Tomblin)
Subject: Re: Passing Parameters
Message-Id: <98qhpf$35j$1@freenet9.carleton.ca>

In a previous article, plop740@mail.ru said:
>I need to pass one parameter when I call a cgi script by a html form
>(POST), and that parameter to be used in the script.

man CGI

Look for the section entitled "FETCHING THE NAMES OF ALL THE PARAMETERS
PASSED TO YOUR SCRIPT" and the subsequent couple of sections.

-- 
Paul Tomblin <ptomblin@xcski.com>, not speaking for anybody
Microsoft - Where quality is job 1.0.1


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

Date: Thu, 15 Mar 2001 10:33:44 +0100
From: "Kiwitter@qns.de" <kiwitter@qns.de>
Subject: Perl 4
Message-Id: <98q2av$ogc$04$1@news.t-online.com>

Hi @ all ....

where can i get Perl 4 for Linux ? can some one tell me the URL of an server
wherer i can download perl 4 ?


thx .....

Patrick




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

Date: 15 Mar 2001 09:50:31 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl 4
Message-Id: <98q397$kr5$2@mamenchi.zrz.TU-Berlin.DE>

According to Kiwitter@qns.de <kiwitter@qns.de>:
> Hi @ all ....
> 
> where can i get Perl 4 for Linux ? can some one tell me the URL of an server
> wherer i can download perl 4 ?

CPAN may still have it.  Why do you want it?

Anno


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

Date: Thu, 15 Mar 2001 20:50:33 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Perl 4
Message-Id: <slrn9b1439.kjn.mgjv@martien.heliotrope.home>

On Thu, 15 Mar 2001 10:33:44 +0100,
	Kiwitter@qns.de <kiwitter@qns.de> wrote:
> Hi @ all ....
> 
> where can i get Perl 4 for Linux ? can some one tell me the URL of an server
> wherer i can download perl 4 ?

Why would you want to?

Anyway, you can download the sources from any CPAN mirror, 

CPAN/src/unsupported/4.036/

Try www.cpan.org, if you don't know a local mirror.

However, you might have a bit of trouble getting it compiled on linux.
It's old. I've been trying on and off for w hile now to get a compiled
version of all versions of Perl, just for the heck of it, but haven't
been bothered enough by not having it to put a real effort in.

Are you also running SunOS 4.1 or DOS 3.1?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.   | you come to the end; then stop.
NSW, Australia                  | 


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

Date: Thu, 15 Mar 2001 14:59:40 +0100
From: "Kiwitter@qns.de" <kiwitter@qns.de>
Subject: Re: Perl 4
Message-Id: <98qhtj$dqd$03$1@news.t-online.com>

hi....

no my os is System V unix  :-)

oki bye ...

--
------------------------------------------
Patrick Kiwitter

QNS Quattro Network Solutions
Werner Hellweg 27
44803 Bochum

Tel.: (0049) +234/9351430
Fax : (0049) +234/353214

http://www.QNS.de
------------------------------------------
"Martien Verbruggen" <mgjv@tradingpost.com.au> schrieb im Newsbeitrag
news:slrn9b1439.kjn.mgjv@martien.heliotrope.home...
> On Thu, 15 Mar 2001 10:33:44 +0100,
> Kiwitter@qns.de <kiwitter@qns.de> wrote:
> > Hi @ all ....
> >
> > where can i get Perl 4 for Linux ? can some one tell me the URL of an
server
> > wherer i can download perl 4 ?
>
> Why would you want to?
>
> Anyway, you can download the sources from any CPAN mirror,
>
> CPAN/src/unsupported/4.036/
>
> Try www.cpan.org, if you don't know a local mirror.
>
> However, you might have a bit of trouble getting it compiled on linux.
> It's old. I've been trying on and off for w hile now to get a compiled
> version of all versions of Perl, just for the heck of it, but haven't
> been bothered enough by not having it to put a real effort in.
>
> Are you also running SunOS 4.1 or DOS 3.1?
>
> Martien
> --
> Martien Verbruggen              |
> Interactive Media Division      | Begin at the beginning and go on till
> Commercial Dynamics Pty. Ltd.   | you come to the end; then stop.
> NSW, Australia                  |




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

Date: Thu, 15 Mar 2001 14:06:42 +0100
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Perl FAQ?
Message-Id: <3AB0BE62.91FF0664@bigfoot.com>

kellyboy wrote:
> 
> Boy... I ve got two book on perl but still dont find what Im looking for...

Which question is it that you haven't been able to find an answer to?

-- 
  Thorbjørn Ravn Andersen              "...sound of...Tubular Bells!"
  http://bigfoot.com/~thunderbear


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

Date: Thu, 15 Mar 2001 08:47:48 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Print own "die" message
Message-Id: <ba01bts17ktm239spumf66ucnr7ggsmgg8@4ax.com>

What A Man ! wrote:

>> I think you want:
>> 
>>          use CGI::Carp qw(fatalsToBrowser);
>>          die "Fatal error messages are now sent to browser";
>> 
>> See perldoc CGI::Carp

>Thanks, Brad.. but I was hoping not to have to use another module. I'm
>using 10 modules in the script already. Is there another way?

There's nothing stopping you from looking at the source of the module.
The whole trick is in setting $SIG{__DIE__}, in which you can do
whatever you like with the error message. And don't forget to quit the
program when you're through, or you're stuck with your own problem.

-- 
	Bart.


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

Date: Thu, 15 Mar 2001 12:03:31 +0100
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: problem passing dir names to glob
Message-Id: <98q768$lv62@news-1.bank.dresdner.net>

    Hi Kim,

"Kim C" <kimmfc@mydeja.com> wrote in message
news:e000btsb1nq26lpl6l601v924th37lu5rs@4ax.com...

> I'm having trouble passing directory names containing spaces to the
> 'glob()' function using a variable.  For example:
>
> @notes = glob ("$dir/*.log");
>
> works file if '$dir' contains no spaces but returns nothing it
> contains a space.
>
> $dir = 'Log_Files'; ## ok
> $dir = 'Log Files'; ## doesn't work

    try

        my $dir = "c:/temp/test space";
        my @files = glob( "\Q$dir/*.*" );
        print @files;

    See the perlop page for \Q.

    Regards,

        Peter Dintelmann





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

Date: Thu, 15 Mar 2001 13:21:18 +0100
From: David Bouman <david.bouman@nl.xo.com>
Subject: Re: puzzling do{} and map interaction
Message-Id: <3AB0B3BE.192C6E48@nl.xo.com>

Anno Siegel wrote:
> 
> According to David Bouman  <david.bouman@nl.xo.com>:
> >
> > Consider these:
> >
> > 1)  $l = { map( ($_,1), qw( a b )) }      ; print(( ref($l) || $l ), "\n" );
>
> ...
>
> > 2)  $l = do{ { a => 1, b => 1 }}          ; print(( ref($l) || $l ), "\n" );
>
> ...
>
> > 3)  $l = do{ { map( ($_,1), qw( a b )) }} ; print(( ref($l) || $l ), "\n" );
> 
> Here, the inner pair of {} is interpreted as an extra pair of block
> braces, not a hashref constructor.  Both interpretations are possible;
> why Perl chooses the one it does is anybody's guess.
> 
> The effect is, that scalar context propagates right though to map(),
> so it returns the number of elements it has produced.
> 
> > 1 outputs "HASH"  (makes sense to me)
> > 2 outputs "HASH"  (yup, been expecting that)
> > 3 outputs "4"     (huh ?)
> >
> > Why ?
> 
> I think I have answered the "how".  The "why" is open to discussion.

Thanks for that. Perhaps I should rephrase the "why": 

Could I have known that the {}'s around the map() (or, as it would seem, any 
function that returns a list) wouldn't behave as a hashref constructor?

If so, how?

--
David.


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

Date: 15 Mar 2001 13:04:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: puzzling do{} and map interaction
Message-Id: <98qeku$1nm$1@mamenchi.zrz.TU-Berlin.DE>

According to David Bouman  <david.bouman@nl.xo.com>:
> Anno Siegel wrote:
 
> > I think I have answered the "how".  The "why" is open to discussion.
> 
> Thanks for that. Perhaps I should rephrase the "why": 
> 
> Could I have known that the {}'s around the map() (or, as it would seem, any 
> function that returns a list) wouldn't behave as a hashref constructor?

I don't think the behavior could have been predicted.  It's a real
ambiguity in the Perl grammar (and by far not the only one).  So
Perl arbitrarily decides which interpretation to chose, and if
tomorrow's Perl decides the other way around, there's nothing in
the docs to stop it.

You can only develop a sense for these ambiguities so you are
prepared when Perl guesses you wrong.  Then again, most of the
time the Parser gets it right, so programmers often don't notice
there *is* an ambiguity.

Anno


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

Date: Thu, 15 Mar 2001 14:35:25 +0200
From: "Mihalis Tsoukalos" <mtsouk@freemail.gr>
Subject: QUE: Serial port interrupt handling from perl
Message-Id: <98qd0j$27us$1@ulysses.noc.ntua.gr>

Hello to everyone.

I want to ask the following question:
I want an example of how to handle serial port interrupts from perl.
If possible I want to have to possible options:
- Reading interrupt
- Writing interrupt

many thanks in advance,
Mihalis.




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

Date: 15 Mar 2001 10:01:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Signals and parent/child/child processes
Message-Id: <98q3u9$kr5$3@mamenchi.zrz.TU-Berlin.DE>

According to The Snow Moose <snow_moose@hotmail.com>:
> I'm having some problems with signals and child processes, can someone run
> the
> attachments and see what it does :
> 
> Run it as
> start.pl -timeout=15 -cmd="./runtest.pl"
> 
> What I expected to happen is that the runtest.pl process should receive the
> SIGINT and say "runtest.pl: got_signal" but that doesn't seem to happen
> when the signal is given by the start.pl process ?
> 
> Interestingly, I can do a kill -15, <pid> on the command line and it's
> received
> with no problems ...
> 
> Can someone explain this to me please ?

Possibly, but I doubt anyone will bother as long as you insist in
posting your Perl code uuencoded.

Anno


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

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


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