[25802] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8041 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 2 14:05:19 2005

Date: Mon, 2 May 2005 11:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 2 May 2005     Volume: 10 Number: 8041

Today's topics:
        file handling - a simple explanation? <geoff.cox@notquitecorrectfreeuk.com>
    Re: file handling - a simple explanation? <john@castleamber.com>
    Re: file handling - a simple explanation? <noreply@gunnar.cc>
    Re: file handling - a simple explanation? <geoff.cox@notquitecorrectfreeuk.com>
    Re: file handling - a simple explanation? <geoff.cox@notquitecorrectfreeuk.com>
        question about namespacing in perl <khamis@wellcode.com>
    Re: question about namespacing in perl <tassilo.von.parseval@rwth-aachen.de>
    Re: Somethign about hashes <tadmc@augustmail.com>
    Re: Somethign about hashes <hackeras@gmail.com>
    Re: Somethign about hashes <1usa@llenroc.ude.invalid>
    Re: Somethign about hashes <tadmc@augustmail.com>
    Re: Somethign about hashes <hackeras@gmail.com>
    Re: Somethign about hashes <hackeras@gmail.com>
    Re: Somethign about hashes <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 02 May 2005 15:12:23 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: file handling - a simple explanation?
Message-Id: <dbgc719aib7v6fe0jcna5qmdhk8vo721ku@4ax.com>

Hello,

I am getting the following error message for the last 3 files being
processed only, and must be doing something wrong - not sure what
though. The code works.

print() on closed filehandle OUT2 at hp3.pl line 33, <IN> line 12.

