If all you want to do is get a total of all the minutes in the table, work
smarter, not harder. Let SQL do the work for you. In your select statement
you will want to use the function sum. So something like so:
$sth = $dbh ->prepare( qq{ SELECT sum(minutes)
I would do it like this (taking a stab at this...critique is welcomed):
At 03:17 PM 08.16.2001 +0930, Daniel Falkenberg wrote:
>List,
>
>I have a problem here that I am having a little bit of trouble trying to
>resolve. Firstly I have a Perl script that connects to a PostgreSQL
>database using t
Dan, :)
$sth = $dbh ->prepare( qq{ SELECT SUM(time_track_minutes)
FROM table
WHERE status = 'COMPLETE'
} ) || die $dbh->errstr; ;
$sth->execute;
Regards,
Daniel Fal
List,
I have a problem here that I am having a little bit of trouble trying to
resolve. Firstly I have a Perl script that connects to a PostgreSQL
database using the DBI module. I want to be able to SELECT a column from
the database and return the total result.
For example if I do the follow
i need to remove files that are more than 30 days old.
I know the foreach loop part
but my if statement is not working.
See below.
#!/usr/bin/perl
use File::stat;
use File::Find;
$dirname="/opt/ilbackup/status";
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while ( defined
With only one line from a logfile to work with, I have to do a little
guessing about format, but if all lines are formatted like that one, and if
days always have a two digit format, and if a lot of other assumptions, This
snippet does what you are looking to do:
my ($mon, $mday) = (localtime(ti
It might be helpful if you posted at least the part of the code that is
having trouble. it's difficult to say what went wrong when we can't really
see what is even happening.
Steve H.
-Original Message-
From: Vincent Lim [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2001 9:35 AM
>Does anybody know how to access root owned file via cgi script?
Not unless your webserver (which runs the cgi script with its own
permissions) is set as root, and that's normally a big no-no. There is a
Syslog module though - you may want to look into that (I know nothing
about it, though)...
I'm trying to access log files on different Novell Servers. Path is
\sys\arcserve.6\nwagent.txt
Here is the problem and why I'm trying to do this with Perl. The log
file is extensive, and is sorted by date.
Example line:
Aug-14 20:11:42 Job request from @ (NetWare
Server)
This is the first
Junaid Najamuddin wrote:
> Hi,
>
> Can anyone tell me the procedure in detail please
> how to convert a Perl script into an executable
>
> Thanks
> Junaid
Check out IndigoStar Software. 'http://www.indigostar.com/perl2exe.htm'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional com
Hello,
I have a listing of directories and files in a root directory which I
need to recreate at another Windows NT DOS shell machine.
The alogrithm I have implemented in general works like this:
# check if the listing exist in target machine
# if exist, check if it is a file in target machi
Hi all,
I'm writing a simple perl cgi script to populate some infomation from syslog
file,
open FILE, " | tail /var/log/daemon.log";
but always got permission denied, no matter what i do about $>, $<
Does anybody know how to access root owned file via cgi script?
Thank in advance
Fra
At 05:36 AM 8/15/01 -0700, Blair Burns wrote:
>Hi *,
>
>I am rather a beginner to Perl (and programming) but
>am nevertheless faced with maintaining a complex OO
>environment. Yikes! Anyway, here is my problem: I have
>two classes whose constructors return a db handle. "A"
>accepts parameters for
Joe Bellifont [[EMAIL PROTECTED]] quoth:
*>
*>How do I know if it is already installed and
*>how can I get a list of all installed modules
http://www.cpan.org/misc/cpan-faq.html#How_installed_modules
e.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTEC
Steve Starer [[EMAIL PROTECTED]] quoth:
*>Thanks for the quick reply! I think my greater question is how to
*>remove/uninstall any module. This all got started when I began working
*>through the Perl DBI book. The very first example program bombed when it hit
Nope, there isn't any function that
Hi *,
I am rather a beginner to Perl (and programming) but
am nevertheless faced with maintaining a complex OO
environment. Yikes! Anyway, here is my problem: I have
two classes whose constructors return a db handle. "A"
accepts parameters for user/password, while "B",
although it uses A to conne
Thank you Michael. I missed the "\".Works fine now.
- Original Message -
From: "Michael Kelly" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 16, 2001 9:43 AM
Subject: Re: s/^W+//;
> On 8/15/01 4:28 PM, Clinton wrote:
>
> > Hi
> > I'm reading data from MSAccess, joini
On 8/15/01 4:28 PM, Clinton wrote:
> Hi
> I'm reading data from MSAccess, joining 2 fetched values with a comma and
> writing to another table. The data seems to be padded. My resultant column
> shows some space between the two values eg
> valuefromFirstcolumn, valuefromSecondcolu
At 04:58 PM 8/15/01 -0600, Tyler Cruickshank wrote:
>Hello. Im still struggling with converting a binary file to an ascii
>file. I just dont understand how to use seek and unpack. I understand
>that one needs to know the format of the binary file, therefore, I have
>pasted below FORTRAN code
Hi
I'm reading data from MSAccess, joining 2 fetched values with a comma and
writing to another table. The data seems to be padded. My resultant column
shows some space between the two values eg
valuefromFirstcolumn, valuefromSecondcolumn
I have tried applying a regex
$valuefromFi
hello
dont know if its the right place to ask such a question
please pardon me
im actually practicing perl/tk
how can i make my wheel mouse to works with scrollable text/entry ... widgets
??
any help will be greatly appreciated
tom
--
si quelqun peut me dire comment avoir son propre grou
Hello. Im still struggling with converting a binary file to an ascii file. I just
dont understand how to use seek and unpack. I understand that one needs to know the
format of the binary file, therefore, I have pasted below FORTRAN code that reads the
ascii file and writes a binary file. Th
On Wed, Aug 15, 2001 at 02:49:34PM -0700, pn wrote:
> #/usr/bin/perl -w
> use strict;
>
> # Forward declarations
>
> my $opt_help;
This is your problem right here. Getopt::Long sets the package global
$main::opt_help, but now that you've declared the variable lexical, anytime
you access it
Hi,
I am unable to get the following inherited code, using
Getopt::Long, to work.
It is my understanding that Perl will automatically
create a $opt_help variable ( for a -help command line
option). However, when I try to print it's value, it
returns a null value. In addition, the "help" mesage
i
Anybody attempt to embed Perl in C with Perl 5.6.1. It works fine in Perl
5.0053. But in the newer version, it says that Dynamic loading is not
available in this perl. I already compiling perl with -Dusedl and such, but
to no avail.
- philipd
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
> -Original Message-
> From: Jennifer Pan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 3:51 PM
> To: Jos I. Boumans
> Cc: [EMAIL PROTECTED]
> Subject: RE: URL access
>
>
> Apologize for the naivety, but
> there are so many modules related with LWP at cpan ( I searched fo
to be on the safe side, just get bundle::lwp
it has all you'll ever need probably!
- Original Message -
From: "Jennifer Pan" <[EMAIL PROTECTED]>
To: "Jos I. Boumans" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, August 15, 2001 9:51 PM
Subject: RE: URL access
Apologize
Apologize for the naivety, but
there are so many modules related with LWP at cpan ( I searched for
LWP), which one do I download?
And how do I know if we already have LWP module at our local machine?
thank you very much!!
-Jennifer Pan
-Original Message-
From: Jos I. Boumans [mailto:[E
This is exactly what LWP is for...
it comes standard with activestate's distro of perl (www.activestate.com)
but not with *nix iirc.
you can grab the module from cpan and just read up on the docs of
LWP::Simple
it does all you need =)
hth
Jos
- Original Message -
From: "Tyler Cruicksha
Hello.
Im looking for a little direction:
I want to write a very simple script that goes out to a particular set of web sites
(weather maps) and prints/saves their contents. Ive been reading about sockets and
networking but I havent been able to glean the information that I think I need. Doe
Hello,
I am trying to get a CGI script to run a system command.for example
system `/usr/sbin/adduser larry' or die "User was not added" $?;
I have this line in a script and have set Apache to be run as root (don't
worry, all this is being done on a test box...I know the security risks) and
i was referring to the entire line (ie, the command).
and i stand by my former reply: try the win32::* modules for interaction
with windows first, before reinventing the wheel.
Jos
- Original Message -
From: "Michael Fowler" <[EMAIL PROTECTED]>
To: "Jos I. Boumans" <[EMAIL PROTECTED]>
C
On Wed, Aug 15, 2001 at 12:14:25PM +0200, Jos I. Boumans wrote:
> it's in the last line:
> kill 'HUP',`cat $PIDFILE`;
>
> it's a unix command to kill *nix processes... which of course won't work on
> windows...
kill does work on Windows, and in 5.6.1 (possibly 5.6.0 too) even works on
arbitrary
- Original Message -
From: KAVANAGH, Michael <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 15, 2001 12:28 PM
Subject: XML::Parser -- Problem with undefined entities in element
attributes
> Hi there,
> I've been bumping my head up against this problem all morning no
:)
forgot to add the $i++.
And that was just an example.
On Wed, 15 Aug 2001 10:55:58 -0400
Bob Showalter <[EMAIL PROTECTED]> wrote:
> > -Original Message-
> > From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 15, 2001 10:13 AM
> > To: Perl-Beginners
> > Subject:
> -Original Message-
> From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 10:13 AM
> To: Perl-Beginners
> Subject: status messages as the program progresses
>
>
> Hello everyone,
>
> I have a while loop that loops through a text file for quite
> a while (
I am using a hash to iterate over and when I get a hit, I delete the
key:
HashStart: 148/256 #<- start of processing
Pass 1 130 74/256
Pass 2 41 39/256
Pass 3 23 17/256
Pass 4 11 7/256
Pass 5 7 0 # hash is cleared
I don't beli
Thanks for the quick reply! I think my greater question is how to
remove/uninstall any module. This all got started when I began working
through the Perl DBI book. The very first example program bombed when it hit
the ADO module. The module is missing something it needs -
Win32/OLE/Variant.pm. I
running `perl -e 'use XML:Parser'` should do the
trick. If you get the prompt back, it's installed.
Otherwise, you get the "Can't locate..." message.
--sal
--- Michel Rodriguez <[EMAIL PROTECTED]>
wrote:
> On Wednesday 15 August 2001 14:29, Joe Bellifont
> wrote:
> > I have to install the xml
Is there a way to show upper and lower case pattern match for the -FPat
option for a dialog box default pattern:
sub browse_files
{
my $save_name = $b_file;
$status->configure(-text=>"Browse directories");
if ($base )
{
$b_file = $file_dialog->Show( -Path => $base, -FPat => "*
On Wed, Aug 15, 2001 at 08:07:25AM -0400, Steve Starer wrote:
> I am the perl administrator here, and new to both perl as a programming
> language, and as the site admin. I've got no problem getting modules. My
> question is how do I remove them? In particular, I'm in a Solaris site, and
> had to
Hello everyone,
I have a while loop that loops through a text file for quite a while (10
min or so). Is there any way to print a status-type message while it's
looping through?
I did something like this now:
my $i=0;
while ($i le "1000") {
print "Processing\r";
}
And that works, bu
Hi all,
Hopefully someone could help me with a small problem that im having, part of one of my
scripts uses functions from Win32::NetAdmin and it works fine when running from a
windows 2000 pc but not an NT4 pc.
Basically the script takes the name of a pc as input, lists the members of the lo
On Wednesday 15 August 2001 14:29, Joe Bellifont wrote:
> I have to install the xml parser module.
> I have root access.
>
> How do I know if it is already installed and
> how can I get a list of all installed modules
If you try to use it and you can't then it is not installed ;--) Or just try
p
--- Piers Cawley <[EMAIL PROTECTED]> wrote:
> Note that the number of used buckets isn't (necessarily) the same as
> the number of items in the hash.
Can you give an example of how they could be different?
__
Do You Yahoo!?
Make international calls
I have to install the xml parser module.
I have root access.
How do I know if it is already installed and
how can I get a list of all installed modules
thanks.
-J
_
Get your FREE download of MSN Explorer at http://explorer.msn.c
Greetings all,
I am the perl administrator here, and new to both perl as a programming
language, and as the site admin. I've got no problem getting modules. My
question is how do I remove them? In particular, I'm in a Solaris site, and
had to install the DBD bundle and Sybase DBI. I ended up wi
I don't know if you can do it using a foreach but I would use a for loop.
It may be just a tad slower but you'll get the results you're looking for.
Using the loop below will start at the last index of the array @a and loop
down to the first (assuming that the first index of the array is 0).
@a
On Wednesday 15 August 2001 13:20, Joe Bellifont wrote:
> I have a file that looks like this
>
>
> joe
> bloggs
> herein lies the question posed by the user
> the question can be multi-lined
> like this one.
>
>
> ==
>
> I'm trying to read the various tag content into variables:
>
On Wednesday 15 August 2001 13:19, KAVANAGH, Michael wrote:
> Interestingly, in testing this problem, I found that XML::Parser handles
> ® in the attribute fine, but not, as I said, ®. The ascii value
> entity seems to be handled ok. Can you confirm that in your experience this
> is the case gen
I have a file that looks like this
joe
bloggs
herein lies the question posed by the user
the question can be multi-lined
like this one.
==
I'm trying to read the various tag content into variables:
==
sub ParseFile {
my $file = 'submission6.xml';
#opened th
That is very helpful Michel, thanks.
And thanks for the reference to the mailing list... I didn't know about that
one.
One final follow-up point...
Interestingly, in testing this problem, I found that XML::Parser handles
® in the attribute fine, but not, as I said, ®. The ascii value
entity see
On Wednesday 15 August 2001 12:28, KAVANAGH, Michael wrote:
> Is there any way to handle entity references in attribute values?
>
> My problem is I have tags in my xml that contain entity references like
> this:
> and XML::Parser generates the following error:
> undefined entity at line 6, colum
Hi there,
I've been bumping my head up against this problem all morning now, and can't
come up with an answer, maybe someone with XML::Parser experience can help.
The XML::Parser documentation doesn't really have any suggestions.
Normally you can use the NoExpand method to prevent the parser from
it's in the last line:
kill 'HUP',`cat $PIDFILE`;
it's a unix command to kill *nix processes... which of course won't work on
windows...
what is the purpose of using this on windows? it's structure is quite
different...
hth
Jos
- Original Message -
From: "Rajeswary Santhiran" <[EMAIL P
Hi,
I am very new to perl. I am just using the perl script to run this application. I have
this perl script in unix and i need to convert it to windows . can anyone help me? The
error message that it shows when i run this script is , it cannot identify the "HUP".
and i don't know what is that
I have been working on three separate Perl/Tk programs and now I would
like to
have them all called from a single window. I am not sure how to do this
without making the
three, one. I tried making them modules but the windows are displayed
before the main window.
I have to then close them before
Bob Showalter <[EMAIL PROTECTED]> writes:
> Or, from perldoc perldata:
>
> If you evaluate a hash in scalar context, it returns false if the hash
> is empty. If there are any key/value pairs, it returns true; more
> precisely, the value returned is a string consisting of the nu
Hi.
What you should do is write both your new data and the contents of the old
file to a new file.
Afterwards, you might rename the new file to replace the old one.
Like:
#!/usr/bin/perl -w
open (NEWFILE, ">your new file's name") or die "Couldn't open new file: $!";
print NEWFILE $new_data;
# .
Help. How do I append data to the beginning of a file?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
60 matches
Mail list logo