Re: File exists

2002-05-19 Thread Matt C.
use the -e operator... C:\>perl -e "print qq(file exists!) if -e 'c:\autoexec.bat'" Output: file exists! perldoc -f -e will tell you more. Matt --- Arran4 <[EMAIL PROTECTED]> wrote: > How do i find out if a file exists in ActivePerl? > > > From: Arran > === > It is obvious: > The on

Re: apache::session

2002-05-10 Thread Matt C.
You may want to check out the following link: The article deals with HTML::Mason, but gives a good overview of Apache::Session as well. http://www.masonhq.com/user/adpacifico/ApacheSessionMason.html Matt --- Matthew Harrison <[EMAIL PROTECTED]> wrote: > I have had a look at the apache::session

Re: mod_perl with existing apache (with apologies for parroting...)

2002-05-01 Thread Matt C.
Ultimately you really should build mod_perl as a static module inside of Apache. Try rebuilding it statically with all your other dso stuff, which is well documented in the mod_perl INSTALL docs. That will make your life much easier. Matt --- Robert Beau Link <[EMAIL PROTECTED]> wrote: > -BE

Re: Oracle Error while trying to connect to oracle tables

2002-04-27 Thread Matt C.
You could setup another environment script to wrap your perl in (although setting up your environment with %ENV should work too). We do similar things by creating little shell scripts that setup the environment, then execute our perl stuff. We have one global env. that we source before all of our

Re: Mod_Perl -- A very basic question to get started

2002-04-13 Thread Matt C.
To me, this is a surprisingly tough question to answer. I'd say that the primary use of mod_perl is to speed up your pages via Apache::Registry, Apache::PerlRun or your own handlers. However, it's much more than that. 2 keys for me both personally and professionally are: 1) It allows you to do dy

Re: Finding the date of last sunday

2002-03-20 Thread Matt C.
The Date::Manip module can do almost anything you can think of with dates: http://search.cpan.org/doc/SBECK/DateManip-5.40/Manip.pod Have fun, Matt --- rory oconnor <[EMAIL PROTECTED]> wrote: > Can anyone think of a good way for me to find out what the date of last > sunday is with perl? I'm

Re: How to issue CLEAR command from Perl

2002-02-21 Thread Matt C.
Here's another way, which I suppose is simply an alternative to the system call: Notice how you just print the *value* from the captured backtick in the following line: perl -e '$c=`clear`; print "Testing ...\n"; sleep 1 ; print $c;' Matt --- Hewlett Pickens <[EMAIL PROTECTED]> wrote: > Invok

Re: HTML Template and HTML Mason

2002-02-16 Thread Matt C.
I love HTML::Mason, although you may have a tough decision, as there are several good templating systems out there. Here's why I like Mason: 1) It's easy to setup, and has good error handling so if you goof up you can fix your code quickly , something I do alot of ;). Speaking of that, I find the

Re: Keys and values

2002-02-09 Thread Matt C.
This example shows an array slice, which can be very useful from time to time (although the example Briac wrote saves a step). This would make a good one liner. #!/usr/local/bin/perl -w use strict; my %HASH; while(){ my @array=split; #split on space by default $HASH{ $array[0] } = @array

Re: CMD command

2002-02-07 Thread Matt C.
Man Net::Telnet? Sure. But not in the spirit of this list at all. I agree to encourage the use of documentation, but this is a little *too* terse. Matt --- walter valenti <[EMAIL PROTECTED]> wrote: > man Net::Telnet > > Walter > > >Hi anyone how to use the cmd command > >in the NET::TELNET

Re: A more perlish way

