[28211] in Perl-Users-Digest
Perl-Users Digest, Issue: 9575 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 8 06:05:37 2006
Date: Tue, 8 Aug 2006 03:05:05 -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 Tue, 8 Aug 2006 Volume: 10 Number: 9575
Today's topics:
Capitalization [was: "Re: Hash in inherited object fiel <bik.mido@tiscalinet.it>
Re: geometry problem <bik.mido@tiscalinet.it>
How to get the column name in a spreadsheet app? <martinmichel@ame-electroplating.com>
Re: How to use OO and package? <bik.mido@tiscalinet.it>
Re: Perl question <mumia.w.18.spam+nospam.usenet@earthlink.net>
Posting Guidelines for comp.lang.perl.misc ($Revision: tadmc@augustmail.com
Re: Public/Private Data/Funcion in Perl OO? <jimi@webu.co.uk>
Segmentation fault (core dumped) <eliyah_kilada@yahoo.co.uk>
Re: Segmentation fault (core dumped) usenet@DavidFilmer.com
Re: Segmentation fault (core dumped) <no@email.com>
Re: Segmentation fault (core dumped) <mumia.w.18.spam+nospam.usenet@earthlink.net>
Re: Simple file list in directory to array usenet@DavidFilmer.com
Upload a file on server pjsenthil@gmail.com
Re: What bless() do actually? <jimi@webu.co.uk>
Re: What bless() do actually? anno4000@radom.zrz.tu-berlin.de
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Aug 2006 10:28:02 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Capitalization [was: "Re: Hash in inherited object fields not properly accessible (5.8.6, RH 7.3)"]
Message-Id: <a0hgd25g0r29ak85nsfbq4qebnot0lhfef@4ax.com>
On Sat, 05 Aug 2006 22:28:45 -0400, Uri Guttman <uri@stemsystems.com>
wrote:
>i would call that a bug in data::dumper and you should post that to p5p
>(use perlbug). glad you figured it out.
I understand that it's just an informal use of yours, and one that
probably speeds up your typing, but writing all lowercase like that,
up to and including module names is risky. Personally I find it
annoying per se, (not to the extremes of but) along the lines of
"n00bz" who "need 4 ur help URGENTLY" all the time. However I can live
with that: as hinted above things can become qualitatively and
significantly more serious when it begins to affect stuff like module
names. In this particular case it is evident that you're referring to
Data::Dumper, but there may be other ones in which the capitalization
may not be that obvious and anyway we insist all the time that
capitalization does matter, which may be particularly important to
newbies working on case insensitive osen, while your toy use may
convey the impression to them that it's not relevant at all.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 8 Aug 2006 09:49:59 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: geometry problem
Message-Id: <qcggd29i46i37b403m9nlk488ggb95pr87@4ax.com>
On 7 Aug 2006 17:22:15 -0700, "IcyMint" <carlston88@gmail.com> wrote:
>Subject: geometry problem
Then Newsgroups: sci.math would be better fit. And that is a "hard"
problem. Once you come up with an algorithm, you may have an actual
Perl question. :-)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 8 Aug 2006 02:51:22 -0700
From: "Martin M." <martinmichel@ame-electroplating.com>
Subject: How to get the column name in a spreadsheet app?
Message-Id: <1155030682.257051.302380@75g2000cwc.googlegroups.com>
Hi everybody,
I am currently developing a small AppleScript, which will help our
staff to automate tasks in our spreadsheet app (RagTime 6). But now I
am at a point, where I need a function in my AppleScript to determine
the name of a column name in a table. Here is an example, just to give
you an idea:
Position: 5 -> Column name: "E"
Position: 28 -> Column name: "AB"
Now, I found a Perl module, which does exactly this: Converting number
positions into column names, but...I am not (yet) familiar with Perl.
So I would like you to tell me, what this code is doing, enabling me to
use it in my AppleScript:
[Code from: http://search.cpan.org/perldoc?Spreadsheet%3A%3AConvertAA ]
_______________________________
sub ToAA($)
{
my $c = shift ;
confess "Invalid base10 '$c'" if($c =~ /[^0-9]/) ;
return('@') if $c == 0 ;
my $cell = "";
while($c)
{
use integer;
substr ($cell, 0, 0) = chr (--$c % 26 + ord "A");
$c /= 26;
}
return($cell) ;
}
_______________________________
Thanks so much in advance!
Best regards,
Martin
http://www.schoolscout24.de/wordpress-files/welistento.html
------------------------------
Date: 8 Aug 2006 09:40:54 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to use OO and package?
Message-Id: <ntfgd2ta2pr30fgqu862spoualb97shgn8@4ax.com>
On 7 Aug 2006 22:29:23 -0700, "Davy" <zhushenli@gmail.com> wrote:
>Hi Michele,
>
>I am sorry, but what's top-post mean? Thanks!
>
>Davy
>
>Michele Dondi wrote:
>> On 7 Aug 2006 03:44:18 -0700, "Davy" <zhushenli@gmail.com> wrote:
[snip]
Exactly this: putting your text on *top* of the quoted content. You'd
better trim the latter and put your remarks after each relevant
portion of it.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Tue, 08 Aug 2006 08:07:23 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Perl question
Message-Id: <%CXBg.1064$Sn3.772@newsread3.news.pas.earthlink.net>
On 08/07/2006 05:49 PM, sibijohn@gmail.com wrote:
> I have a file name result01182006.xml which is named according to the
> date. I know how to split it to get the values
>
> $a = "result01182006.xml";
> $a =~ /^(result)(\d{2})(\d{2})(\d{4})/;
> print "$1 $2 $3 $4\n";
>
> In the contents of this file i I need to replace every instance of
> 1/7/2006 to 01/18/2006.
>
Please don't multi-post; crosspost instead. Read and follow
the posting guidelines for comp.lang.perl.misc:
http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
"Result01182006.xml" is the file's name--not its contents. Are
you sure you want to change the contents?
> Change the date of "Sat 07 Jan 2006" to corresponding day which
> 01/18/2006 falls on, so it should be changed to "Wed 18 Jan 2006
>
> and change the string result01072006 to result01182006
>
Please re-write this statement; it's not parse-able English.
> Please can somebody help here.. Working on no sleep whatsover in 24
> hrs.
>
> Sibi
>
It's important that you read the documentation for the
localtime command:
perldoc -f localtime
------------------------------
Date: 08 Aug 2006 07:22:15 GMT
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
Message-Id: <44d83ba6$0$57728$ae4e5890@news.nationwide.net>
Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information
- Do not provide too much information
- Do not post binaries, HTML, or MIME
Social faux pas to avoid
- Asking a Frequently Asked Question
- Asking a question easily answered by a cursory doc search
- Asking for emailed answers
- Beware of saying "doesn't work"
- Sending a "stealth" Cc copy
Be extra cautious when you get upset
- Count to ten before composing a followup when you are upset
- Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------
Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
This newsgroup, commonly called clpmisc, is a technical newsgroup
intended to be used for discussion of Perl related issues (except job
postings), whether it be comments or questions.
As you would expect, clpmisc discussions are usually very technical in
nature and there are conventions for conduct in technical newsgroups
going somewhat beyond those in non-technical newsgroups.
The article at:
http://www.catb.org/~esr/faqs/smart-questions.html
describes how to get answers from technical people in general.
This article describes things that you should, and should not, do to
increase your chances of getting an answer to your Perl question. It is
available in POD, HTML and plain text formats at:
http://www.augustmail.com/~tadmc/clpmisc.shtml
For more information about netiquette in general, see the "Netiquette
Guidelines" at:
http://andrew2.andrew.cmu.edu/rfc/rfc1855.html
A note to newsgroup "regulars":
Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume
A note about technical terms used here:
In this document, we use words like "must" and "should" as
they're used in technical conversation (such as you will
encounter in this newsgroup). When we say that you *must* do
something, we mean that if you don't do that something, then
it's unlikely that you will benefit much from this group.
We're not bossing you around; we're making the point without
lots of words.
Do *NOT* send email to the maintainer of these guidelines. It will be
discarded unread. The guidelines belong to the newsgroup so all
discussion should appear in the newsgroup. I am just the secretary that
writes down the consensus of the group.
Before posting to comp.lang.perl.misc
Must
This section describes things that you *must* do before posting to
clpmisc, in order to maximize your chances of getting meaningful replies
to your inquiry and to avoid getting flamed for being lazy and trying to
have others do your work.
The perl distribution includes documentation that is copied to your hard
drive when you install perl. Also installed is a program for looking
things up in that (and other) documentation named 'perldoc'.
You should either find out where the docs got installed on your system,
or use perldoc to find them for you. Type "perldoc perldoc" to learn how
to use perldoc itself. Type "perldoc perl" to start reading Perl's
standard documentation.
Check the Perl Frequently Asked Questions (FAQ)
Checking the FAQ before posting is required in Big 8 newsgroups in
general, there is nothing clpmisc-specific about this requirement.
You are expected to do this in nearly all newsgroups.
You can use the "-q" switch with perldoc to do a word search of the
questions in the Perl FAQs.
Check the other standard Perl docs (*.pod)
The perl distribution comes with much more documentation than is
available for most other newsgroups, so in clpmisc you should also
see if you can find an answer in the other (non-FAQ) standard docs
before posting.
It is *not* required, or even expected, that you actually *read* all of
Perl's standard docs, only that you spend a few minutes searching them
before posting.
Try doing a word-search in the standard docs for some words/phrases
taken from your problem statement or from your very carefully worded
"Subject:" header.
Really Really Should
This section describes things that you *really should* do before posting
to clpmisc.
Lurk for a while before posting
This is very important and expected in all newsgroups. Lurking means
to monitor a newsgroup for a period to become familiar with local
customs. Each newsgroup has specific customs and rituals. Knowing
these before you participate will help avoid embarrassing social
situations. Consider yourself to be a foreigner at first!
Search a Usenet archive
There are tens of thousands of Perl programmers. It is very likely
that your question has already been asked (and answered). See if you
can find where it has already been answered.
One such searchable archive is:
http://groups.google.com/advanced_group_search
If You Like
This section describes things that you *can* do before posting to
clpmisc.
Check Other Resources
You may want to check in books or on web sites to see if you can
find the answer to your question.
But you need to consider the source of such information: there are a
lot of very poor Perl books and web sites, and several good ones
too, of course.
Posting to comp.lang.perl.misc
There can be 200 messages in clpmisc in a single day. Nobody is going to
read every article. They must decide somehow which articles they are
going to read, and which they will skip.
Your post is in competition with 199 other posts. You need to "win"
before a person who can help you will even read your question.
These sections describe how you can help keep your article from being
one of the "skipped" ones.
Is there a better place to ask your question?
Question should be about Perl, not about the application area
It can be difficult to separate out where your problem really is,
but you should make a conscious effort to post to the most
applicable newsgroup. That is, after all, where you are the most
likely to find the people who know how to answer your question.
Being able to "partition" a problem is an essential skill for
effectively troubleshooting programming problems. If you don't get
that right, you end up looking for answers in the wrong places.
It should be understood that you may not know that the root of your
problem is not Perl-related (the two most frequent ones are CGI and
Operating System related), so off-topic postings will happen from
time to time. Be gracious when someone helps you find a better place
to ask your question by pointing you to a more applicable newsgroup.
How to participate (post) in the clpmisc community
Carefully choose the contents of your Subject header
You have 40 precious characters of Subject to win out and be one of
the posts that gets read. Don't waste them. Take care while
composing them, they are the key that opens the door to getting an
answer.
Spend them indicating what aspect of Perl others will find if they
should decide to read your article.
Do not spend them indicating "experience level" (guru, newbie...).
Do not spend them pleading (please read, urgent, help!...).
Do not spend them on non-Subjects (Perl question, one-word
Subject...)
For more information on choosing a Subject see "Choosing Good
Subject Lines":
http://www.cpan.org/authors/id/D/DM/DMR/subjects.post
Part of the beauty of newsgroup dynamics, is that you can contribute
to the community with your very first post! If your choice of
Subject leads a fellow Perler to find the thread you are starting,
then even asking a question helps us all.
Use an effective followup style
When composing a followup, quote only enough text to establish the
context for the comments that you will add. Always indicate who
wrote the quoted material. Never quote an entire article. Never
quote a .signature (unless that is what you are commenting on).
Intersperse your comments *following* each section of quoted text to
which they relate. Unappreciated followup styles are referred to as
"top-posting", "Jeopardy" (because the answer comes before the
question), or "TOFU" (Text Over, Fullquote Under).
Reversing the chronology of the dialog makes it much harder to
understand (some folks won't even read it if written in that style).
For more information on quoting style, see:
http://web.presby.edu/~nnqadmin/nnq/nquote.html
Speak Perl rather than English, when possible
Perl is much more precise than natural language. Saying it in Perl
instead will avoid misunderstanding your question or problem.
Do not say: I have variable with "foo\tbar" in it.
Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
or I have $var = <DATA> (and show the data line).
Ask perl to help you
You can ask perl itself to help you find common programming mistakes
by doing two things: enable warnings (perldoc warnings) and enable
"strict"ures (perldoc strict).
You should not bother the hundreds/thousands of readers of the
newsgroup without first seeing if a machine can help you find your
problem. It is demeaning to be asked to do the work of a machine. It
will annoy the readers of your article.
You can look up any of the messages that perl might issue to find
out what the message means and how to resolve the potential mistake
(perldoc perldiag). If you would like perl to look them up for you,
you can put "use diagnostics;" near the top of your program.
Do not re-type Perl code
Use copy/paste or your editor's "import" function rather than
attempting to type in your code. If you make a typo you will get
followups about your typos instead of about the question you are
trying to get answered.
Provide enough information
If you do the things in this item, you will have an Extremely Good
chance of getting people to try and help you with your problem!
These features are a really big bonus toward your question winning
out over all of the other posts that you are competing with.
First make a short (less than 20-30 lines) and *complete* program
that illustrates the problem you are having. People should be able
to run your program by copy/pasting the code from your article. (You
will find that doing this step very often reveals your problem
directly. Leading to an answer much more quickly and reliably than
posting to Usenet.)
Describe *precisely* the input to your program. Also provide example
input data for your program. If you need to show file input, use the
__DATA__ token (perldata.pod) to provide the file contents inside of
your Perl program.
Show the output (including the verbatim text of any messages) of
your program.
Describe how you want the output to be different from what you are
getting.
If you have no idea at all of how to code up your situation, be sure
to at least describe the 2 things that you *do* know: input and
desired output.
Do not provide too much information
Do not just post your entire program for debugging. Most especially
do not post someone *else's* entire program.
Do not post binaries, HTML, or MIME
clpmisc is a text only newsgroup. If you have images or binaries
that explain your question, put them in a publically accessible
place (like a Web server) and provide a pointer to that location. If
you include code, cut and paste it directly in the message body.
Don't attach anything to the message. Don't post vcards or HTML.
Many people (and even some Usenet servers) will automatically filter
out such messages. Many people will not be able to easily read your
post. Plain text is something everyone can read.
Social faux pas to avoid
The first two below are symptoms of lots of FAQ asking here in clpmisc.
It happens so often that folks will assume that it is happening yet
again. If you have looked but not found, or found but didn't understand
the docs, say so in your article.
Asking a Frequently Asked Question
It should be understood that you may have missed the applicable FAQ
when you checked, which is not a big deal. But if the Frequently
Asked Question is worded similar to your question, folks will assume
that you did not look at all. Don't become indignant at pointers to
the FAQ, particularly if it solves your problem.
Asking a question easily answered by a cursory doc search
If folks think you have not even tried the obvious step of reading
the docs applicable to your problem, they are likely to become
annoyed.
If you are flamed for not checking when you *did* check, then just
shrug it off (and take the answer that you got).
Asking for emailed answers
Emailed answers benefit one person. Posted answers benefit the
entire community. If folks can take the time to answer your
question, then you can take the time to go get the answer in the
same place where you asked the question.
It is OK to ask for a *copy* of the answer to be emailed, but many
will ignore such requests anyway. If you munge your address, you
should never expect (or ask) to get email in response to a Usenet
post.
Ask the question here, get the answer here (maybe).
Beware of saying "doesn't work"
This is a "red flag" phrase. If you find yourself writing that,
pause and see if you can't describe what is not working without
saying "doesn't work". That is, describe how it is not what you
want.
Sending a "stealth" Cc copy
A "stealth Cc" is when you both email and post a reply without
indicating *in the body* that you are doing so.
Be extra cautious when you get upset
Count to ten before composing a followup when you are upset
This is recommended in all Usenet newsgroups. Here in clpmisc, most
flaming sub-threads are not about any feature of Perl at all! They
are most often for what was seen as a breach of netiquette. If you
have lurked for a bit, then you will know what is expected and won't
make such posts in the first place.
But if you get upset, wait a while before writing your followup. I
recommend waiting at least 30 minutes.
Count to ten after composing and before posting when you are upset
After you have written your followup, wait *another* 30 minutes
before committing yourself by posting it. You cannot take it back
once it has been said.
AUTHOR
Tad McClellan <tadmc@augustmail.com> and many others on the
comp.lang.perl.misc newsgroup.
------------------------------
Date: Tue, 08 Aug 2006 09:23:06 GMT
From: Jimi-Carlo Bukowski-Wills <jimi@webu.co.uk>
Subject: Re: Public/Private Data/Funcion in Perl OO?
Message-Id: <pan.2006.08.08.09.23.10.433622@webu.co.uk>
Hi,
I have a book called "Writing Perl Modules for CPAN" and it's my favourite
book ever! See if you can get a copy. In it is detailed a way to make
something private and enforcing it by using an anonymous sub.
This book will probably introduce you to Perl from the right direction,
since it makes sense for you to find out what Perl does and doesn't do in
comparison to C++ as soon as possible.
Anyway, the solution is you have your new sub return an anonymous sub that
then sets up the internal data using the my keyword... spot the problem
here??? Yes! Suddenly EVERYTHING is private (well, all of the variables
anyway) so that you need accessors/mutators for everything... which are
difficult to roll automatically in this case.
I guess the short answer is: it's possible, but don't bother!
J
Reference:
Sam Tregar, Writing Perl Modules for CPAN, Apress/Springer NY 2002
(Try www.apress.com or www.springer-ny.com)
On Mon, 07 Aug 2006 10:50:34 +0000, anno4000 wrote:
> Davy <zhushenli@gmail.com> wrote in comp.lang.perl.misc:
>> Hi all,
>>
>> I am a C++ programmer and new to Perl.
>> Is there some equal idea like Public/Private Data/Funcion in Perl OO?
>> I found the tutorial provided by Perldoc show all the Data is public??
>
> Right about methods (and subs in general). There is only the convention
> to let the names of private methods begin with an underscore (_private).
> That doesn't stop anyone from using them, but at least they'll know they
> are doing something wrong.
>
> Data stored in lexical variables are inaccessible from outside their scope
> so they are truly private. This is not true for package variables.
>
> Anno
------------------------------
Date: 8 Aug 2006 01:18:43 -0700
From: "ekilada" <eliyah_kilada@yahoo.co.uk>
Subject: Segmentation fault (core dumped)
Message-Id: <1155025123.393207.142920@i42g2000cwa.googlegroups.com>
Hi,
Using Perl, when I try to open a 1.8G file for reading, I get a
'Segmentation fault (core dumped)' error.
Please, is there any way to segment huge files for reading ?
Thanks And Best Regards,
Eliyah
------------------------------
Date: 8 Aug 2006 01:31:26 -0700
From: usenet@DavidFilmer.com
Subject: Re: Segmentation fault (core dumped)
Message-Id: <1155025886.492418.148160@p79g2000cwp.googlegroups.com>
ekilada wrote:
> Using Perl, when I try to open a 1.8G file for reading, I get a
> 'Segmentation fault (core dumped)' error.
Oops. You have an error on line 42. You need to fix that.
> Please, is there any way to segment huge files for reading ?
perldoc perlop (/while)
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Tue, 08 Aug 2006 09:35:46 +0100
From: Brian Wakem <no@email.com>
Subject: Re: Segmentation fault (core dumped)
Message-Id: <4jr0muF9ac1fU1@individual.net>
ekilada wrote:
> Hi,
> Using Perl, when I try to open a 1.8G file for reading, I get a
> 'Segmentation fault (core dumped)' error.
> Please, is there any way to segment huge files for reading ?
If the error occurs when *opening* the file then the filesize is irrelevant.
--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
------------------------------
Date: Tue, 08 Aug 2006 09:58:51 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Segmentation fault (core dumped)
Message-Id: <vfZBg.6044$0e5.1776@newsread4.news.pas.earthlink.net>
On 08/08/2006 03:18 AM, ekilada wrote:
> Hi,
> Using Perl, when I try to open a 1.8G file for reading, I get a
> 'Segmentation fault (core dumped)' error.
> Please, is there any way to segment huge files for reading ?
>
Yes, read it in line by line using the "while(<FH>) { ... }"
syntax.
> Thanks And Best Regards,
> Eliyah
>
You're welcome.
------------------------------
Date: 8 Aug 2006 00:47:19 -0700
From: usenet@DavidFilmer.com
Subject: Re: Simple file list in directory to array
Message-Id: <1155023239.620102.294040@b28g2000cwb.googlegroups.com>
A. Sinan Unur wrote:
> In both cases, processing won't begin until the list has been
> constructed.
Of course this is true (for this example). The difference is whether or
not you create an unnecessary named element in your namespace. Not
doing so reduces the chance of typos (which, granted, strict() should
detect) or logic errors, such as improperly scoped but identically
named structures (such as the ever ubiquitous @data) which strict()
won't detect.
Sometimes programming clarity compels us to create redundant named data
structures. But I prefer to avoid these whenever possible. It is
certinally not necessary to create such a redundant named structure in
the example I cited, and is contrary to conventional Perl programming
practice (which prefers "while (<DATA>)" to "for (@DATA)").
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 8 Aug 2006 02:20:51 -0700
From: pjsenthil@gmail.com
Subject: Upload a file on server
Message-Id: <1155028851.231766.113310@m79g2000cwm.googlegroups.com>
Hi
I have to upload a file on to a server.I have tried it.
In my form of an HTML page, if i have a input file type ( file browse
element) it is working properly.and i am able to upload.
But in my case.I have so many images .i will list in the the browser
with check box for each and image preview for each.The user will check
the multiple check boxs and will upload.
if i am trying out this. i am not able to upload the file on the
server.
the problem wat i am facing is,...
the below is partial code...
-------------------------------------------------------
if($type_ok){
if(!$overwrite){ # if $overwite = 0 or flase, rename file using the
checkex sub
$fileName = check_existence($destination,$fileName);
}
# create a new file on the server using the formatted ( new instance
) filename
$r[$cnt]=$file;
$cnt++;
if(open(NEW, ">$destination$S{S}$fileName")){
$VAR{err} .= $!;
if($isWIN){ binmode NEW; } else { chmod(0777,
"$destination$S{S}$fileName"); }
# start reading users HD 1 kb at a time.
%note if the data from file browse it is working well..
but in case of check box .then the below read function is not working..
i have checked that $file value...it is getting the path of the source
perfectly.
****the problem is it not going into the while loop %
while(read($file, $buffer, 1024))
{
print NEW $e;
}
# close the new file on the server and we're done
close NEW;
} else {
# return the server's error message if the new file could not be
created
return qq~Error: Could not open new file on server. $!~;
}
# check limit hasn't just been overshot
if(-s "$destination$S{S}$fileName" > $limit){ # -s is the file size
unlink("$destination$S{S}$fileName"); # delete it if it's over the
specified limit
return qq~File exceeded limitations : $fileName~;
}
} else {
return qq~Bad file type : $file_type~;
}
if(-s "$destination$S{S}$fileName"){
return qq~Success $fileName~; #success
} else {
unlink("$destination$S{S}$fileName");
return ; qq~Upload failed : No data in $fileName. No size on server's
copy of file.
Check the path entered. $VAR{err}~;
}
-------------------------------------------
i have written the comments with in the code above..as (%-------%).
So can one suggest me wat problem it can be,.
pl
------------------------------
Date: Tue, 08 Aug 2006 09:25:40 GMT
From: Jimi-Carlo Bukowski-Wills <jimi@webu.co.uk>
Subject: Re: What bless() do actually?
Message-Id: <pan.2006.08.08.09.25.45.293445@webu.co.uk>
You might do well to remember that classes are cleverly emulated in Perl
but don't actually exist (although I heard they might be available in a
later version)
On Mon, 07 Aug 2006 02:53:03 -0700, Davy wrote:
> Hi all,
>
> I am new to Perl OO.
>
> I found I have to bless($self) in new subroutine. If not do that, there
> is a error: "can't call method on unblessed methods".
>
> I guess if it is before bless($self), only private data pointer to
> $self; and after bless($self), method pointer to $self. Is it right? If
> not, please give me some intuitive explaination on bless, thanks!
>
> Davy
------------------------------
Date: 8 Aug 2006 09:34:56 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: What bless() do actually?
Message-Id: <4jr460F987o8U1@news.dfncis.de>
Jimi-Carlo Bukowski-Wills <jimi@webu.co.uk> wrote in comp.lang.perl.misc:
[please don't top-post. reply moved]
> On Mon, 07 Aug 2006 02:53:03 -0700, Davy wrote:
>
> > Hi all,
> >
> > I am new to Perl OO.
> >
> > I found I have to bless($self) in new subroutine. If not do that, there
> > is a error: "can't call method on unblessed methods".
> >
> > I guess if it is before bless($self), only private data pointer to
> > $self; and after bless($self), method pointer to $self. Is it right? If
> > not, please give me some intuitive explaination on bless, thanks!
> You might do well to remember that classes are cleverly emulated in Perl
> but don't actually exist (although I heard they might be available in a
> later version)
What do you mean by that?
A Perl class is a (special case of a) package. A package is a (special
case of a) hash. In what sense does the class not exist?
Anno
------------------------------
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 9575
***************************************