Hi
At 12:16 PM 4/27/2001 -0400, David H. Adler wrote:
>On Thu, Apr 26, 2001 at 06:43:37PM -0500, Arante, Susan wrote:
> > This used to be working but after my very adventurous fiasco (deleting
> > perl5, installing perl6, deleting perl6, installing perl5 - yes i deleted
> > not uninstalled), it's
--- "Morse, Loretta" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Does anybody know how to call a subroutine that is in a .pm file from
> another .pm file.
Given A.pm
===
package A;
sub a { return "a!\n"; }
1;
===
and B.pm
===
package B;
use A;
sub b { print A::a(); }
1;
===
Johnathan Kupferer ([EMAIL PROTECTED]) wrote:
> Camel Book, page 851:
...
> This will do just what you want. By the way, to anyone who will listen:
> Get the Camel Book, "Programming Perl 3rd ed." published by O'Reilly.
> If you are serious about Perl, get it and read it. You'd be surprised
On Fri, 27 Apr 2001, Johnathan Kupferer wrote:
> This will do just what you want. By the way, to anyone who will listen:
> Get the Camel Book, "Programming Perl 3rd ed." published by O'Reilly.
> If you are serious about Perl, get it and read it. You'd be surprised
> how many of the question
Try throwing this into file2.pm:
sub AUTOLOAD {
print "What hath god wrought?\n"
}
And then call:
file2->any_function_name;
That is if you have a:
use file2;
AUTOLOAD is a catch all function, method really, but this should work
considering how Perl blurs the line b
--- Johnathan Kupferer <[EMAIL PROTECTED]> wrote:
> . . .
> Oh, and just to raise some hell: if you're new to Perl, you may also
> want to look at Python. I don't know which language I would recomend
> more...
I recommend Perl to gearheads and programmers looking for a new tool.
For rank begi
Morse, Loretta ([EMAIL PROTECTED]) wrote:
> Thanks for the suggestions however I think I need to clarify
> what I'm trying to do.
>
> I am using a WinNT system and I'm running a script that calls
> a subroutine in file1.pm. Then file1.pm calls a subroutine
> from file2.pm. The script can't seem
you might consider using the Package pragma:
(File1.pm)
use strict;
Package File1;
sub foo {
print("Foo!\n");
}
(end File1.pm)
(File2.pm)
use strict;
Package File2;
use File1;
sub foo {
print "File1::foo() -> ";
File1::foo();
}
(end File2.pm)
(file main.pl)
#!/usr/bin/perl -w
use st
Camel Book, page 851:
One solution for this is to use the standard FindBin module:
use FindBin;
use lib $FindBin::Bin;
This will do just what you want. By the way, to anyone who will listen:
Get the Camel Book, "Programming Perl 3rd ed." published by O'Reilly.
If you are serious abo
: I am using a WinNT system and I'm running a script that calls
: a subroutine in file1.pm. Then file1.pm calls a subroutine
: from file2.pm. The script can't seem to find the subroutine
: that in is in file2.pm.
Does your file1.pm have "use file2" in it?
-- tdk
Thanks for the suggestions however I think I need to clarify
what I'm trying to do.
I am using a WinNT system and I'm running a script that calls
a subroutine in file1.pm. Then file1.pm calls a subroutine
from file2.pm. The script can't seem to find the subroutine
that in is in file2.pm.
Neithe
Craig Moynes/Markham/IBM ([EMAIL PROTECTED]) wrote:
> I cannot use a fixed library path as the script will be installed in
> different directories on different systems.
>
> the idea is it will be executed as:
> /home/dbncc/perl/scripts/.pl
>
> and the library will also be located in the same
I cannot use a fixed library path as the script will be installed in
different directories on different systems.
the idea is it will be executed as:
/home/dbncc/perl/scripts/.pl
and the library will also be located in the same directory.
-
Craig Moyne
: but I am having trouble stripping $0 of the perl script name.
The standard File::Basename module has a dirname() function
that will do that for you.
Alternatively, you can say something like this in your perl script:
use lib '/path/to/your/module/file.pm';
-- tdk
Hi all,
I am executing a perl script from a directory other than the one it is
located in. I have a package that the script is using located in the same
directory as the script, but the script cannot find this package because
the package is not in the include directory. I need a way to incl
>
> #!/usr/local/bin/perl
> use strict ;
> my $ucmvob = "/ebppvobstore/vobs/UCMCQ" ;
> my $PR_NAME = ;
> my $vobname = `cleartool lsproject -invob $ucmvob | grep $PR_NAME` ;
> my @prjname = split /\s+/, $vobname ;
> my $prjstream = `cleartool lsstream -in @prjname[1]\@$ucmvob | grep Int` ;
Did
Morse, Loretta ([EMAIL PROTECTED]) wrote:
>
> Hello,
>
> Does anybody know how to call a subroutine that is in a .pm file from
> another .pm file.
That depends:
First you have to load the file via 'require' or 'use' - perldoc them.
If your other .pm creates its own namespace, you need to addre
>Does anybody know how to call a subroutine that is in a .pm file from
>another .pm file.
Welp, if &subroutine_1 is in Library1.pm,
then within Library2.pm, you could do something like:
sub subroutine_2 {
require "/path/to/Library1.pm";
&subroutine_1;
}
Morbus Iff
.sig on other
All,
I am writing a small perl script which is included below. I 've a problem
with this line
my $prjstream = `cleartool lsstream -in @prjname[1]\@$ucmvob | grep Int` ;
It doesn't recognise $ucmvob in this command.
But if I replace the variable $ucmvob with the string "/ebppvobstore/vobs
Hello,
Does anybody know how to call a subroutine that is in a .pm file from
another .pm file.
: Ah, a Heisenbug. There's a problem with your benchmarking:
Yep, you're right. map is slightly slower when it actually has
something to do. I stand corrected... again.
So the moral of the story is: If you want your code
to run really fast, make it do nothing. ;)
That's what I love about Per
Timothy Kimball ([EMAIL PROTECTED]) wrote:
>
> : Because someone (and with apologies to all, I don't recall off the top
> : of my head who)correctly pointed out to me earlier in this thread that
> : using map() here was inefficient. map() builds and returns an array, so
> : there's no point in us
On Fri, Apr 27, 2001 at 09:25:33AM -0700, Paul wrote:
>
> --- "David H. Adler" <[EMAIL PROTECTED]> wrote:
> > On Thu, Apr 26, 2001 at 06:43:37PM -0500, Arante, Susan wrote:
> > > This used to be working but after my very adventurous fiasco
> > > (deleting perl5, installing perl6, deleting perl6,
--- "David H. Adler" <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 26, 2001 at 06:43:37PM -0500, Arante, Susan wrote:
> > This used to be working but after my very adventurous fiasco
> > (deleting perl5, installing perl6, deleting perl6, installing perl5
> > - yes i deleted not uninstalled), it's not
On Thu, Apr 26, 2001 at 06:43:37PM -0500, Arante, Susan wrote:
> This used to be working but after my very adventurous fiasco (deleting
> perl5, installing perl6, deleting perl6, installing perl5 - yes i deleted
> not uninstalled), it's not working anymore. I'm running perl5 on NT.
Given that th
At 06:11 AM 4/27/2001, you wrote:
>Hi,
Hello there. : )
>I have managed to get a blob(a jpeg file) from a local file on the
>linux box into the database, but I can't seem to get the thing back
>out and onto a webpage! I have scanned numerous lists and books,
>but seem to be unable to find any re
Billy,
I do a lot of Perl on an NT box that eventually gets used in both NT and
Debian. It was pretty frustrating at first, experiencing your problem. A
nice little one-liner that I use after taking a script from NT to a linux
system is:
perl -w -i -p -e "s/\x0d//g" filename
Stephen Neu
Inter
: Because someone (and with apologies to all, I don't recall off the top
: of my head who)correctly pointed out to me earlier in this thread that
: using map() here was inefficient. map() builds and returns an array, so
: there's no point in using it in this void context. Aside from that,
: both
--- Bill Lawry <[EMAIL PROTECTED]> wrote:
> Neato & thanks.
>
> I don't understand why one solution uses map & count and the other
> just uses count. Is map implied in the second solution?
Because someone (and with apologies to all, I don't recall off the top
of my head who)correctly pointed ou
--- "Arante, Susan" <[EMAIL PROTECTED]> wrote:
> This used to be working but after my very adventurous fiasco
> (deleting perl5, installing perl6, deleting perl6, installing perl5 -
> yes i deleted not uninstalled), it's not working anymore. I'm
running
> perl5 on NT.
I'd try installing Perl5,
Some of you may be interested in Komodo...
http://www.activestate.com/ASPN/
It's a GUI IDE for Perl (and Python and other unmentionables :). The
"Visible Regex" stuff is pretty cool for playing around. You have to join
ActiveState Programmers Network (ASPN), but it's free, and comes with a fre
Neato & thanks.
I don't understand why one solution uses map & count and the other just uses
count. Is map implied in the second solution?
- Original Message -
From: "Paul" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Bill Lawry" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursda
: Global symbol "$fh" requires explicit package name at
: livonia.pl line 22.
: Execution of livonia.pl aborted due to compilation errors.
You have "use strict" turned on, so put "my" in front of $fh in line
22. to give it scope. "strict" would rather you didn't use globals.
: Also can some one
$fh = newopen("$datafile");
It looks like this line needs a 'my'
-Original Message-
From: Phillip Bruce [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 27, 2001 7:47 AM
To: perl
Subject: Error
Hi,
I'm getting the following errror:
Global symbol "$fh" requires explicit package name
Hi,
I'm getting the following errror:
Global symbol "$fh" requires explicit package name at
livonia.pl line 22.
Execution of livonia.pl aborted due to compilation errors.
Also can some one suggest a better way to handle the IO I'm
wondering about
the globtype and that is why I used the \*FH in
Others have given you some good stuff about deleting from the array, but
what about if you try a different approach and filter the files as you add
them to the array?
#!/usr/local/bin/perl
$file = 'flashimage.txt'; # file name
@lines = ();# init empty array
open(INFO, $file) or
: You are making the RE engine do a log of work there.
You're right, your way is better. I tend to write code that is
clear to the way I think and then optimize it later (usually
with a profiler). Should get more in the habit of "use re 'debug'".
-- tdk
On Fri, Apr 27, 2001 at 08:32:21AM -0400, Timothy Kimball ([EMAIL PROTECTED]) spew-ed
forth:
>
> grep() will do it easily:
>
> @lines = grep { ! /\.txt$|\.scc$/ } @lines;
>
> or do it when you read the file:
>
> @lines = grep { ! /\.txt$|\.scc$/ } ;
You are making the RE engine do a log of w
Hi,
I know you can run C programs from perl. I know you can run
perl programs from C. My question is, is there a perl script (or any
software)
that is able to convert perl regex into valid C code ?
Perl is wonderful for matching expression, some software I have to
deal
with in C
Billy,
I do a lot of Perl on an NT box that eventually gets used in both NT and
Debian. It was pretty frustrating at first, experiencing your problem. A
nice little one-liner that I use after taking a script from NT to a linux
system is:
perl -w -i -p -e "s/\x0d//g" filename
Stephen Neu
Inter
Hi Kaustav,
You can do something such as:
#!/usr/bin/perl -w
use strict;
my $file = "foo.file";
open(FILE, $file) or die "Can't open $file: $!";
my @lines= ;
close FILE;
@lines = grep {!/\.(txt|scc)$/} @lines;
print qq{$_\n} for @lines;
This isn't "deleting" from the array, rather reformin
: Am rather a beginner at perl and was wondering how to do the following. I've
: read in a text file containing a list of file paths. the list is read in to
: an array. I want to scan through the whole array and remove all lines with
: end as .txt and .scc. i.e remove that element in the array.
Am rather a beginner at perl and was wondering how to do the following. I've
read in a text file containing a list of file paths. the list is read in to
an array. I want to scan through the whole array and remove all lines with
end as .txt and .scc. i.e remove that element in the array. My file
Phillip Bruce ([EMAIL PROTECTED]) wrote:
> Hi,
>
> Sometime back some one gave me the path to a config file in
> which told cpan where and what compilers that my systems
> uses.
> Does anyone have any ideas to this.
>
> I get this error:
> /usr/ucb/cc: language optional software packa
Billy Joedono ([EMAIL PROTECTED]) wrote:
> Hi all,
>
> Below is a piece of code central to my problem. I've used this a lot of
> time without problem, but on this occasion, it fails me. Whenever I run the
> script, it ends with the error "bash: ./test.pl: No such file or
> directory".
That's
Hi,
I am currently trying to get perl and mysql talking together on linux.
I have succeeded in the basics, doing selects, inserts, updates
and deletes when dealing with chars and ints. I have now turned
my attention to blobs, and am having considerable difficulty.
I have managed to get a blob(
Hellows
I've donwloaded a module from CPAN (CORBA::ORBit) but it
requires Error ('require Error') and there is any Error.pm
in the system. Can anybody explain what can I do to put it
working? I think removing the line will do the trick, but
I would like to know what's this requi
Hi Billy,
unix2dos
#!/usr/local/bin/perl -w
while () {
chomp;
if ( $0=~m/dos2unix$/ ) {
print "$_\n";
} else {
print "$_\r\n";
}
}
dos2unix
#!/usr/local/bin/perl -w
while () {
chomp;
if ( $0=~m/dos2unix$/ ) {
print "$_\n";
} else {
print "$_\r\n";
}
}
On Friday
Hi Billy,
can't see anything wrong with the code, except that it assumes that the
file is in the current directory. It's not something as daft as you
'cd'ing to that directory before you ran in debug mode is it?
Gary
On Friday 27 April 2001 3:44 am, Billy Joedono wrote:
> Hi all,
>
> Below
49 matches
Mail list logo