The code is

    open (IN, $name);
    open OUT, (">>hp-$name");
    open OUT2, (">>html/hp-index.htm");

    while (defined(my $line = <IN>)) {

       if ($line =~ /<title>(.*?)- (.*?)<\/title>/) {
           print OUT2 ('<a href="hp-$htmlname.htm">$1 $2</a> <br>\n');


Thanks for any ideas.

Geoff



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

Date: 2 May 2005 15:15:51 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: file handling - a simple explanation?
Message-Id: <Xns964A685E5DE42castleamber@130.133.1.4>

Geoff Cox wrote:

> Hello,
> 
> I am getting the following error message for the last 3 files being
> processed only, and must be doing something wrong - not sure what
> though. The code works.
> 
> print() on closed filehandle OUT2 at hp3.pl line 33, <IN> line 12.
> 
> The code is

bad

>     open (IN, $name);

or die "Can't open '$name': $!";

>     open OUT, (">>hp-$name");

or die ...

>     open OUT2, (">>html/hp-index.htm");

or die ...

Also, put use strict; and use warnings; on top of your script if you 
haven't done so.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Mon, 02 May 2005 17:19:39 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: file handling - a simple explanation?
Message-Id: <3dmum2F6qremhU1@individual.net>

Geoff Cox wrote:
> Hello,
> 
> I am getting the following error message for the last 3 files being
> processed only, and must be doing something wrong - not sure what
> though. The code works.
> 
> print() on closed filehandle OUT2 at hp3.pl line 33, <IN> line 12.
> 
> The code is
> 
>     open (IN, $name);
>     open OUT, (">>hp-$name");
>     open OUT2, (">>html/hp-index.htm");

Yes, you are doing something wrong. You are not checking for success 
when opening files.

     open IN, $name or die "Couldn't open $name: $!";

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 02 May 2005 16:14:02 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: file handling - a simple explanation?
Message-Id: <s9kc71lo9n4k46tp5dmhk82sgvij1g9ns3@4ax.com>

On 2 May 2005 15:15:51 GMT, John Bokma <john@castleamber.com> wrote:

>bad
>
>>     open (IN, $name);

John,

Thanks - I added the or die etc and then found that I had one
directory which did not have the sub directory expected by the code!

I am now converted to having the or die etc,.

Cheers

Geoff





>
>or die "Can't open '$name': $!";
>
>>     open OUT, (">>hp-$name");
>
>or die ...
>
>>     open OUT2, (">>html/hp-index.htm");
>
>or die ...
>
>Also, put use strict; and use warnings; on top of your script if you 
>haven't done so.



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

Date: Mon, 02 May 2005 16:15:28 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: file handling - a simple explanation?
Message-Id: <7dkc71pp1g8epf1ed7ikcu3ed3rktakv09@4ax.com>

On Mon, 02 May 2005 17:19:39 +0200, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:

>Yes, you are doing something wrong. You are not checking for success 
>when opening files.
>
>     open IN, $name or die "Couldn't open $name: $!";

Thanks Gunnar - I corrected the code and then realised it expected a
sub directory which was not there. I am now convinced not to be lazy
re the or die!

Cheers

Geoff



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

Date: Mon, 02 May 2005 18:29:57 +0200
From: Khamis Abuelkomboz <khamis@wellcode.com>
Subject: question about namespacing in perl
Message-Id: <d55khv$tfn$02$1@news.t-online.com>

Hi

I'm trying to unterstand the namescoping of perl, I found the following example:

package B::Assembler;
 ...
sub B::Asmdata::PUT_U8 {..}

How do you define the full namespaced sub name?
Is it B::Assembler::B::Asmdata::PUT_U8 or only B::Asmdata::PUT_U8 ?
How you would call the function PUT_U8 from outside and inside this package?

I think the subs following a package definition belong to this package.

thanks
khamis

-- 
Try Code-Navigator on http://www.codenav.com
a source code navigating, analysis and developing tool.
It supports following languages:
     * C/C++
     * Java
     * .NET (including CSharp, VB.Net and other .NET components)
     * Classic Visual Basic
     * PHP, HTML, XML, ASP, CSS
     * Tcl/Tk,
     * Perl
     * Python
     * SQL,
     * m4 Preprocessor
     * Cobol


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

Date: Mon, 2 May 2005 18:44:37 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: question about namespacing in perl
Message-Id: <slrnd7cm7l.45b.tassilo.von.parseval@localhost.localdomain>

Also sprach Khamis Abuelkomboz:

> I'm trying to unterstand the namescoping of perl, I found the following example:
>
> package B::Assembler;
> ...
> sub B::Asmdata::PUT_U8 {..}

This is the function PUT_U8() living in the package (=namespace)
B::Asmdata.

> How do you define the full namespaced sub name?
> Is it B::Assembler::B::Asmdata::PUT_U8 or only B::Asmdata::PUT_U8 ?

It's the latter. Specifying namespaces can only ever happen in two ways:
Either unqualified (PUT_U8()) which will access the entry in the current
namespace (main:: if there is no explicit package-declaration) or fully
qualified (B::Asmdata::PUT_U8()) which accesses the entry in B::Asmdata
regardless of the namespace the calling code lives in.

> How you would call the function PUT_U8 from outside and inside this package?

From outside:

    B::Asmdata::PUT_U8()

From inside:

    PUT_U8() 
    # or (although unnecessarily)
    B::Asmdata::PUT_U8()

Note that giving the full name works everywhere whereas accessing an
unqualified entry only works if that entry lives in the current
namespace.

> I think the subs following a package definition belong to this package.

Yes, as long as they are not qualified. In your example above however
the package-declaration was overruled by the package-declaration in 

    sub B::Asmdata::PUT_U8 {}

Tassilo
-- 
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);


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

Date: Mon, 2 May 2005 09:33:47 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Somethign about hashes
Message-Id: <slrnd7ceib.4lk.tadmc@magna.augustmail.com>

Nikos <hackeras@gmail.com> wrote:


> span.tip {
> 	text-align: center;
>   	font: 20px comic;
> 	color: lime;
> }

> What am i doing wrong?


Posting CSS questions in a Perl newsgroup.

Please stop abusing our newsgroup.


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


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

Date: Mon, 02 May 2005 18:42:35 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: Somethign about hashes
Message-Id: <d55hp7$k8g$1@nic.grnet.gr>

Tad McClellan wrote:
> Nikos <hackeras@gmail.com> wrote:
> 
> 
> 
>>span.tip {
>>	text-align: center;
>>  	font: 20px comic;
>>	color: lime;
>>}
> 
> 
>>What am i doing wrong?
> 
> 
> 
> Posting CSS questions in a Perl newsgroup.
> 
> Please stop abusing our newsgroup.
> 
> 

They dont answer.

-- 
"Of course I cant stop you. And that would really bum me out
if that were my job. But my job isnt to stop you, its to
make it as difficult as possible, for as many as possible,
for as long as possible ."


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

Date: Mon, 2 May 2005 16:30:54 +0000 (UTC)
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Somethign about hashes
Message-Id: <Xns964A7F500723Basu1cornelledu@132.236.56.8>

Nikos <hackeras@gmail.com> wrote in news:d55hp7$k8g$1@nic.grnet.gr:

> Tad McClellan wrote:
>> Nikos <hackeras@gmail.com> wrote:
>> 
>>>span.tip {
>>>     text-align: center;
>>>       font: 20px comic;
>>>     color: lime;
>>>}
>> 
>>>What am i doing wrong?
>> 
>> Posting CSS questions in a Perl newsgroup.
>> 
>> Please stop abusing our newsgroup.
> 
> They dont answer.

You are making false statements again:

<URL: http://groups-beta.google.com/group/alt.html/browse_thread/thread/e23f2ce89b2db30d/0bd488c7cab7d760#0bd488c7cab7d760>

It seems like you got useful answers. The fact that you don't
like them, and you want others to do your work does not change
that fact.

Now, try to remember what we call people who insist on making 
false statements?

Sinan


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

Date: Mon, 2 May 2005 11:28:11 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Somethign about hashes
Message-Id: <slrnd7cl8r.59q.tadmc@magna.augustmail.com>

Nikos <hackeras@gmail.com> wrote:
> Tad McClellan wrote:
>> Nikos <hackeras@gmail.com> wrote:

>>>What am i doing wrong?
>> 
>> Posting CSS questions in a Perl newsgroup.
>> 
>> Please stop abusing our newsgroup.
>> 
> 
> They dont answer.


That's too bad, but it does not change a CSS question
into a Perl question.

PLEASE STOP ABUSING OUR NEWSGROUP!


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


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

Date: Mon, 02 May 2005 19:35:56 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: Somethign about hashes
Message-Id: <d55kta$n1e$1@nic.grnet.gr>

A. Sinan Unur wrote:
> You are making false statements again:
> 
> <URL: http://groups-beta.google.com/group/alt.html/browse_thread/thread/e23f2ce89b2db30d/0bd488c7cab7d760#0bd488c7cab7d760>
> 
> It seems like you got useful answers. The fact that you don't
> like them, and you want others to do your work does not change
> that fact.
> 
> Now, try to remember what we call people who insist on making 
> false statements?

Ah, so they did answer there.....
Thats nice to hear, iw aited 2 days but i didnt got any response and 
today morning i unsubscribed from alt.html considering that after what 
grg said they will never anser.

Now with the url you pointed to me i just saw their new responses.

Sorry about that but once again iam i am a vivtim of circumstances....


-- 
"Of course I cant stop you. And that would really bum me out
if that were my job. But my job isnt to stop you, its to
make it as difficult as possible, for as many as possible,
for as long as possible ."


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

Date: Mon, 02 May 2005 19:37:01 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: Somethign about hashes
Message-Id: <d55kv9$n1e$2@nic.grnet.gr>

Tad McClellan wrote:

> That's too bad, but it does not change a CSS question
> into a Perl question.
> 
> PLEASE STOP ABUSING OUR NEWSGROUP!

Its not completely irrelevant with Perl since it embeds the use of cgi.pm

-- 
"Of course I cant stop you. And that would really bum me out
if that were my job. But my job isnt to stop you, its to
make it as difficult as possible, for as many as possible,
for as long as possible ."


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

Date: Mon, 2 May 2005 16:53:15 +0000 (UTC)
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Somethign about hashes
Message-Id: <Xns964A8319D5906asu1cornelledu@132.236.56.8>

Nikos <hackeras@gmail.com> wrote in news:d55kv9$n1e$2@nic.grnet.gr:

> Tad McClellan wrote:
> 
>> That's too bad, but it does not change a CSS question
>> into a Perl question.
>> 
>> PLEASE STOP ABUSING OUR NEWSGROUP!
> 
> Its not completely irrelevant with Perl since it embeds the use of cgi.pm

No, it is completely irrelevant.

Sinan


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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