simple link checker...

2003-12-10 Thread simran
save them to a file) would be idea. simran. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: How do I install DBD modules

2003-10-31 Thread simran
Hi Dan, There will probably be a README file in the package that will explain how to install them. As a general rule though, the following almost always installs them: * uncompress and untar your file then do: % perl Makefile.PL % make % make test % make install Or if you have the CPAN modul

Re: Opening a new shell

2003-10-27 Thread simran
% perldoc -f fork On Tue, 2003-10-28 at 12:50, Anthony J Segelhorst wrote: > I am strapped for time on the run time on a perl script I have been > working on. > > I was wondering if it is possible to open another shell within a perl > script that will call another script that uses another pr

Re: Making a simple calculator with perl

2003-10-22 Thread simran
On Thu, 2003-10-23 at 10:21, Jeff Borders wrote: > Hello, > > I'm a total newbie with only a few programs under my belt. Anyway, I > would like to create a command line calculator. Like the one available > in python. > > The python interpreter will accept 5+5 or 5 + 5. Perl will as well... he

Re: How to get fields from a SQL DB one by one

2003-10-14 Thread simran
this (the method below) is database dependent, i use it with postgres: sub getFieldNames { my $dbh = new DBI(...) my $sth = $dbh->prepare("SELECT * FROM $table WHERE 1=0"); $sth->execute; # # Get all the field names (execlue the field's we were asked to exclude) and return..

Re: Another sub clean up

2003-10-14 Thread simran
I wrote my self this subroutine... which comes in very handy :-) # # strip # =head2 strip =over =item Description Strips out leading and training whitespaces from references... =item Input * Reference to an array, hash or string or A string =item Return * If input was a refer

Re: array inside an array

2003-10-13 Thread simran
Hello Guru, Your variable in english would be termed as: * An Array whose elements are "Reference to Arrays". As such, you can get to the elements via: $array[0]->[0] will be x1 $array[0]->[1] will be x2 ... $array[2]->[1] will be x8 Have a look at % perldoc perlref for more info... On Tu

Re: Is there a better way to?

2003-10-13 Thread simran
the cpan module: http://search.cpan.org/~miyagawa/Email-Find-0.09/lib/Email/Find.pm might come in handy... On Tue, 2003-10-14 at 13:59, Christopher Lyon wrote: > I have a line of text that I want to pull an e-mail address out from. Is > this the best way to pull that information from that line

Re: regex require a period

2003-10-10 Thread simran
How about something like: /^[a-zA-Z][\w\-\.]{3,}$/ && /\./ On Fri, 2003-10-10 at 16:58, [EMAIL PROTECTED] wrote: > here's the rules: > starts with alphanumeric > 4 chars long > require one period > > /^[a-zA-Z][\w\-\.]{3,}$/ > > I think my regex is not doing the required period. > > thanks, >

Re: how do I pass null arguement?

2003-10-09 Thread simran
Try 'undef'. eg. my procByLastName{ mySubA(undef, "doe"); } On Fri, 2003-10-10 at 16:39, [EMAIL PROTECTED] wrote: > How do I pass a null variable as an argument? Sometime I may want a > wrapper sub as below: > > Example, > ... > sub procName > { my $fname = $_[0]; > my $lname = $_[1]]; > } >

Re: uppercase strings

2003-10-08 Thread simran
Looks like you are almost there... % perldoc -f ucfirst On Thu, 2003-10-09 at 13:41, Sara Gribble wrote: > I would appreciate some help with this. I am learning > Perl. I have a string inputed by the user. This string > is then split, every first letter of each word in the > string is uppercase

Re: Is there a way to print out the contents of a variable in human readable format?

2003-10-01 Thread simran
not sure what you mean... but: % perldoc Data::Dumper might be handy... On Thu, 2003-10-02 at 14:46, Dan Anderson wrote: > Is it possible to print out the contents of a variable in a human > readable format? For instance like PHP's print_r() function? > > Thanks in advance, > > Dan -- To