2002-02-06 Thread Matt C.
A very nice post. Learned something, thanks! Matt --- Michael Lamertz <[EMAIL PROTECTED]> wrote: > On Wed, Feb 06, 2002 at 03:05:29PM +0100, Jorge Goncalvez wrote: > > I tried this: > > @Symlink=("$program_path\\install.lnk", > > "$program_path\\linux.ram.lnk", > >

Re: A more perlish way

2002-02-06 Thread Matt C.
Also I think you need to put the call to phrase the system command like this: system("rm $_"); But perl has unlink, which is cleaner and could give you style points (this coming from someone who has little perl style, of course!). So you could (should?) just say: foreach (@Symlink) { unlink if

Re: output information to a xls file

2002-02-05 Thread Matt C.
Csv may well be easier for you, but I thought I'd shoot you this link. I've not used it, but it does what you want to do for sure. http://search.cpan.org/doc/JMCNAMARA/Spreadsheet-WriteExcel-0.34/WriteExcel.pm Matt --- Lance Prais <[EMAIL PROTECTED]> wrote: > I have a perl script that generate

Re: time question

2002-02-05 Thread Matt C.
Check out perldoc -f stat stat returns a bunch of useful info for you, including modification time, access time, size, etc. Matt __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- To unsubscribe, e

Re: Downloading FTP files

2002-01-30 Thread Matt C.
use the Net::FTP module, which will accomplish your task in the blink of an eye. It's got pretty much everything a standard ftp client has, and best of all it's in perl!! Matt --- Michael Pratt <[EMAIL PROTECTED]> wrote: > This is what I want to do: > > I want to access a ftp server that has s

Re: Two dimensional hash

2002-01-29 Thread Matt C.
This works for me from the command line. I like the "arrow" syntax for datastructures, as it allows me mind to see what's going on (which is hard for me to do sometimes with datastructures). perl -e "$name{adams}{alice}='HELLO WORLD'; print $name{adams}->{alice};" The camel book has a ton of stu

Re: how to install the module in cpan?

2002-01-28 Thread Matt C.
A very common way is to do this (on Unix): 1) unzip and extract the tarfile 2) perl Makefile.PL 3) make 4) make test if everything turns out ok... 5) 'make install' Alternatively, you can use the CPAN module: perl -MCPAN -eshell then, after you configure it (if it's your first time using

Re: XML parsing

2002-01-28 Thread Matt C.
I recently used XML::Simple for something very similar. You just tell it to read your xml file and it'll parse it up and create a handy data structure to work with. Use it with Data::Dumper if you want to see how it handles your xml: #!/usr/local/bin/perl -w use Data::Dumper;

Re: perl for php, in order to break free from asp

2002-01-27 Thread Matt C.
There's a module called DBD::CSV, which will probably solve your problem. CPAN is good at that :). You can tell it what the field separator is and then you'll be able to manipulate it however you want with the DBI. I believe you'll need to install the bundle, found here: http://search.cpan.org/

Re: perl for csv and sql...

2002-01-26 Thread Matt C.
If you're using MySQL (and I'm sure several others) you can skip this whole step and use mysqlimport. Run the command without arguments and it'll spit out some help. You just tell it what the fields are terminated by and it'll split around them and import into your db. Fast and easy. Matt ---

Re: [Fwd: ezmlm response]

