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
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
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
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
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
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
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
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
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
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
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",
> >
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
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
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
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
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
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
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;
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/
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
---
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
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
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
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
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
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
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 -
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
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
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
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
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
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
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
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
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
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
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
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
39 matches
Mail list logo