|
|
Up |
|
|
  |
Author: John BokmaJohn Bokma
Date: Dec 16, 2006 21:57
> thanks, john.
>
>> I would probably put [a global variable] in a module, and use that
>> module where I need to know that value.
>>
>
> in all my files and subs. that means that every module and file may
> need to import my "global variables" module in order to learn the
> directory at hand. ok, so at least my guess was correct. it does not
> seem unreasonable; I just wanted to not overlook the obvious.
Why do all your modules need to know this variable? Can't you move the
code that needs this variable (or variables) to a module of its own and
use that module? For example for one project I put the database info in a
'database' module which had a constructor that just returned a database
connection (named connect :-), and some other code that made my life a bit
easier.
[..]
|
| Show full article (1.53Kb) |
|
| |
no comments
|
|
  |
Author: jari.aaltojari.aalto
Date: Dec 16, 2006 21:41
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
Maintainer: Jari Aalto A T cante net
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs/XEmacs
o Unix:
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
o Unix Windows port (for Unix die-hards):
install http://www.cygwin.com/ which includes native Emacs 21.x.
and XEmacs port
|
| Show full article (3.79Kb) |
|
| |
no comments
|
|
  |
Author: TintinTintin
Date: Dec 16, 2006 19:54
"brian d foy" gmail.com> wrote in message
news:161220061344289408%%brian.d.foy@gmail.com...
> In article <9M-dnd3mOPNGYx_YnZ2dnUVZ_q6vnZ2d@ comcast.com>, Joe Smith
> inwap.com> wrote:
>
>
>> With all those instances of "19$year" out in the wild, I guess the FAQ
>> should be kept. The last paragraph in the FAQ could use rewriting.
>> Perhaps to add examples of actual code that does the wrong thing,
>> showing what not to do.
>
> Yes, we should rewrite it. I'll look at that after the new year.
Will that be in Jan 19107?
|
| |
|
no comments
|
|
  |
Author: Uri GuttmanUri Guttman
Date: Dec 16, 2006 18:27
>>>>> "bdf" == brian d foy gmail.com> writes:
bdf> In article <9M-dnd3mOPNGYx_YnZ2dnUVZ_q6vnZ2d@ comcast.com>, Joe Smith
bdf> inwap.com> wrote:
>> With all those instances of "19$year" out in the wild, I guess the FAQ
>> should be kept. The last paragraph in the FAQ could use rewriting.
>> Perhaps to add examples of actual code that does the wrong thing,
>> showing what not to do.
bdf> Yes, we should rewrite it. I'll look at that after the new year.
you should do it before the new year so we don't have any y2k+7 bugs!
uri
|
| |
|
no comments
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Dec 16, 2006 18:03
This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
4.39: What is the difference between a list and an array?
An array has a changeable length. A list does not. An array is something
you can push or pop, while a list is a set of values. Some people make
the distinction that a list is a value while an array is a variable.
Subroutines are passed and return lists, you put things into list
context, you initialize arrays with lists, and you "foreach()" across a
list. "@" variables are arrays, anonymous arrays are arrays, arrays in
scalar context behave like the number of elements in them, subroutines
access their arguments through the array @_, and "push"/"pop"/"shift"
only work on arrays.
As a side note, there's no such thing as a list in scalar context. When
you say
$scalar = (2, 5, 7, 9);
|
| Show full article (2.03Kb) |
|
no comments
|
|
  |
Author: ivowelivowel
Date: Dec 16, 2006 17:28
what is the perl-ish way to define a global variable that is used by
many modules (e.g., the location of all databases, or of a particular
server)? Clearly, I want to define it only once, and have it be
accessible everywhere.
my first inclination was to put it into base.pm and use the Exporter to
just export it. its a bit of a pain, especially if the program itself
calls other modules, all of which have to import the base module
themselves, too. But it is doable.
now, looking at Damien's perl6's suggested replacement for Exporter, I
did not find a way to export scalars. it just seems to export subs.
so maybe the export mechanism ain't it.
so, what is the perlish way to do this?
related question---if I want to break a program into a couple of
different files, what is the recommended way of doing this? is it
stuffing different routines into different modules? I am thinking of
something like the numerical recipees version, where I have hundreds of
subroutines. there, they put every sub into its own equal-named file.
of course, I may need 'em all in my program.
sincerely,
|
| Show full article (1.10Kb) |
|
12 Comments |
|
  |
Author: A. Sinan UnurA. Sinan Unur
Date: Dec 16, 2006 12:28
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
news:Xns989B9C4E16F8Easu1cornelledu@ 127.0.0.1:
> # Fill B2:B11 with bin range
>
> $sheet->Cells(1, 2)->{Value} = "Limits";
> for my $i ( 2 .. 11 ) {
> $sheet->Cells($i, 2)->{Value} = $i;
Ooops!
$sheet->Cells($i, 2)->{Value} = $i - 1;
> $excel->Run(qq{ATPVBAEN.XLA!Histogram},
> $sheet->Range('A1:A100'),
$sheet->Range('A1:A101'),
> 'Histogram',
> $sheet->Range('B1:B10'),
$sheet->Range('B1:B11'),
Sinan
|
| |
|
no comments
|
|
  |
Author: John BokmaJohn Bokma
Date: Dec 16, 2006 12:14
Pepetideo hotmail.com> wrote:
> Do seek professional help... I think you need it!
Diagnosing someone over the Usenet is next to impossible. And I doubt if
robic0 needs professional help. He probably is quite able to handle his
problem himself, but just decided, on purpose, to be a pain in the ass.
When he gets older, he probably will wonder for a while why he wasted so
many hours with trolling a technical group.
I guess that at an early stage he got bitch slapped a few times here, and
instead of getting over it, decided to join the "dark side". Might be very
well that all those replies he gets appear to him as a small victory over
the "good guys", while probably the majority of those who reply him get a
similar satisfaction out of bitch slapping robic0 once again. Sadly this
adds also to the noise this group has :-(
Personally I skip 99.9%% of his postings, I mean the 0 in his nick name is
significant in this case.
|
| |
|
1 Comment |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Dec 16, 2006 12:03
This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
4.19: How do I validate input?
(contributed by brian d foy)
There are many ways to ensure that values are what you expect or want to
accept. Besides the specific examples that we cover in the perlfaq, you
can also look at the modules with "Assert" and "Validate" in their
names, along with other modules such as "Regexp::Common".
Some modules have validation for particular types of input, such as
"Business::ISBN", "Business::CreditCard", "Email::Valid", and
"Data::Validate::IP".
--------------------------------------------------------------------
|
| Show full article (1.56Kb) |
|
no comments
|
|
  |
|
|
  |
Author: xhosterxhoster
Date: Dec 16, 2006 11:27
"grocery_stocker" gmail.com> wrote:
>> "grocery_stocker" gmail.com> wrote:
>>>
>>> And run the program, it hangs. Why?
>>
>> Because the sub-thread never exits. The sub-thread is supposed to exit
>> when it dequeues a false item. The main thread never enqueues this
>> false item (you commented out the line that does that) so the
>> sub-thread cannot dequeue it. The sub-thread is blocked waiting for
>> the main thread to enqueue something and the main thread is blocked
>> waiting for the sub-thread to return. Bang.
>>
>> Xho
>>
>
> Hmm..... so in other words, it's a deadlock.
|
| Show full article (1.54Kb) |
|
no comments
|
|
|
|
|
|
|