2002-01-26 Thread Matt C.
Be careful -- there are a ton of cgi scripts out there that are no good (and an entire book by Elizabeth Castro, "Perl and CGI for the World Wide Web). If you're using perl for cgi, it's pretty much mandatory from a practical standpoint to use the fantastic CGI module that ships with your perl. I

Re: -d $path

2002-01-26 Thread Matt C.
The -d will test if your "file" is a directory. It took me way too long to learn how to use the very good information that comes with perl itself. Don't do the same; you'll learn much more quickly, plus your boss will never know that you didn't know how to use a certain function ;) perldoc -f -d

Re: directory is not change using "chdir"

2002-01-26 Thread Matt C.
Use the Cwd module to confirm where you are...my guess is that you're ok. Check this snippet out. Worked on my win2k machine. Remember that the *script* will change directories. When it exits you'll be back where you started. ### use Cwd; use strict; my $dir=getcwd; prin

Re: catching error

2002-01-24 Thread Matt C.
I would avoid rsh altogether; I've found it to be buggy, especially with commands which give you significant output. Some of these bugs are mentioned in the rsh manpages, if I recall. It's also relatively insecure. If you are going to run a command on a remote machine, consider Net::SSH::Perl (pre

RE: How to resize images with perl

2002-01-21 Thread Matt C.
You'll need to have the ImageMagick libraries installed on your system, as Image::Magick is just an api for them (almost certainly why your installs of Image::Magick are breaking). I just installed this yesterday and am super impressed. Very easy to use and faster than I thought. Only odd thing is

Re: Re[2]: A few Great Modules

2002-01-20 Thread Matt C.
Immediately grabbed the GraphViz library and pulled the perl modules down from CPAN. Thanks for the tip. Within a few minutes you've got a picture of your tables, structures, whatever. Awesome. Keep 'em coming!! Matt PS all hail CPAN --- Daniel Gardner <[EMAIL PROTECTED]> wrote: > Sunday, Janu

A few Great Modules

2002-01-20 Thread Matt C.
For you experienced programmers, this post may be old news. For the rest of us, as we move into writing more serious programs we'll discover many of these for the first time. This is a small list of Great Modules which have REALLY helped me recently. I figured I would share a few. Data::Dumper -

Re: why am I getting syntax errors ?

2002-01-08 Thread Matt C.
To simulate a case construct use someting like: /^[\t ]*$/ && do { print "blank\n" }; You just left out the "do". Also check out Config::IniFiles http://search.cpan.org/search?dist=Config-IniFiles for text-based config files. Haven't used it, but will as it looks very cool. Matt --- Filip Sn

Re: modules

2002-01-08 Thread Matt C.
We choose to manually install our modules for all of our environments. The CPAN module has a tendency to grab the latest and greatest of everything. One nice thing is to use the CPAN.pm to make a 'snapshot' of your modules and make a bundle out of them. Then just install your custom bundle. You

Re: date compare problems

2002-01-07 Thread Matt C.
It looks very much like you've not installed the Date::Manip module on your system. Have you? If not try this at the command-line: perl -MCPAN -eshell then tell it: install Date::Manip And watch it roll. You may need your sys admin to run 'make install' on it, however. In fact, you may wa

Re: comparing dates

2002-01-07 Thread Matt C.
Check out Date::Manip; it can do just about anything you'd need to do with dates. If speed is of great concern (I use Date::Manip and it performs fine), you may be able to find another Date::* module more specifically tuned to your needs. Definitely try Date::Manip first though, as it will work

Re: Perl installation problem

2002-01-04 Thread Matt C.
This is considered an annoying bug in some versions of the CPAN module, at least by me. If you upgrade the CPAN module itself, it will not try and install perl for you. Worked for me. Oh, and build it by hand. Don't let your old CPAN module try and build it for you or you know what will happen! I

Re: Display filter for emails in mutt

2002-01-01 Thread Matt C.
Check out Text::Wrap: http://www.perldoc.com/perl5.6.1/lib/Text/Wrap.html Matt --- Prahlad Vaidyanathan <[EMAIL PROTECTED]> wrote: > Hi, > > Happy New Year everyone ! > > I've attached a (slightly) updated version of the script I sent sometime > back. I've added a wordwrap subroutine, which wo

Re: Would anybody tell me what is the meaning of "foo" ?

2001-12-30 Thread Matt C.
Here's my understanding, pretty sure I am very close, if not correct. Foo and Bar are parts of a miliary acronym (or at least that is my understanding of its origin), FooBar. Sometimes called FuBar. They stand for: 1) Fouled up beyond all recognition (family version) - or - 2) F*** up beyond al

Re: What's installed?

2001-12-11 Thread Matt C.
I've found that this is by far the easiest...unless you've got modules installed in odd places. No code is needed, although it seems to be used for this purpose alot. Not sure why. perldoc perllocal HTH Matt __ Do You Yahoo!? Check out Yahoo! Sho

Re: Disable ModPerl

2001-12-08 Thread Matt C.
I believe the 'use vars' pragma actually sets up GLOBALS, which very well could be your problem. Scope them locally with 'my', which will keep them from getting re-used with previous values on consecutive hits. Someone please correct me if I'm wrong about the use vars bit...regardless, scope them

Re: calling a server via http

2001-12-08 Thread Matt C.
Check out the following script: I bet you can very easily tailor it to do exactly what you want. I use it for load-testing... I *believe* this is the original "crashme" script from the mod_perl guide written by Stas Bekman (the script was written by someone else and modified by Stas). Not sure wh

Re: Disable ModPerl

2001-12-07 Thread Matt C.
Mod_Perl loads an entire script into memory, which is why you *don't* want variables shared; this is why mod_perl makes you decalre the scope of your variables so carefully. If you are after disabling mod_perl for a specific script or directory, then you'll be able to do it. As far as variables go

Re: NET::TELNET

2001-11-22 Thread Matt C.
Try to use the logging features of this module, which will almost certainly help. It'll create a nice text file for each side of the telnet session that will allow you to see what's going on. If you're running SSH on the box (probably a better idea anyhow), try the Net::SSH::Perl module, which I