Re: Single and Double quotes in SQL

2003-09-18 Thread simran
It sounds like you are not using placeholders in your SQL. See: http://www.stupidfool.org/perl/docs/perltut/dbi/dbiplace.html for more information... Using placeholders will take care of the correct escaping of characters automatically, and also will save you program becoming a security nightma

Re: perl modules in java

2003-09-18 Thread simran
Try something like JPL: * http://www.jepstone.net/papers/PerlInside/slide33.html * http://www.jepstone.net/papers/PerlInside/slide34.html the slides are dated 1999 though, which is when i last experimented with it too... i don't know if JPL is supported any more... On Fri, 2003-09-19 at 13:42,

RE: FTP Daemon...

2003-09-04 Thread simran
username/password... I'm hopeful that someone knows of the module "like the above Net::FTPServer" but perhaps slightly more flexible on the authentication side... simran. On Fri, 2003-09-05 at 11:41, Paul Kraus wrote: > Maybe I am misreading this but are you asking if any

FTP Daemon...

2003-09-04 Thread simran
ently have numerous designers accessing files on the server via WebDAV, but DAV seems to be pretty buggy in many respects (or at least the implementation of DAV Clients on windoze is very buggy - causing partial file overwrites on copy, and other errors frequently). simran. -- To unsubscribe, e

Re: why this is not working ??

2003-08-27 Thread simran
Buffering is probably the reason why the file is not written till later. Try putting the following (from memory); - use FileHandle; open (STATUS, ">> status.txt") || die; STATUS->autoflush(1); -- On Wed, 2

XML Document - DTD Validator

2003-08-14 Thread simran
Hi All, Does anyone know of a good perl module through which i can validate XML against a given DTD. Aka, i want to be able to give a perl function/method some XML data and the DTD file location and want it to return if the XML data is valid according to the DTD. simran. -- To unsubscribe

RE: search and match

2003-07-27 Thread simran
here's something to get you started... -- use Data::Dumper; my %keep; while() { chomp; if ($_ =~ s!(.*)/(.*)?!$1!g) { $keep{$2} = $2; print "$_\n"; } else { warn "$_ did not mattch our pattern"; } } warn Dumper(\%keep); __

Re: Hash of anon arrays

2003-07-07 Thread simran
On Tue, 2003-07-08 at 04:32, Paul Kraus wrote: > I have a hash like this > > $hash{key}=['item1','item2']; > > Later on I want to push item3 into the array. The value of the hash element is a 'reference to an array', so you will need to do something like: push(@{$hash{key}}, 'item3'); --

Re: complex data storing

2003-07-03 Thread simran
Have a look at the 'Storable' (perldoc Storable) module... On Fri, 2003-07-04 at 07:15, awarsd wrote: > Hi, > > I want to save a hash as followed > $hash{$name}->[$option] = $value; > I have some information, > when $name can have more than one information, and it would be Wonderfull > and much

Re: accessing the string from system("ls -al") / browse dir script

2003-04-06 Thread simran
Stat::lsMode would probably be of interest as well. http://search.cpan.org/author/MJD/Stat-lsMode-0.50/lsMode.pm On Mon, 2003-04-07 at 10:41, R. Joseph Newton wrote: > [EMAIL PROTECTED] wrote: > > > > > Hello Mother, > > > > While not knowing exactly what you want to do, > > in general you can

Re: Perl Mailer

2003-04-02 Thread simran
Search for MIME::Entity on http://search.cpan.org/ On Thu, 2003-04-03 at 10:39, Hytham Shehab wrote: > hi guys, > is anybody here knows a good script - good means MIME attachments - that > act as a mailer agent ? > > i have write some small scripts myself, but if someone can handle MIME and

Re: Help required

