On 13/02/07, Igor Sutton <[EMAIL PROTECTED]> wrote:
Ana,
2007/2/13, Ana Saiz García <[EMAIL PROTECTED]>:
> Thank you all for your answers, they have been very helpful :o)
>
It would be nice if you post the solution you picked. It is useful for
another user like you to search in archives :-)
Ana,
2007/2/13, Ana Saiz García <[EMAIL PROTECTED]>:
Thank you all for your answers, they have been very helpful :o)
It would be nice if you post the solution you picked. It is useful for
another user like you to search in archives :-)
--
Igor Sutton Lopes <[EMAIL PROTECTED]>
--
To unsubscr
Thank you all for your answers, they have been very helpful :o)
Regards
Ana
--
"El más baldío de todos los días
es aquél en que no hemos reído"
(de Chamfort)
Erm. Sorry :-)
I have done everything and I don't get anything when doing $ perl
module-pluggable-sample.pm, would you know why?
First of all I made a type there. It is
$ perl module-pluggable-sample.pl
The code has an error too. New version below:
use strict;
use warnings;
package Applic
Ana Saiz García am Dienstag, 13. Februar 2007 13:02:
> On 12/02/07, D. Bolliger <[EMAIL PROTECTED]> wrote:
> > Ana Saiz García am Montag, 12. Februar 2007 22:26:
[snipp and following code stripped]
> > #!/usr/bin/perl
> >
> > # don't forget:
> > #
> > use strict;
> > use warnings;
> >
> > package
Hi again and thank you
On 13/02/07, Igor Sutton <[EMAIL PROTECTED]> wrote:
Hi Ana,
> Don't I have to put "use" and the name of packages A and B anywhere on
the
> main program?
I advice you to use Module::Pluggable for that (as I think you're
designing a pluggable system or whatever):
Yes,
Hi Ana,
Don't I have to put "use" and the name of packages A and B anywhere on the
main program?
I advice you to use Module::Pluggable for that (as I think you're
designing a pluggable system or whatever):
$ cat > module-pluggable-sample.pl
use strict;
use warnings;
package Application;
use
Hi again and thanks for your help
On 12/02/07, D. Bolliger <[EMAIL PROTECTED]> wrote:
Ana Saiz García am Montag, 12. Februar 2007 22:26:
> Hello
Hello Ana
> First of all, I apologize if this is not the right list to ask my
question,
> but as I am a perl beginner, I think it is the most suitab
On 13/02/07, Igor Sutton <[EMAIL PROTECTED]> wrote:
> Thank you for your idea, but I think this doesn't solve my problem,
because
> what I don't know a priori is the module's name (in your example, M),
not
> the function's name.
package M;
sub my_routine {
print "my_routine()\n";
}
packag
On 13/02/07, Chad Perrin <[EMAIL PROTECTED]> wrote:
> The specific module that will be used at a given moment is supposed to
be
> given by a configuration file, that's why the main program doesn't know
its
> name a priori (but it does know the name of the subroutine, that must be
the
> same for
Hi again
On 12/02/07, Igor Sutton Lopes <[EMAIL PROTECTED]> wrote:
You can use the UNIVERSAL's can() method. Assuming you have a module
called "M";
package M;
sub some_function {
print "some_function()", "\n";
}
package main;
my $function_name = "some_function";
if (my $coderef = M->can($f
Hello again and thanks for your answers
You all have been very kind with your fast answers, and I have read a lot of
good ideas. Tomorrow (I must go to bed *right* now ;o)) I will try them in
order to find which one best fits my needs.
Many thanks again.
Regards
Ana
--
"El más baldío de tod
One way to diff the same subroutine name in different modules is using full
package name.
For example,both package APACK and package BPACK have the same subroutine
"mytest()",then you can call them independently by:
APACK::mytest();
BPACK::mytest();
It wouldn't make the conflict.
Maybe I'm und
Hi Ana,
On 2007/02/12, at 21:26, Ana Saiz García wrote:
Hello
First of all, I apologize if this is not the right list to ask my
question,
but as I am a perl beginner, I think it is the most suitable list
for me :o)
So here goes my question:
I have a main program which will call a subrou
On 02/12/2007 03:26 PM, Ana Saiz García wrote:
Hello
First of all, I apologize if this is not the right list to ask my question,
but as I am a perl beginner, I think it is the most suitable list for me
:o)
So here goes my question:
I have a main program which will call a subroutine, say "S"
Ana Saiz García am Montag, 12. Februar 2007 22:26:
> Hello
Hello Ana
> First of all, I apologize if this is not the right list to ask my question,
> but as I am a perl beginner, I think it is the most suitable list for me
> :o)
>
> So here goes my question:
>
> I have a main program which will ca
On Mon, Feb 12, 2007 at 10:26:26PM +0100, Ana Saiz García wrote:
> Hello
>
> First of all, I apologize if this is not the right list to ask my question,
> but as I am a perl beginner, I think it is the most suitable list for me :o)
>
> So here goes my question:
>
> I have a main program which wi
Hello
First of all, I apologize if this is not the right list to ask my question,
but as I am a perl beginner, I think it is the most suitable list for me :o)
So here goes my question:
I have a main program which will call a subroutine, say "S", belonging to
another module. The question is that
Maybe I should tell you what fixed it:
The "param" was a string so enclosed it in single quotes.
Thanks!
-Original Message-
From: Tielman Koekemoer (TNE) [mailto:[EMAIL PROTECTED]
Sent: 06 May 2005 02:33 PM
To: [EMAIL PROTECTED]; beginners@perl.org
Subject: RE: Calling a
Thanks Prasanna, that fixed it.
-Original Message-
From: Prasanna Kothari [mailto:[EMAIL PROTECTED]
Sent: 06 May 2005 02:26 PM
To: beginners@perl.org
Cc: Tielman Koekemoer (TNE)
Subject: Re: Calling a subroutine - strict very strict
what is "param".?
If it's a variable, a
what is "param".?
If it's a variable, and not declared, qualify it using "my or local".
Else, if it's a string that you want pass to the function, use single
quotes.
-Prasanna
Tielman Koekemoer (TNE) wrote:
Hi All,
I apologise for the newbie question straight off - I don't have my
Camel book with
Hi All,
I apologise for the newbie question straight off - I don't have my
Camel book with me to consult.
Why does the following give me an error?:
--
#!/usr/bin/perl -w
#
# A script that gets a list of technologies that have events on
Display layer.
#
use strict;
sub q_db
Absolut Newbie wrote:
I have a program that generates a random number between 1 and 6. based on
the outcome I want to run a subroutine that corresponds to the result.
i.e if the result is 1 then the program should run sub F1. my question is
how can I dynamically call the subroutine.
i tried this b
Absolut Newbie wrote:
I have a program that generates a random number between 1 and 6. based on
the outcome I want to run a subroutine that corresponds to the result.
i.e if the result is 1 then the program should run sub F1. my question is
how can I dynamically call the subroutine.
i tried this bu
- Original Message -
From: Stone
To: beginners@perl.org
Sent: Tuesday, January 18, 2005 12:20 PM
Subject: Re: dynamically calling a subroutine
On Tue, 18 Jan 2005 20:05:01 +0200, Absolut Newbie
<[EMAIL PROTECTED]> wrote:
> $var1(); # this is where i
Absolut Newbie wrote:
> I have a program that generates a random number between 1 and 6.
> based on the outcome I want to run a subroutine that corresponds to
> the result. i.e if the result is 1 then the program should run sub
> F1. my question is how can I dynamically call the subroutine.
>
> i
I have a program that generates a random number between 1 and 6. based on
the outcome I want to run a subroutine that corresponds to the result.
i.e if the result is 1 then the program should run sub F1. my question is
how can I dynamically call the subroutine.
i tried this but obviously it didn't
On Tue, 18 Jan 2005 20:05:01 +0200, Absolut Newbie
<[EMAIL PROTECTED]> wrote:
> $var1(); # this is where it crashes
You're looking for the eval command, which will read a string and
evaluate the code it contains. ie:
eval ( "$var1()" );
On on the other hand, you could do this with if statement
I have a program that generates a random number between 1 and 6. based on
the outcome I want to run a subroutine that corresponds to the result.
i.e if the result is 1 then the program should run sub F1. my question is
how can I dynamically call the subroutine.
i tried this but obviously it didn't
Oops, hit send by mistake. This problem all seems to be about mistakes...
Thanks to all who replied.
> You have three different hashes in use. Look:
I did indeed have 3 hash tables... Duh (Must have been Friday afternoon).
The central problem was calling '&{${$date_format{$format}}{now}}()'
i
| PM |
| ||
|-+>
>--|
|
|
| To: [EMAIL PROTECTED]
|
| cc:
|
|
Peter,
#!/usr/bin/perl -w
use strict;
my %date_formats = (
ccyymmdd => { now => sub {
my @arr = localtime();
print 'Year ', 1900 + $arr[5] . ' Month '. sprintf("%02d",$arr[4] + 1)
. ' Day ' . sprintf("%02d",$arr[3]);
}
} );
& { $date_formats{ccyymmdd}{now} };
Same output as previous
Peter
I saw Jenda's note and I suggest the code needs simplification.
> P.S. you can see where I comment out the ccyymmdd_now function. That
> approach works, but is not what I'm shooting for.
>
> %date_formats = (
> # "ccyymmdd" => {now => \ccyymmdd_now()},
> "ccyymmdd" => {now => s
Peter Farrar wrote:
> Hi All,
>
> I swear I've called subroutines this way before, but I can't find any
> examples.
> In this case, I'm looking to build some time/date functions.
> Regardless of what the actual code is supposed to do, the calling of
> subroutines as elements of a hash is causing me
From: "John W. Krahn" <[EMAIL PROTECTED]>
> Peter Farrar wrote:
> > I swear I've called subroutines this way before, but I can't find
> > any examples. In this case, I'm looking to build some time/date
> > functions. Regardless of what the actual code is supposed to do,
> > the calling of subrouti
Peter Farrar wrote:
>
> Hi All,
>
> I swear I've called subroutines this way before, but I can't find any
> examples.
> In this case, I'm looking to build some time/date functions. Regardless of
> what the actual code is supposed to do, the calling of subroutines as
> elements of a hash is causi
Hi All,
I swear I've called subroutines this way before, but I can't find any
examples.
In this case, I'm looking to build some time/date functions. Regardless of
what the actual code is supposed to do, the calling of subroutines as
elements of a hash is causing me grief. I am receiving the foll
--- Chris Zampese <[EMAIL PROTECTED]> wrote:
> How do I call a subroutine in a cgi script. I thought that it was just
>
> subroutine_name();
>
> but that does not seem to be working for me?
>
> You guys are great. Thanks for your help (both from answering my questions, and
>from ans
How do I call a subroutine in a cgi script. I thought that it was just
subroutine_name();
but that does not seem to be working for me?
You guys are great. Thanks for your help (both from answering my questions, and from
answering other peoples!)
Chris
39 matches
Mail list logo