[15663] in Perl-Users-Digest
Perl-Users Digest, Issue: 3076 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 17 14:05:39 2000
Date: Wed, 17 May 2000 11:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958586718-v9-i3076@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 17 May 2000 Volume: 9 Number: 3076
Today's topics:
$0 doesn't give full path <eng40490@yahoo.com.sg>
Re: $0 doesn't give full path <tony_curtis32@yahoo.com>
Re: $0 doesn't give full path <andrew.mcguire@walgreens.com>
Re: $0 doesn't give full path <billy@arnis-bsl.com>
Re: A couple of quick questions (M.J.T. Guy)
Re: Accurate IP return? (Abigail)
Re: BerkeleyDB3.0.55 <erikm@rd.bbc.co.uk>
Re: catching eval warnings and preventing them <franl-removethis@world.omitthis.std.com>
Re: deleting from a hash by reference... stdenton@my-deja.com
Re: determining existence of object method <franl-removethis@world.omitthis.std.com>
Re: determining existence of object method (Randal L. Schwartz)
Free CGI hosting <soisfranc@mail.com>
Free programming offerred by student <cgi2@zipmail.com>
Re: HELP:apache don't evaluate my cgi-scripts <rootbeer@redcat.com>
How can I read the volume label of a CDROM on Linux? <tiemaster@home.com>
Re: IPC: 1 to n communication (Randal L. Schwartz)
manipulating a text file with perl <bseppanen@bellmemorial.org>
Minivend evil? <jbc@west.net>
Re: Minivend evil? (Randal L. Schwartz)
Re: Mixed results! (Bart Lateur)
Re: Mixed results! <flavell@mail.cern.ch>
More Newbie Questions - Manipulating Data.... <roy.wood@ukonline.co.uk>
Re: More Newbie Questions - Manipulating Data.... (Jerome O'Neil)
Re: More Newbie Questions - Manipulating Data.... <jboesNOjbSPAM@qtm.net.invalid>
Re: my cgi script (Bart Lateur)
Need script that fetches key value out of flat file. <epost1@my-deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 May 2000 23:10:12 +0800
From: "lone wolf" <eng40490@yahoo.com.sg>
Subject: $0 doesn't give full path
Message-Id: <3922b611.0@news.cyberway.com.sg>
looks like when evaluated in a cgi (using CGI.pm), $0 is the fullpath.
elsewhere it's the basename. today on a linux machine i found that even in a
cgi $0 is the basename. how can i get the fullpath? there has to be a way.
------------------------------
Date: 17 May 2000 10:23:37 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: $0 doesn't give full path
Message-Id: <873dnhgpza.fsf@shleppie.uh.edu>
>> On Wed, 17 May 2000 23:10:12 +0800,
>> "lone wolf" <eng40490@yahoo.com.sg> said:
> looks like when evaluated in a cgi (using CGI.pm), $0 is
> the fullpath. elsewhere it's the basename. today on a
> linux machine i found that even in a cgi $0 is the
> basename. how can i get the fullpath? there has to be a
> way.
$0 includes the pathname (CGI context is irrelevant). Can
you provide a working example of this behaviour?
print "$0\n";
always has the path in it for me.
hth
t
------------------------------
Date: Wed, 17 May 2000 10:33:44 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: $0 doesn't give full path
Message-Id: <3922BBD8.44B06985@walgreens.com>
Tony Curtis wrote:
>
> >> On Wed, 17 May 2000 23:10:12 +0800,
> >> "lone wolf" <eng40490@yahoo.com.sg> said:
>
> > looks like when evaluated in a cgi (using CGI.pm), $0 is
> > the fullpath. elsewhere it's the basename. today on a
> > linux machine i found that even in a cgi $0 is the
> > basename. how can i get the fullpath? there has to be a
> > way.
>
> $0 includes the pathname (CGI context is irrelevant). Can
> you provide a working example of this behaviour?
>
> print "$0\n";
>
> always has the path in it for me.
I think he means something like this:
[anm@sputnik ~]: cat > test.pl
#!/usr/bin/perl -w
use strict;
print "$0\n";
[anm@sputnik ~]: chmod 755 test.pl
[anm@sputnik ~]: ./test.pl
./test.pl
If you run the script with a relative path-name it
will print out a relative path-name.
Regards,
anm
--
/*-------------------------------------------------------.
| Andrew N. McGuire |
| andrew.mcguire@walgreens.com |
`-------------------------------------------------------*/
------------------------------
Date: Wed, 17 May 2000 16:10:25 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: $0 doesn't give full path
Message-Id: <8fug92$dis$1@nnrp1.deja.com>
In article <873dnhgpza.fsf@shleppie.uh.edu>,
Tony Curtis <tony_curtis32@yahoo.com> wrote:
> >> On Wed, 17 May 2000 23:10:12 +0800,
> >> "lone wolf" <eng40490@yahoo.com.sg> said:
>
> > looks like when evaluated in a cgi (using CGI.pm), $0 is
> > the fullpath. elsewhere it's the basename. today on a
> > linux machine i found that even in a cgi $0 is the
> > basename. how can i get the fullpath? there has to be a
> > way.
>
> $0 includes the pathname (CGI context is irrelevant). Can
> you provide a working example of this behaviour?
>
> print "$0\n";
>
> always has the path in it for me.
>
IMHO not so always:
$ perl -v
This is perl, version 5.005_03 built for aix
...skipped...
$ pwd
/home/iljat
$
$ cat test0
#!/usr/bin/perl -w
print "$0\n";
$
$ test0
test0
$
$ ./test0
./test0
$
$ /home/iljat/test0
/home/iljat/test0
$
$ perl test0
test0
$
So yes, you get a full path only if you started a script using the full path.
Anyway, one shouldn't rely on such things like $0 (or argv[0] in C).
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 17 May 2000 17:15:19 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: A couple of quick questions
Message-Id: <8fuk37$3q0$1@pegasus.csx.cam.ac.uk>
In article <8fh8qq$507$1@nnrp1.deja.com>, Kostis <ke77le@my-deja.com> wrote:
>Hi all.
>Does anyone know if the anonymous subroutine passed to a map function
>constitute a closure if it appears within the implementation of a
>subroutine?
Not sure what case you have in mind here. Perl's garbage collector
will tidy up properly providing you don't have any circular chains
of references. The trap with subroutines (whether named or
anonymous) is that they hold a reference to any lexical variable
mentioned within the body. So there can be unexpected references
which can prevent objects from being destroyed or can generate loops.
Mike Guy
------------------------------
Date: 17 May 2000 17:25:22 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Accurate IP return?
Message-Id: <slrn8i5lg2.lb4.abigail@ucan.foad.org>
On Tue,
16 May 2000 20:01:06 +0100, [TNN]G.Bloke <GBloke@actiongames.co.uk> wrote:
++
++ "Abigail" <abigail@foad.org> wrote in message
++ news:slrn8i307a.p3i.abigail@ucan.foad.org...
++ > ++ Is there a reliable method to return a users IP address?
++ >
++ > No. It's not even well defined. IP addresses aren't associated with
++ > users - IP addresses are associated with interfaces.
++ <SNIP>
++
++ Now you are just being picky....can't anyone on this NG be sensible? Please
++ grow up...
++
++ I want to establish the IP address given by the ISP to a user when they log
++ on. I WOULD LIKE to know if this can be done with PERL. Forget why I want to
++ know....just give me a good answer.
That depends on the protocol being used. I don't see any reason you
cannot write a Perl program that sets up a PPP connection for instance.
Of course, you need to run that on the machine that's is being connected
to the ISP.
Alternatively, you could run a program on the ISPs machine.
++ Perldoc states something like this for remote_host :
++ "Returns either the hostname or the IP address of the system that requested
++ the page."
And how does that related to your question?
++ Unfortunatly this runs into problems when the page is fetched by the ISP's
++ cache and not directly by the user.
But then the cache is requesting the page.
Oh, and I forgot to mention the first time: it isn't uncommon to have
multiple users on the same machine.
Abigail
------------------------------
Date: 17 May 2000 15:11:35 GMT
From: Erik Meyer <erikm@rd.bbc.co.uk>
Subject: Re: BerkeleyDB3.0.55
Message-Id: <8fucr7$t1h$1@nntp0.reith.bbc.co.uk>
In comp.lang.perl.modules saoconne <saoconne@gateway.net> wrote:
: Rob, did you get any resolution to this problem? I am experiencing the
: samething on a system that I am trying to build. I am not working with
: quite the same levels of software, however, I am getting the same
: result...
: Any suggestions would be greatly appreciated. Stephen....
Would also appreciate any solutions. I am using BerkeleyDB 2.7.7 for
this very reason.
erik
------------------------------
Date: Wed, 17 May 2000 17:06:03 GMT
From: Francis Litterio <franl-removethis@world.omitthis.std.com>
Subject: Re: catching eval warnings and preventing them
Message-Id: <m3vh0df6o4.fsf@franl.andover.net>
"Dan Brown" <datm@uswest.net> writes:
> The message
>
> Global symbol "$whatever" requires explicit package name at (eval 1) line 1.
>
> message is the compiler telling you that since you used strict and
> $whatever was not declared via my (by the way, you can solve this my
> inserting my before $whateverr). When you get this message, Perl is
> compiling the code and the program hasn't actually run yet.
Not true. Perl compiles the string argument to eval while the program is
running. In Perl, compile-time and run-time do not occur strictly in
that order. The eval operator causes compilation at run-time, and the
BEGIN { ... } syntax causes code to execute at compile time.
And if you put an eval '...' into a BEGIN { ... }, you travel back in
time.
--
Francis Litterio
franl-removethis@world.std.omit-this.com
PGP public keys available on keyservers.
------------------------------
Date: Wed, 17 May 2000 16:49:31 GMT
From: stdenton@my-deja.com
Subject: Re: deleting from a hash by reference...
Message-Id: <8fuiil$gd2$1@nnrp1.deja.com>
In article <7a7lcudzz3.fsf@Merlin.i-did-not-set--mail-host-address--so-
shoot-me>,
Ala Qumsieh <aqumsieh@hyperchip.com> wrote:
> > But you can do:
> >
> > undef $$ref;
> >
> > This is not the same but it is quite likely that it is sufficient
for
> > your needs.
>
> This doesn't do what the OP wanted. Maybe he/she has some valid undef
> values. You can't make any assumptions based on the original question.
Due to the OP sitting in the cube next to me, I can provide a bit more
info on the problem. The app is processing hundreds of messages per
second. The goal is to identify and suppress dups. The hash key is
the text of the message, potentially large; the hash value is a time
stamp. As each message comes in, he looks for it in the hash and
tosses it if there is another copy. Also, every so often, he walks the
hash and deletes things that are getting too old. Right now, he has
lots of copies of the hash key floating around, which he would like to
minimize.
IMHO, he is prematurely optimizing for space, but OTOH he knows the
data better than I. Anyway, one of my suggestions is to take the 32-
bit CRC of the message text and use that as the hash key, tossing the
message. The number of potential messages is well less that 4G, so
collisions shouldn't be much of a problem. MD-5 would reduce the
chances of a collision by a lot, but I suspect that a cryptographically
secure hash would take so lot to compute that he couldn't keep up with
the incoming data.
I assume that using random 32-bit ints doesn't slow down a hash (say,
due to it converting them to strings and hashing them), otherwise,
we'll have to write our own hash tables using arrays.
Any ideas?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 17 May 2000 16:52:27 GMT
From: Francis Litterio <franl-removethis@world.omitthis.std.com>
To: Kenneth Lee <kenneth.lee@alfacomtech.com>
Subject: Re: determining existence of object method
Message-Id: <m33dnhglv8.fsf@franl.andover.net>
Kenneth Lee <kenneth.lee@alfacomtech.com> writes:
> i want to test whether an object can invoke an arbitrary method.
> defined() (or exists() in 5.6.0) only works for class methods, but not
> object ones.
Use UNIVERSAL::can(), like this:
if ($obj->can("somemethod"))
{
$obj->somemethod();
}
else
{
print "Can't do that!\n";
}
--
Francis Litterio
franl-removethis@world.std.omit-this.com
PGP public keys available on keyservers.
------------------------------
Date: 17 May 2000 10:53:17 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: determining existence of object method
Message-Id: <m1em71f4he.fsf@halfdome.holdit.com>
[comp.lang.perl is dead...]
>>>>> "Francis" == Francis Litterio <franl-removethis@world.omitthis.std.com> writes:
Francis> Kenneth Lee <kenneth.lee@alfacomtech.com> writes:
>> i want to test whether an object can invoke an arbitrary method.
>> defined() (or exists() in 5.6.0) only works for class methods, but not
>> object ones.
Francis> Use UNIVERSAL::can(), like this:
Francis> if ($obj->can("somemethod"))
Francis> {
Francis> $obj->somemethod();
Francis> }
Francis> else
Francis> {
Francis> print "Can't do that!\n";
Francis> }
Slightly faster:
if (my $can = $obj->can("somemethod")) {
$can->($obj,@any_args_you_want);
}
No sense in looking it up twice. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 17 May 2000 18:20:19 +0200
From: "SoisFranc" <soisfranc@mail.com>
Subject: Free CGI hosting
Message-Id: <8fugk8$g2f2@news.vtx.ch>
Hi guys,
I've just found a really great free CGI-supported hosting. It offers for
totally free a domain name (only ".ch") and a hosting with CGI, SSI and PHP
support. I really don't know how they do it, but they do it, even the
internic fee are free, incredible ! I thought it may interest you, the url
is www.freename.ch.
Best regards,
Francois
------------------------------
Date: Wed, 17 May 2000 14:04:54 -0400
From: Carl Gibbs <cgi2@zipmail.com>
Subject: Free programming offerred by student
Message-Id: <3922DF46.4740E73A@zipmail.com>
I'm a grad student and know C++, Java, Javascript, Perl, CGI, HTML, the
Win32API , MFC, Winsock and some 80x86 assembly. I'd like to get some
practice and build my resume by working on some real-world projects.
I've been programming for 15 years as a hobbyist but much of it has been
in older now-obsolete languages on non-x86 systems. I have an
engineering degree and went to grad school.
Allow me to work for free for you in any of the above areas. I do
request that credit be given for the work ( a comment line in the code
will suffice). Projects taking about 10 days of work or therabouts would
be nice. I'm currently familiar with the windows development platform,
but could learn others if needed.
Thanks
-M
------------------------------
Date: Wed, 17 May 2000 09:54:37 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HELP:apache don't evaluate my cgi-scripts
Message-Id: <Pine.GSO.4.10.10005170954050.25459-100000@user2.teleport.com>
On Wed, 17 May 2000, lwo wrote:
> 'Premature end of script headers: c:/programme/apache
> group/apache/cgi-bin/test.pl'
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.cpan.org/
http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
http://www.cpan.org/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 17 May 2000 12:03:38 -0500
From: rgb <tiemaster@home.com>
Subject: How can I read the volume label of a CDROM on Linux?
Message-Id: <5105CD9F75DAE680.4D2D5219FC3884CC.B41F50923D094D94@lp.airnews.net>
The title says it all. I looked for a Linux program to do this, but I
must be blind or not very good at searching for things. Can anyone
point me in the right direction? Thanks.
------------------------------
Date: 17 May 2000 09:54:33 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: IPC: 1 to n communication
Message-Id: <m1puqlf77a.fsf@halfdome.holdit.com>
>>>>> "Gernot" == Gernot Homma <gernot@cat.at> writes:
Gernot> Hello,
Gernot> i have a process that should pass some data to n other processes, which
Gernot> do something with the data. which mechanism is the best to this.
Broadcast UDP is usually the best.
Unless you want to maintain a separate TCP connection to each one.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 17 May 2000 13:02:00 -0400
From: "Brian E. Seppanen" <bseppanen@bellmemorial.org>
Subject: manipulating a text file with perl
Message-Id: <Pine.LNX.4.21.0005171103340.763-100000@telemachus.bellmemorial.org>
I'm trying to write a perl script that will examine a file in the
following format. The most important information I hope to glean from the
file is the name of the printer from the Req-Id column and the Date.
bell_med: waiting for billing to come up
Req-Id Owner Size Date
billing-63 kaye 1795 May 11 14:05
I'm trying to set up a job that runs in cron to examine the output of
lpstat to alert me of print daemons dying. The print jobs are very small lab
results, so I want to be alerted after a job has been waiting for a half
an hour. I don't need to store any state information, the check would be
performed each time from the data in the date field.
I'm a perl novice and I'm really not quite sure how to proceed. I most
likely don't have a need for the first two lines. Here's what I have.
I'd really appreciate any insights.
#! /usr/bin/perl -w
system "rexec xxx.xxx.xxx.xxx lpstat > /tmp/status";
#open the file /tmp/status
open (F,/tmp/status);
#if /tmp/status is a zero length file everything is cool
while (<F>) || die;
#analyze the file
#for each $queue with spooled files
#for each job in $queue assign $count
#get $ptime from Date string
#compare $ptime to current time if time exceeds 30minutes send a page
system "mail -s \"`hostname` Printer error on $queue, $count spooled job(s)\" seppanen+page@hawking";
end
This would be for perl running on a linux machine.
Thanks,
Brian Seppanen
bseppanen@bellmemorial.org
------------------------------
Date: Wed, 17 May 2000 10:42:37 -0700
From: John Callender <jbc@west.net>
Subject: Minivend evil?
Message-Id: <3922DA0D.668EB700@west.net>
I'm currently evaluating a piece of Perl software called Minivend
(see:
http://www.minivend.com/
). At one point I asked about it in the #perl channel on EFnet,
and got the following responses (names have been changed to
protect the innocent):
<jbc> can anyone give me a testimonial for or against minivend?
<user #1> jbc: don't do it
<user #1> jbc: minivend in the past has overwritten system
modules without my consent
<user #1> jbc: it's pure malevolent eeeeeeeeeeevil
<user #1> eeeeeeeeeeeeeeeeeeeevil
<jbc> ouch.
<user #2> system modules??
<user #3> the minivend author included (or used to include) his
own special versions of things
I've emailed Mike Heins (Minivend's author) to ask about this,
but was interested in getting a second opinion from the experts
here. Is this just the usual IRC hyperbole, or should I be
legitimately concerned?
John
------------------------------
Date: 17 May 2000 11:02:50 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Minivend evil?
Message-Id: <m166sdf41h.fsf@halfdome.holdit.com>
>>>>> "John" == John Callender <jbc@west.net> writes:
John> <user #3> the minivend author included (or used to include) his
John> own special versions of things
John> I've emailed Mike Heins (Minivend's author) to ask about this,
John> but was interested in getting a second opinion from the experts
John> here. Is this just the usual IRC hyperbole, or should I be
John> legitimately concerned?
It was in fact true at one point. I'm not sure it is or isn't now.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 17 May 2000 15:29:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Mixed results!
Message-Id: <3926ba14.3249692@news.skynet.be>
Hassoun wrote:
>after collecting data from an HTML form, my cgi script returns all the
>data but in a random order. is there a way to return it in the same
>sequence of the form? any clues?
You processed it through a hash? Yup, hashes act that way (it's not
really random).
You can sort it yourself. Alphabetically is really simple:
foreach (sort keys %form) {
print " * $_: $form{$_}\n";
}
Or you can simply use another, ordered list instead of the keys():
foreach(qw(name surname age street city state country)) {
print " * $_: $form{$_}\n";
}
--
Bart.
------------------------------
Date: Wed, 17 May 2000 19:25:32 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Mixed results!
Message-Id: <Pine.GHP.4.21.0005171912350.3970-100000@hpplus03.cern.ch>
On Wed, 17 May 2000, Hassoun wrote:
> after collecting data from an HTML form, my cgi script returns all the
> data but in a random order.
This question is a bit more complex than it at first seems.
> is there a way to return it in the same
> sequence of the form?
Current HTML specifications (albeit they are off-topic for this group)
say that the form elements should be submitted in the same order in
which they were present on the FORM. However, I'm pretty sure there
are browser/versions that don't conform to this ruling, so you can't
even be sure that the server will get the fields in the correct order
from the browser.
And then - and this is where it becomes relevant to Perl - the
convenient way to manipulate the parameter names and values is by
means of a hash, where there is no significance in the ordering of the
elements.
> any clues?
Considering that when you write the form, you presumably know what
order you put the names in. In this position, I think I would be
asking myself why I wanted to know what sequence they were submitted
in, considering that I already determined the ordering of the
parameters within the form when I created the form.
Note that with CGI.pm you can very easily re-create a fresh copy of
the form, but now with the actual submitted values filled in, if you
want to "re-play" the user's submission details back to them for them
to review. Since you'd be doing that with essentially the same code
that created the form in the first place, you still don't need to
worry about what order the parameters were actually sequenced when the
form data was submitted, it will simply "come out right".
If you put the field names in alphabetical order in the form, then
you can obviously sort them into alphabetical order in the script, and
you solved your "problem" - but I'm still not sure why doing this
would be particularly useful ;-)
Hope some of those thoughts are helpful. Probably, if you have more
detailed problems with it, your question would be more at home on
comp.infosystems.www.authoring.cgi, unless there's something
specifically related to the Perl language or to CGI.pm that's giving
you trouble. Good luck.
------------------------------
Date: Wed, 17 May 2000 18:41:17 +0100
From: "Roy Wood" <roy.wood@ukonline.co.uk>
Subject: More Newbie Questions - Manipulating Data....
Message-Id: <8fulm1$9sl$2@apple.news.easynet.net>
Hi (Again),
As i have zero experience with Perl i wonder if anyone can help me.
I have a variable which is an integer number. I want to be able to break
this number down into it's individual components. So 12000 would be 1 - 2 -
0 - 0 - 0 etc....
What is the command that i should investigating to acheive this ?
Any help would be greatly appreciated....
Cheers
MA
------------------------------
Date: Wed, 17 May 2000 17:50:11 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: More Newbie Questions - Manipulating Data....
Message-Id: <nZAU4.71$i_6.3601@news.uswest.net>
"Roy Wood" <roy.wood@ukonline.co.uk> elucidates:
> Hi (Again),
>
> As i have zero experience with Perl i wonder if anyone can help me.
>
> I have a variable which is an integer number. I want to be able to break
> this number down into it's individual components. So 12000 would be 1 - 2 -
> 0 - 0 - 0 etc....
>
> What is the command that i should investigating to acheive this ?
Split.
perldoc -f split
HTH!
------------------------------
Date: Wed, 17 May 2000 10:54:51 -0700
From: Mur <jboesNOjbSPAM@qtm.net.invalid>
Subject: Re: More Newbie Questions - Manipulating Data....
Message-Id: <121e8064.7b277a1f@usw-ex0101-006.remarq.com>
Heck, this is just too easy:
perl -e '$n=q(012345); print join(q(,),$n,$n=~/\d/g)'
The trick is this:
@digits = $n =~ /\d/g;
This will set @digits to each match of the pattern in the string
$n. \d is a digit (0-9).
Jeff Boes//ICQ=3394914//Yahoo!=jeffboes//AOL IM=jboes
//home=jboes@qtm.net//professional=mur@consultant.com
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 17 May 2000 15:01:05 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: my cgi script
Message-Id: <3922b153.1008697@news.skynet.be>
Andrew McGuigan wrote:
>All is going well so far with my web Form. I just need the code that
>collects the information on the Form and sends it to the server. That’s
>all for the moment.
http://cgi.resourceindex.com/Programs_and_Scripts/Perl/Form_Processing/
There are quite a few there.
--
Bart.
------------------------------
Date: Wed, 17 May 2000 17:37:24 GMT
From: Ethan Post <epost1@my-deja.com>
Subject: Need script that fetches key value out of flat file.
Message-Id: <8fulci$jsu$1@nnrp1.deja.com>
I need what should be an pretty easy Perl script that does the
following. The purpose is to fetch a value from a key value pair out
of a flat file then return 4 lines, the first 2 are the value that was
retrieved and then a meaningless string and then the name of the key.
This is foe an open source project called GNUmetrics for Oracle which
will be integrating the MRTG tool with Oracle (www.mrtg.org). You will
get credit for any work done, thanks! - Ethan Post
Name: ?.?
Purpose: Open a text file, go to a particular line and get value
Returns: Please see MRTG Docs section included at bottom of this message
Inputs: Value Name, Path, File Name
For example:
The PL/SQL's packages primary job is to create a flat file containing a
number of key value pairs like this:
current_logons 102
buffer_cache_hit_rate 85.5
commit_rollbacks 60
The MTRG configuration file needs to call a procedure that gets that
values one at a time out of this flat file:
Example Call:
get_metric.pl 'current_logons' /tmp gnu-ora.lst
Should Return:
102
102
Ignore
current_logons
Here are the exact specs from the MRTG Docs:
...if you want to monitor something which does not provide data via
snmp you can use some external program to do the data gathering.
The external command must return 4 lines of output:
Line 1
current state of the first variable, normally 'incoming bytes count'
Line 2
current state of the second variable, normally 'outgoing bytes count'
Line 3
string (in any human readable format), telling the uptime of the
target.
Line 4
string, telling the name of the target.
********END DOCS***************
I do not know if the string values need to be surrounded with ' or " or
nothing at all yet, I will do some testing and find out. I think perl
is the best method because it is easiest to modify and it will run on
almost all platforms.
Thanks,
Ethan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3076
**************************************