2003-03-30 Thread simran
Have a look at the MIME::Entity module on http://search.cpan.org/ Use that to build your message, and then one of the mail modules, or even sendmail to send the message. On Mon, 2003-03-31 at 16:49, Brijesh Kanderia wrote: > Hi All, > > I dont have very much idea about perl programing. I have

Re: Linux Perl Editor

2003-03-13 Thread simran
How about "vim" - on vim's sf site (vim.sourceforge.net) there are plenty of handy macro scripts for perl editing as well. On Fri, 2003-03-14 at 07:36, Thorsten Dieckhoff wrote: > > > Is there a perl Editor for linux? (except EMACS) > > Perhaps have a try with nedit - HTH Thorsten -- To unsu

Re: reading a html page

2003-03-10 Thread simran
Try: http://search.cpan.org/search?query=html&mode=all On Tue, 2003-03-11 at 10:38, learn perl wrote: > Hi guys, is there Modules that would read an html file? or handles html > file? > > Thanks > > Eric -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

Re: Handling race conditions

2003-03-07 Thread simran
s the -e $lockfile test (aka no lockfile exists) * 2nd process starts and checks for the $lockfile before the first process has had a chance to: open(LOCK, ">$lockfile") I'd probably start looking at semaphores to solve some

Re: Handling race conditions

2003-03-06 Thread simran
issues and timed autounlocks for stale files etc... As you can see though, if you want a fairly reliable locking system, you do have to take care of quite a few conditions... You might want to use the flock subroutine in perl and use that... ( http://perl.about.com/library/weekly/aa011203a.htm ) simran. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Get list of available modules?

2003-03-03 Thread simran
how CPAN build's the snapshot, you can look at the "autobundle" subroutine in CPAN.pm simran. On Tue, 2003-03-04 at 07:54, Scott R. Godin wrote: > Dave K wrote: > > > > >> Greetings! > > Hello > >> > >> I'm trying to do some Perl for

Re: How do I return multiple discrete arrays and/or hashes from a subroutine?

2003-02-25 Thread simran
Have a look at: % perldoc perlsub Esentially you can't return multiple array's (you probably can with fancy prototyping - but i'm not sure of that) - you usually have to use references instead. On Wed, 2003-02-26 at 09:05, Lance Murray wrote: > Hello: > > I know I can return multiple scala

Re: Where to I get sendmail for Win98?

2003-02-18 Thread simran
I don't think sendmail is available for windows machines... Try something like "blat": http://www.interlog.com/~tcharron/blat.html On Wed, 2003-02-19 at 11:12, Rob Richardson wrote: > Greetings! > > The script I am trying to improve uses sendmail. Before I install the > script on its target U

Re: fast perl executable ?

2003-02-13 Thread simran
depends on the task being performed and the level of optimisation performed on the code. On Fri, 2003-02-14 at 14:15, [EMAIL PROTECTED] wrote: > hi all, > > how fast are the perl executables when compared with perl scripts and > also when compared with C executable on linux ? > > regards, > K

Re: exceptions && exception objects

2003-02-13 Thread simran
If java style exceptions are what is needed, then try: http://search.cpan.org/author/PJORDAN/Exception-1.4/Exception.pm http://search.cpan.org/author/IX/libservlet-0.9.2/lib/Servlet/ServletException.pm simran. On Fri, 2003-02-14 at 14:56, R. Joseph Newton wrote: > "Shaw, Steve

Re: What's a -|?

2003-02-13 Thread simran
'-' is usually STDIN or STDOUT... in the way you are using it, its "pipe in from STDIN" On Fri, 2003-02-14 at 14:48, Troy May wrote: > I have this line in one of my scripts: > > if ( $pid = open( SWISH, '-|' ) ) > > Why am I opening -|? And what is it? > > Thanks. -- To unsubscribe, e-ma

Re: perl executable ?

2003-02-13 Thread simran
Not sure about how to do it via perlcc, but you can alternatively try: http://www.perl2exe.com/ On Fri, 2003-02-14 at 08:08, [EMAIL PROTECTED] wrote: > hi all, > if i want to make a standalone executable of my perl program how do i do > that with perlcc ??? > or any other way to generate machinec

Re: Calling a Perl Script from Another Perl Script

2003-02-12 Thread simran
If you just wanted to use the other script and not return, look at "exec": % perldoc -f exec simran. On Thu, 2003-02-13 at 09:45, Jeff Westman wrote: > This seems simple enough I have two separate, independent perl scripts. > I want to call one perl script from the othe

Re: can I should I shift/push an array in a foreach loop?

2003-02-11 Thread simran
>> Re: can I should I shift/push an array in a foreach loop? not a very good idea... try using the while structure instead if you need to do so... On Wed, 2003-02-12 at 10:23, Lance Murray wrote: > Hello: > > I've been away from the Learning Perl book for a few weeks and trying to refresh >

Re: finding rows in a large file (22 millions of rows)

2003-02-10 Thread simran
use Perl; * split data into smaller data bits * clean smaller data bits * merge smaller data bits into slightly larger data bits * repeat last two steps until all data is clean > > We are trying to load date into teradata [which is > data warehousing, stores Terabytes of data, and which > is

Re: Use of uninitialized value in pattern match (m//) at test.pl line 85.

2003-02-02 Thread simran
perhaps such a statement would suit: $var = defined $var ? $var : 10; On Mon, 2003-02-03 at 09:37, Rob Dixon wrote: > "John W. Krahn" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > [EMAIL PROTECTED] wrote: > > > > > > $var|=10; # like that if u want to se

Re: system call

2003-01-29 Thread simran
not sure what you mean... but try: perldoc perlsec as a starting point... On Thu, 2003-01-30 at 12:38, jdavis wrote: > hello, > Could someont tell me the secure way > to get input from a system call > like... > > $date = `/bin/date`; > > or > > $client = `/usr/bin/finsmb`; > > TIA, > -

Re: finding protocal script is called with

2003-01-22 Thread simran
Assuing you are using apache and only ever run ssl over port 443 (which is the standard) you could use the SERVER_PORT environment variable... aka: $secure = $ENV{'SERVER_PORT'} eq '443' ? 1 : 0; if ($secure) { # do secure stuff... } else { ... } On Thu, 2003-01-23 at 13:19

Re: Resolving IP's/Hostmasks

2003-01-22 Thread simran
Try the function: gethostbyaddr or you could use: http://search.cpan.org/author/JHI/perl-5.8.0/lib/Net/hostent.pm On Thu, 2003-01-23 at 13:21, dan wrote: > Hey > > I need a method that resolves Hostmasks into IP's, and IP's into hosts. I > can do the former, with: > > sub resolve { > return

Re: FW: Removing HTML Tags

2003-01-22 Thread simran
On Thu, 2003-01-23 at 13:12, Toby Stuart wrote: > small modification below. > > > -Original Message- > > From: Toby Stuart [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, January 23, 2003 12:56 PM > > To: 'Johnstone, Colin' > > Cc: '[EMAIL PROTECTED]' > > Subject: RE: Removing HTML Tags > >

Re: Removing HTML Tags

2003-01-22 Thread simran
To do it reliably use something like HTML::Parser. You can come up with a very simple regex to take care of the simple cases: eg. $html =~ s!.*?!!igm; But you will run into problems very soon with nested tags etc... On Thu, 2003-01-23 at 12:28, Johnstone, Colin wrote: > Gidday all, > >

Re: Why shouldn't class modules export anything?

2003-01-21 Thread simran
ser wants to import the method into their name space, they explicitly have to do so. eg: use Train qw(SetName); I never export anything and always get the user to use the methods as: class method: Train->SetName(...); object method (which is what i think you

Re: Bareword Constant from Package giving problems with use strict....

2003-01-21 Thread simran
not sure what you mean... but perhaps the following might help: * use constant ABC => 'this is some text'; * use vars ... On Wed, 2003-01-22 at 12:28, Michael Kingsbury wrote: > How do I use a (known) Bareword constant from a package when strict's on? > > -mike -- To unsubscribe, e-mai

Re: trapping errors in "use"

2003-01-20 Thread simran
from 'perldoc -f use' use Module (); That is exactly equivalent to BEGIN { require Module } me thinks, what you want is > #!/usr/bin/perl > BEG

Re: My, our, local

2003-01-20 Thread simran
Hmm... in "simple terms" :-) i don't know if simplicity exists when telling the difference between our,my,local but here goes: our --- * Is Global * $ABC::DEF::ghi is identical to our $ghi when in package ABC::DEF my/local * my is very tightly scoped * my variab

Re: slurping function like shell

2003-01-20 Thread simran
explicit return in. aka, sub lctime { ... ... return sprintf(...); } At the moment your printf statement is returning "true" (or '1') which is the reason you are having '1' printed. simran. On Tue, 2003-01-21 at 14:01, Harry Putnam wrot

RE: Adding new path to @INC

2003-01-20 Thread simran
Or you can use * The PERL5LIB environment variable * the "use lib" pragma... * Compile perl with your library path in it On Tue, 2003-01-21 at 03:14, [EMAIL PROTECTED] wrote: > Sure. > #!/usr/local/bin/perl > > BEGIN { >unshift (@INC, "Your/path/needed"); > } > > print "@INC\n"; >

Re: Finding IP address connected to your http server.

2003-01-16 Thread simran
if (you are looking for connections that have come in over time) then look in the log file else if i you are looking for the ip that is current connecting to the cgi script you can usually find that info in the environment variable REMOTE_ADDR - $ENV{'REMOTE_ADDR'} else t

Re: help:how to hex2bin,bin2hex,bin2dec,dec2bin

2003-01-16 Thread simran
perldoc -f pack perldoc -f unpack On Sun, 2038-01-17 at 12:55, billy wrote: > are there some commands or function? > thanks for your response. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: write to file

2003-01-16 Thread simran
open(OUT, "> test.txt") || die; print OUT "This is a test...\n"; print OUT "More text...\n"; close(OUT); On Fri, 2003-01-17 at 08:26, [EMAIL PROTECTED] wrote: > How can I write to a file in perl. > > Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

Re: Splitting a variable

2003-01-16 Thread simran
Try using the Text::CSV module... On Fri, 2003-01-17 at 10:12, Scott, Joshua wrote: > I've got a CSV file which I need to process. The format is as follows. > > "Smith, John J",1/1/2002,1/15/2002,"Orlando, FL",Florida > "Doe, John L",1/1/2002,1/15/2002,Los Angeles, California > > I've tried sp

Re: suppress STDIN from user

2003-01-09 Thread simran
Have a look at Term::ReadKey ... You need to set noecho (i think...) On Fri, 2003-01-10 at 11:32, Jose Malacara wrote: > Is there a way for perl to suppress or mask user input at the STDIN? For example, a >password or login prompt Not really trying to implement any real security here, >jus

Re: File Handle?

2003-01-08 Thread simran
Haven't needed to do this myself... but how about something like: == use FileHandle; open(AB, "/etc/passwd") || die; $a = AB->fileno; print "A=$a\n"; === On Thu, 2003-01-09 at 15:43, Beau E. Cox wrote: > Hi

Re: Perl Help

2003-01-05 Thread simran
Adam, Not sure exactly what you are trying to do, but from what i gather... you don't want to say: @fieldprice > 0 as that will put the "array" fieldprice in scalar contect, and give you back the number of elements in that array... Now Assuming: $fieldprice = 14.95 You should be able to

Re: linked list's

2002-12-09 Thread simran
That line just says... * If $head is true, then leave it alone, else set it to the value of $link (aka: $head ||= $link _is the same as_ $head = $head || $link) simran. On Tue, 2002-12-10 at 13:34, Mark Goland wrote: > Ok I got it working now, thanx much Jason. Only question I have

Re: How does the Perl Module called "NET:ftp" logon to an FTP server?

2002-12-09 Thread simran
working again. The Net::FTP modules will not do much differently to how a command line ftp would do things (as FTP is a pretty standard protocol). simran. ps: Try "ncftp" - its a lot more configurable than normal ftp and i know it works with both passive/active modes. On Mon, 2002-1

Re: weird problems (dunno a good subject)

2002-12-08 Thread simran
sounds like some needed program/script is in your PATH when you run the script but not when you are in the shell... are you modifying your PATH variable in your script? On Mon, 2002-12-09 at 12:23, christopher j bottaro wrote: > hello again, > i wrote a perl script to compile and install kde for

Re: crypt()

2002-12-08 Thread simran
The first two letters of the encrypted string are the salt. eg: my $password = "abc"; my $salt = "GH"; my $encrypted = crypt($password, $salt); print "$encrypted\n"; print substr($encrypted, 0, 2), "\n"; will give you GHl/YThw3THFc GH On Sun, 2002-12-08 at

Re: Difference between $count++ and ++$count

2002-12-06 Thread simran
Yup... good catch... i should run my code rather than just type it in a mail window i guess :-) > Don't you mean ++$count?? > > > my $i = $++count; > > print "$i\n"; > > > > On Sat, 2002-12-07 at 03:54, Mystik Gotan wrote: > > > Hiya, > > > > > > is there any difference between $count++

Re: Difference between $count++ and ++$count

2002-12-06 Thread simran
Yup... In program 1 you will get $i to be 1 and then $count will be set to 2 In program 2 you will get $count to be set to 2 and then assigned to $i so now $i will also be 2. Its just a prcedence thing... Program 1 -- my $count = 1; my $i = $count++; print "$i\n"; Program 2

RE: Hash Question

2002-12-06 Thread simran
To interate over something like: $abc{'a1'}{'b1'} = $number1 $abc{'a2'}{'b2'} = $number2 $abc{'a3'}{'b3'} = $number3 $abc{'a4'}{'b4'} = $number4 ... You can use: foreach my $key1 (keys %abc) { foreach my $key2 (keys %{$abc{$key1}}) { my $value = $abc{$key1}{$key2} pri

Re: what is this?

2002-12-06 Thread simran
perldoc perlrun On Fri, 2002-12-06 at 22:39, Tom Allison wrote: > simran wrote: > >>From the docs... > > > > > > -S makes perl use the PATH environment variable to search > > > > > > > > > > On Fri, 2002-12-06 at 12:49, Tom

Re: what is this?

2002-12-05 Thread simran
>From the docs... -S makes perl use the PATH environment variable to search for the script (unless the name of the script starts with a slash). Typically this is used to emulate #! startup on machines that don't support #!, in the fol- lowing m

Re: problems with redirect page

2002-12-04 Thread simran
Sounds to me like you are doing a redirect *after* you have sent your normal headers... aka, you have already sent a Content-Type header earlier in your script... take that out and it should work. On Thu, 2002-12-05 at 14:04, perl wrote: > I'm trying to make a page redirect to a homepage if a us

Re: limiting resource in regex matching

2002-11-28 Thread simran
very interesting question... i can't wait to hear a solution myself if anyone out there knows of one... you might want to put the regex inside an "alarm/eval" block anyway so that at least you can limit the maximum time it takes... simran. On Fri, 2002-11-29 at 13:48, David

Re: Help on file operation

2002-11-27 Thread simran
You might wish to try: sysopen(HANDLE, $path, O_RDWR|O_CREAT|O_EXCL) or die "sysopen $path: $!"; or from memory (mine), you can use: open(HANDLE, "+< $path") || die "open $path: $!"; On Thu, 2002-11-28 at 13:37, Weijie Ding wrote: > Hi, guys,