[15627] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3040 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 14 03:08:35 2000

Date: Sun, 14 May 2000 00:05:11 -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: <958287911-v9-i3040@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 14 May 2000     Volume: 9 Number: 3040

Today's topics:
    Re: alarm problem <aahz@gol.com>
        Announce: ALPHA version of MIME-tools 5.110 on-line, wa <eryq@zeegee.com>
        Better way to do this? <slu_2@altavista.net>
    Re: counter <andy@u2me3.com>
        DBD::ODBC error <aahz@gol.com>
        Execute permissions of a directory <sentwisle@ozemail.com.au>
    Re: Execute permissions of a directory (Abigail)
    Re: Execute permissions of a directory <sentwisle@ozemail.com.au>
        Files in subdirectories chris2037@my-deja.com
    Re: Files in subdirectories <beaumontsystems@netscapeonline.co.uk>
    Re: Help wanted (David H. Adler)
        How do I get a user's home directory with NIS+? <shouck@bellatlantic.net>
    Re: How do I get a user's home directory with NIS+? (Abigail)
    Re: How to replace "\" , HELP! <jeff@vpservices.com>
    Re: How to replace "\" , HELP! <lr@hpl.hp.com>
    Re: I need help installing Perl jvs@camtech.net.au
    Re: New to Perl, How to get started (Peter J Scott)
    Re: New to Perl, How to get started <anmcguire@ce.mediaone.net>
    Re: Now serving 15? (How can I setup a small server in  (Abigail)
    Re: Please Help friend on perl problem <jeff@vpservices.com>
    Re: Problem with server scripting <andy@u2me3.com>
    Re: Regular Expressions help malverian@hotmail.com
    Re: Regular Expressions help <anmcguire@ce.mediaone.net>
    Re: Regular Expressions help (Abigail)
    Re: Running perl code thru crontab <you.will.always.find.him.in.the.kitchen@parties>
        Split Function <sentwisle@ozemail.com.au>
    Re: Split Function <mjcarman@home.com>
    Re: spoofing identity (Abigail)
    Re: This error catching code should work right? <mjcarman@home.com>
    Re: Update problem with DBI-ODBC and MSAccess <jeff@vpservices.com>
    Re: What's this line which Perl added to AUTOEXEC.BAT? <aahz@gol.com>
    Re: where can i find perl? (Abigail)
    Re: where can i find perl? <aahz@gol.com>
    Re: Why does Perl do this? (Abigail)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 14 May 2000 04:57:49 GMT
From: "Chris Williams" <aahz@gol.com>
Subject: Re: alarm problem
Message-Id: <hnqT4.1582$uL2.110994@nnrp.gol.com>

If you are working on a Windows system, it appears to not be implemented.

"beaumontsystems" <beaumontsystems@netscapeonline.co.uk> wrote in message
news:391d9c7a_1@plato.netscapeonline.co.uk...
> I am having a problem using alarm().
> When I have the line...
>   alarm(0);
> ... I get the error message...
> "The Unsupported function alarm function is unimplemented at line xxx".
> I cant figure out what this means. Ive looked at perldoc -f alarm.
> Any ideas/suggestions ?
>
> Andrew Fry
>
>
>



------------------------------

Date: Fri, 12 May 2000 17:25:49 -0400
From: Eryq <eryq@zeegee.com>
Subject: Announce: ALPHA version of MIME-tools 5.110 on-line, wants testers
Message-Id: <8fl01v$lvo$1@play.inetarena.com>

If folks out there would like to be of assistance, I'm
in the middle of making changes for the upcoming release
of MIME-tools 5.x., and I'd really love wide-audience 
testing and feedback [especially from you Mac and Win folks].

Code and docs for this ALPHA release of MIME-tools 5.110 
are on-line at:

	http://www.zeegee.com/code/perl/MIME-tools/

You'll need the latest IO-stringy, 1.211 (which is NOT Alpha, so
you can just install it), and you can get that from:

	http://www.zeegee.com/code/perl/IO-stringy/

Major changes in MIME-tools 5.x:

	* Speed.  If you follow the guidelines set forth
	  in the MIME::Parser docs, the parser can be orders
	  of magnitude faster than the previous releases,
	  particularly if you have lots of binary attachments.
	  And it may get faster still.

	* Simplicity.  Gone is MIME::ParserBase; MIME::Parser
	  has all the goods.

	* More parsing options, including one which puts each
	  message's extracted data in an easy-to-clean-up,
	  created-on-the-fly, one-per-message directory.

Soon to come:

	* A tutorial (uh, anyone have one they want to donate?)

	* You tell me... what's still missing here?

5.x is Alpha, but it should be a drop-in replacement for 4.x (provided 
you didn't do anything directly with MIME::ParserBase).  
Odds are you'll get some deprecation warnings.
Also, the defaults for some parser options have changed, so be warned!

If it fails to parse a message properly, PLEASE send me the
message so I can make the fix and add it to the regression
tests.


Thanks in advance,


Eryq

(and a big thank you to Doru Petrescu and others responsible for
all the speed improvements and sundry good ideas)




------------------------------

Date: Sun, 14 May 2000 00:20:38 -0400
From: Sydney Lu <slu_2@altavista.net>
Subject: Better way to do this?
Message-Id: <f5ashsogc770k0q2nt6iej7j7pd9dsfr13@4ax.com>

I have a string that I need to split into fields, with each field
delimited by commas. I'd use split, but I don't want a comma that's
inside a quote to be split.

So I came up with

sub _our_split	
{
	my $is_in_quote = 0;
	my @fields;
	my $current_pos;
	my $current_array_element = 0;
	my $temp_letter;		
	my $string = shift;
	

	for $current_pos (0 .. length($string) - 1)
	{

		$temp_letter = substr($string, $current_pos, 1);
	
		if ( ($temp_letter eq ',') && ($is_in_quote == 0) )
		{
			$current_array_element++;
		}
		elsif ( $temp_letter eq '"')
		{
			if ($is_in_quote == 0)
			{
				$is_in_quote = 1;
			}
			else
			{
				$is_in_quote = 0;
			}
			
			$fields[$current_array_element] .=
$temp_letter;
		}
		else
		{
			$fields[$current_array_element] .=
$temp_letter;
		}

	}

	return @fields;


}


is there a faster and easier regexp that would do the same thing? This
works, but it's messy, and really slow, which isn't good when I need
to process 500 lines every time someone clicks on my Tk widget...

TIA,
Sydney



------------------------------

Date: Sat, 13 May 2000 21:38:43 +0100
From: "Andy Chantrill" <andy@u2me3.com>
Subject: Re: counter
Message-Id: <8fkel0$2uo$1@plutonium.btinternet.com>

Try http://www.cgi-resources.com




------------------------------

Date: Sun, 14 May 2000 01:10:24 GMT
From: "Chris Williams" <aahz@gol.com>
Subject: DBD::ODBC error
Message-Id: <42nT4.1576$uL2.110760@nnrp.gol.com>

I have tried many multiples of various DSN's but continuously get the same
error message:

DBI->connect failed: [Microsoft][ODBC Driver Manager] Invalid string or
buffer length (SQL-S1090)(DBD: db_login/SQLConnect err=-1) at DBConnect line
3.

I am using ActivePerl 613 on Windows 2000.

I have tried:

use DBI;

my $dbh = DBI->connect("dbi:ODBC:driver=Microsoft Access Driver
(*.mdb);dbq=\\\\A\\Test.mdb");

I also tried this with single quotation marks instead of double.  I tried
also with using c:\\A\\Test.mdb and \\A\Test.mdb and c:\A\Test.mdb.  I also
tried using uppercase and lowercases on "dbq." Alternatively I tried finding
the actual driver (using regedit) and so have also tried:

DBI-connect("dbi:ODBC:driver=\\\\WINNT\\System32\\odbcjt32.dll;dbq=\\\\A\Tes
t.mdb);

I have tried this also with the aforementioned variations plus filling in
the extra information given in the registry listing (FIL, PWD, UID) and
trying with various variation of order, which were used (getting rid of
FIL), and capitalization (driver is called Driver in the Registry.)  Also I
tried adding a (*.mdb) after the driver path.

So basically, of the hundreds of variations I tried, I can only conclude
that I am missing something (which is quite likely, as this is my first
attempt to access a database of any kind) or that I have found some new
error.

Please help! (thanks to all of you who do)



------------------------------

Date: Sun, 14 May 2000 14:13:19 +1000
From: "Susan Entwisle" <sentwisle@ozemail.com.au>
Subject: Execute permissions of a directory
Message-Id: <UEpT4.28400$PL4.565919@ozemail.com.au>

Hi,

I am writing a perl script to search through file(s) searching for regular
expressions.  The command line syntax for this is

wsearch.pl regular-expression filename

both the regular-expression and filename arguments must be able to specified
in any position.  To allow for I use the following logic:

if it is a filename
    add to to array of files to search
else
   must be a regular expression, assign to reg expr variable

Now I would like to introduce testing if the directory that the filename is
located in has execute permissions (yet still allow for the regular
expression to include the path separator) - if the directory does not have
execute permissions I want to display an error and exit.

I have tried using the following code but it does not work:

$matchcount=grep(/'/'/, $ARGV[0]);
if ($matchcount)
{
   @sections=split(/'/'/, $ARGV[0]);
   foreach $currsection(@sections)
   {
      if (-d $ARGV[0])
      {
         if (-X $ARGV[0])
         {
            print "Directory with execute persmissions";
         }
         else
         {
            print "Directory does not have execute permissions";
            exit(1);
         }
      }
      else
      {
         print "Regular expression with / in it";
         last;
      }
   }
}
else
{
   print "Normal Regular expression";
}

Thank you

Cheers
Susan Entwisle








------------------------------

Date: 14 May 2000 06:20:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Execute permissions of a directory
Message-Id: <slrn8hshcn.92f.abigail@ucan.foad.org>

On Sun,
14 May 2000 14:13:19 +1000, Susan Entwisle <sentwisle@ozemail.com.au> wrote:
++ 
++ I have tried using the following code but it does not work:
++ 
++ $matchcount=grep(/'/'/, $ARGV[0]);

"doesn't work" is a bit vague. 

Your code doesn't even compile. You might want to study perlop, specially
the part that explaines the details on interpolation.



Abigail


------------------------------

Date: Sun, 14 May 2000 17:00:39 +1000
From: "Susan Entwisle" <sentwisle@ozemail.com.au>
Subject: Re: Execute permissions of a directory
Message-Id: <L5sT4.28528$PL4.569913@ozemail.com.au>

Must apologies I posted the wrong version of the code to the newsgroup it
should have been:

# Prototype to testing directories for executable and regular expressions
$matchcount=grep(/\//, $ARGV[0]);
if ($matchcount)
{
   @sections=split(/\//, $ARGV[0]);
   foreach $currsection(@sections)
   {
       if (-d $currsection)
      {
            if (-X $currsection)
            {
               print "Error Dir  with execute permissions \n";
            }
            else
            {
               print "Error Dir does not have execute permissions \n"
            }
      }
      else
      {
         print "Regular expression with / in it";
      }
   }
}
else
{
   print "Normal Regular expression";
}

The problems that I can see with above are:

a) if the regular expression itself contains a / it will be split into
portions and tested as if were a directory

Any suggestions would be appreciated.

Cheers
Susan Entwisle


"Abigail" <abigail@foad.org> wrote in message
news:slrn8hshcn.92f.abigail@ucan.foad.org...
> On Sun,
> 14 May 2000 14:13:19 +1000, Susan Entwisle <sentwisle@ozemail.com.au>
wrote:
> ++
> ++ I have tried using the following code but it does not work:
> ++
> ++ $matchcount=grep(/'/'/, $ARGV[0]);
>
> "doesn't work" is a bit vague.
>
> Your code doesn't even compile. You might want to study perlop, specially
> the part that explaines the details on interpolation.
>
>
>
> Abigail




------------------------------

Date: Sun, 14 May 2000 05:18:26 GMT
From: chris2037@my-deja.com
Subject: Files in subdirectories
Message-Id: <8flcur$ffg$1@nnrp1.deja.com>

I have the following code which will list the files in a given
directory:


#!/usr/local/bin/perl

$namev = "dir1";
$curdir = "/public/staff/usern";


opendir DH, "$curdir/$namev"  or die "Can't open: $!";

while ($namev = readdir(DH)) {
		print "$namev\n";

	}
closedir(DH);


dir1 could have subdirectories which in turn can have subdirectories...

I have looked at perlfunc and perldoc, neither goes into this. Can
anyone help? Thanks.




Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Sun, 14 May 2000 06:40:11 +0100
From: "beaumontsystems" <beaumontsystems@netscapeonline.co.uk>
Subject: Re: Files in subdirectories
Message-Id: <391e3c35_1@einstien.netscapeonline.co.uk>

It's just a matter of using loops and subroutines (and recursion) to descend
down
into the tree.
Having determined the set of objects that exist in the top-level directory,
you
need to test each one in turn to see if it is a directory (-d xxx), and if
it is,
you can then do an opendir/readdir/closedir on this subdirectory.

---
Andrew

<chris2037@my-deja.com> wrote in message news:8flcur$ffg$1@nnrp1.deja.com...
> I have the following code which will list the files in a given
> directory:
>
>
> #!/usr/local/bin/perl
>
> $namev = "dir1";
> $curdir = "/public/staff/usern";
>
>
> opendir DH, "$curdir/$namev"  or die "Can't open: $!";
>
> while ($namev = readdir(DH)) {
> print "$namev\n";
>
> }
> closedir(DH);
>
>
> dir1 could have subdirectories which in turn can have subdirectories...
>
> I have looked at perlfunc and perldoc, neither goes into this. Can
> anyone help? Thanks.
>
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




------------------------------

Date: 14 May 2000 05:37:49 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Help wanted
Message-Id: <slrn8hsetd.t6.dha@panix6.panix.com>

On Mon, 08 May 2000 11:02:47 GMT, Dan Graham <dan@maxos.com> wrote:
>This is a multi-part message in MIME format.
>--------------24FEBDC576DFA6BD3578ECA9
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>
>Programmers wanted for Linux dev, C, C++, TKL/TK and Perl prefered in

*sigh*

First of all, please don't post multi-part messages in mime format to
usenet - it is a plain text medium.

Beyond that...

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :)

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

There is a Perl Jobs Announce list that may be more helpful to you.  See
<http://www.pm.org/mailing_lists.shtml> for details.

Yours for a better usenet,

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Learned?  You must be crazy.  Do you think I could play as badly as
this if I had had lessons?	- Patrick Troughton


------------------------------

Date: Sun, 14 May 2000 06:41:23 GMT
From: Scott Houck <shouck@bellatlantic.net>
Subject: How do I get a user's home directory with NIS+?
Message-Id: <dgishs4iln27ithtjeqiokhvduhf2uds01@4ax.com>

I have a Perl program where I'd like to store options the user wants
to save in a .dot file in their home directory.  This is on Solaris
2.6 with NIS+, so I can't use getpwent.  I know almost nothing about
NIS+, but this sounds like a common task.  From browsing through the
manpages, I figured out a brute force way to get it, but it probably
isn't very efficient, and I'm not sure it will always work:

$user = `whoami`;
$nisinfo = `niscat passwd.org_dir | grep $user`;
$home_dir = (split /:/, $nisinfo)[5];

Is there a better way to do this?

Scott Houck


------------------------------

Date: 14 May 2000 06:52:00 GMT
From: abigail@foad.org (Abigail)
Subject: Re: How do I get a user's home directory with NIS+?
Message-Id: <slrn8hsj8g.92f.abigail@ucan.foad.org>

On Sun, 14 May 2000 06:41:23 GMT, Scott Houck <shouck@bellatlantic.net> wrote:
++ I have a Perl program where I'd like to store options the user wants
++ to save in a .dot file in their home directory.  This is on Solaris
++ 2.6 with NIS+, so I can't use getpwent.  I know almost nothing about
++ NIS+, but this sounds like a common task.  From browsing through the
++ manpages, I figured out a brute force way to get it, but it probably
++ isn't very efficient, and I'm not sure it will always work:
++ 
++ $user = `whoami`;
++ $nisinfo = `niscat passwd.org_dir | grep $user`;
++ $home_dir = (split /:/, $nisinfo)[5];
++ 
++ Is there a better way to do this?


Well, that's going fail if you have usernames that are substrings of
other user names, or substrings of (encrypted) passwords, comments,
shells or home directories.

Imagine what can happen to an account named "home"!

Most shells will set the HOME environment variable.

Of course, the question has not much to do with Perl. You might want to
ask in a Solaris group.



Abigail


------------------------------

Date: Sat, 13 May 2000 18:57:08 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How to replace "\" , HELP!
Message-Id: <391E07F4.643C7482@vpservices.com>

malverian@my-deja.com wrote:
> 
> > have no control on the \
> 
> Very simple mistake, if you want to print a \ you must use \\
> I'm guessing you are using something like this..
> 
> $location = 'c:\this\folder\file.file';
> 
> you will have to use the following
> 
> $location = 'c:\\this\\folder\\file.file';


If you had read any of the other replies to this question you would know
that you have just given exactly the opposite advice to the corret
advice.  Your first example is fine, with single quotes, you don't need
(and can't use double backslashes).  Your second example mistakenly puts
double backslashes inside single quotes.

-- 
Jeff


------------------------------

Date: Sat, 13 May 2000 23:07:08 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to replace "\" , HELP!
Message-Id: <MPG.1387e2674814bbaf98aa78@nntp.hpl.hp.com>

In article <391E07F4.643C7482@vpservices.com> on Sat, 13 May 2000 
18:57:08 -0700, Jeff Zucker <jeff@vpservices.com> says...
> malverian@my-deja.com wrote:
> > 
> > > have no control on the \
> > 
> > Very simple mistake, if you want to print a \ you must use \\
> > I'm guessing you are using something like this..
> > 
> > $location = 'c:\this\folder\file.file';
> > 
> > you will have to use the following
> > 
> > $location = 'c:\\this\\folder\\file.file';
> 
> 
> If you had read any of the other replies to this question you would know
> that you have just given exactly the opposite advice to the corret
> advice.  Your first example is fine, with single quotes, you don't need
> (and can't use double backslashes).  Your second example mistakenly puts
> double backslashes inside single quotes.

s/mistakenly/needlessly/

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Sun, 14 May 2000 00:32:49 GMT
From: jvs@camtech.net.au
Subject: Re: I need help installing Perl
Message-Id: <FuIxIp.50n@camtech.net.au>

bjanko <waldo700NOwaSPAM@aol.com.invalid> writes:
> Thanks for the help.  I went to activestate.com and was able to
> install the program.  However, it wrote the following line into
> my AUTOEXEC.BAT:
> 
> SET PATH=C:\Perl\bin\
> 
> With this line in the code my computer won't reboot.  What am I
> doing wrong?  What's the solution?

This line has killed off the usual PATH environment variable which
points to the WINDOWS directories, hence no booting.

change this to something like :

SET PATH=%PATH%;C:\Perl\bin\

which should *append* the Perl directories to the Windows directories
in the PATH.

(I'm not completely sure of the syntax, I prefer Unix)

Jack
-- 
Jack Strangio (jvs@camtech.net.au)

"32K Memory Expansion Unit for IBM Personal Computer:     $325"
  - Byte, Page 32, October 1981.


------------------------------

Date: Sun, 14 May 2000 01:06:24 GMT
From: peter@PSDT.com (Peter J Scott)
Subject: Re: New to Perl, How to get started
Message-Id: <k_mT4.29908$q_4.749443@news1.gvcl1.bc.home.com>

In article <SVlT4.59789$g4.1651932@newsread2.prod.itd.earthlink.net>,
 "langg" <langg@earthlink.net> writes:
>I'm new to Perl and new to Linux.  I have Linux Mandrake and Perl 5 is
>located at /usr/lib/perl5.  Once I write some code what do I need to do to
>run the Perl complier?  Thanks for any help.

If you're as new as you sound, you don't want what the Perl community calls
the Perl compiler (create standalone executables from Perl code) due to its
limitations and experimental status.

Assuming you just want to run plain ol' Perl (yes, it is 'compiled', but out of
deference to the fact that the situation is somewhat more complicated than that implies,
people just refer to 'running a Perl program or script') and want to know how to get 
started, it sounds like you want a tutorial.  In which case, may I suggest you start
by typing

	perldoc perlbook
and
	perldoc perlfaq2

at your spiffy new Linux shell prompt and follow the recommendations.

-- 
Peter Scott
Peter@PSDT.com


------------------------------

Date: Sat, 13 May 2000 22:42:25 -0500
From: "Andrew N. McGuire" <anmcguire@ce.mediaone.net>
Subject: Re: New to Perl, How to get started
Message-Id: <391E20A1.BAF5076A@ce.mediaone.net>

malverian@hotmail.com wrote:
> 
> >Once I write some code what do I need to do to
> > run the Perl complier?  Thanks for any help.
> 
> First off, good choice in switching to Linux =)
> All you have to do to compile and run a program is type
> 'perl <program>'
> That simple.
> Make sure you are in the directory of the program when you type it.

Whoa, why do that every time?  Just put the line:

#!/usr/bin/perl

at the top of your script, or you could put:

#!/usr/lib/perl5

instead, if this is the path to your perl binary.

You may then make your script executable:

chmod 755 scriptname.pl

Then, run it as ./scriptname.pl, or put it in your path
maybe ~username/bin/scriptname.pl (if that is in your path)
and you can loose the './'.

You will want to do these, as they will help you:

man man
man bash
man chmod
perldoc perldoc
perldoc perlrun
perldoc perl

Regards,

anm
-- 
/*-------------------------------------------------------.
| Andrew N. McGuire                                      |
| anmcguire@ce.mediaone.net                              |
`-------------------------------------------------------*/


------------------------------

Date: 14 May 2000 03:32:58 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Now serving 15? (How can I setup a small server in perl?)
Message-Id: <slrn8hs7ja.92f.abigail@ucan.foad.org>

On Sat,
13 May 2000 21:05:07 GMT, malverian@hotmail.com <malverian@hotmail.com> wrote:
++ 
++ > perldoc  HTTP::Daemon
++ 
++ Could you give me an example of how I could use this for say a MUD
++ server?

You can't use HTTP::Daemon for that, as there's no client-to-client
interaction with HTTP.

Muds require a different, non-trivial protocol. Which you can't just
learn from an example.

You might want to look into POE.


Abigail


------------------------------

Date: Sat, 13 May 2000 18:54:12 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Please Help friend on perl problem
Message-Id: <391E0744.EBB6F23D@vpservices.com>

velocity wrote:
> 
> brian d foy <brian@smithrenaud.com> wrote in message
> news:brian-1305001502110001@sri.dialup.access.net...
> > In article <%GhT4.61780$fF5.1941446@news1.rdc1.il.home.com>, "velocity"
> <velocity@youreallythinkitsme.com> wrote:
> >
> > >Can any of you guys tell me why this program wont work.
> > >It's a simple news poster allowing header hacking.
> >
> >
> > you forgot to
> >
> >    use Net::NNTP;
> >
> could you rewrite it so it is right?need it badly thanx
> velocity

He did rewrite if for you.  Just put the line he showed near the top of
your script.


-- 
Jeff


------------------------------

Date: Sat, 13 May 2000 21:37:01 +0100
From: "Andy Chantrill" <andy@u2me3.com>
Subject: Re: Problem with server scripting
Message-Id: <8fkehe$2kv$1@plutonium.btinternet.com>

You can't read from and write to the same file handle (<f>).




------------------------------

Date: Sun, 14 May 2000 03:05:13 GMT
From: malverian@hotmail.com
Subject: Re: Regular Expressions help
Message-Id: <8fl553$7ni$1@nnrp1.deja.com>

In article <87puqqf23z.fsf@shleppie.uh.edu>,
  Tony Curtis <tony_curtis32@yahoo.com> wrote:
> And what might $pass be?  If you keep on posting articles
> that don't tell people anything that might help to find a
> solution, you're going to get very frustrated.

Okay, let me restate my problem.

When I use a regular expression to look for a variable, it reads it as
the number of characters, not the actual string.

How would I fix this?
Example:

$variable = "Wow this ^is^ really cool!";
$thing = "is";

if ($variable =~ /^$thing^/i) {
print "Good! It is good!";
} else {
print "No! It's badddd!";
}


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Sat, 13 May 2000 22:31:59 -0500
From: "Andrew N. McGuire" <anmcguire@ce.mediaone.net>
Subject: Re: Regular Expressions help
Message-Id: <391E1E2F.5D6D8EDE@ce.mediaone.net>

malverian@hotmail.com wrote:
> 
> In article <87puqqf23z.fsf@shleppie.uh.edu>,
>   Tony Curtis <tony_curtis32@yahoo.com> wrote:
> > And what might $pass be?  If you keep on posting articles
> > that don't tell people anything that might help to find a
> > solution, you're going to get very frustrated.
> 
> Okay, let me restate my problem.
> 
> When I use a regular expression to look for a variable, it reads it as
> the number of characters, not the actual string.
> 
> How would I fix this?
> Example:
> 
> $variable = "Wow this ^is^ really cool!";
> $thing = "is";
> 
> if ($variable =~ /^$thing^/i) {
> print "Good! It is good!";
> } else {
> print "No! It's badddd!";
> }

If I understand you correctly, you want to backwhack
the '^' characters: '\^'.

Regards,

anm
-- 
/*-------------------------------------------------------.
| Andrew N. McGuire                                      |
| anmcguire@ce.mediaone.net                              |
`-------------------------------------------------------*/


------------------------------

Date: 14 May 2000 06:25:11 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Regular Expressions help
Message-Id: <slrn8hshm7.92f.abigail@ucan.foad.org>

On Sun,
14 May 2000 03:05:13 GMT, malverian@hotmail.com <malverian@hotmail.com> wrote:
++ 
++ Okay, let me restate my problem.
++ 
++ When I use a regular expression to look for a variable, it reads it as
++ the number of characters, not the actual string.
++ 
++ How would I fix this?
++ Example:
++ 
++ $variable = "Wow this ^is^ really cool!";
++ $thing = "is";
++ 
++ if ($variable =~ /^$thing^/i) {
++ print "Good! It is good!";
++ } else {
++ print "No! It's badddd!";
++ }


That isn't going to produce the effect you want, because ^ has a
special meaning in regular expressions. 

If you are looking for fixed strings, use index():

    unless (index ($variable, "^$thing^") < 0) {
        print "Good! It is good!";
    }
    else {
        print "No! It's badddd!";
    }


Abigail


------------------------------

Date: Sun, 14 May 2000 16:12:13 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: Running perl code thru crontab
Message-Id: <958277490.759613@shelley.paradise.net.nz>


<vpanicker@my-deja.com> wrote in message news:8fhfaj$btm$1@nnrp1.deja.com...
> I am facing problems running a perl code thru the crontab , as my env
> variable LD_LIBRARY_PATH is not getting set, which is not letting me
> call shared libraries. It seems %ENV in perl passes impoverished env.
> setting in cronjobs.

It's not an improverished environment, it's a safer one.  Relying on
LD_LIBRARY_PATH being set is a popular security hole.  cron gives you a
minimal environment, so just explicity set what you need.




------------------------------

Date: Sun, 14 May 2000 11:59:36 +1000
From: "Susan Entwisle" <sentwisle@ozemail.com.au>
Subject: Split Function
Message-Id: <vHnT4.28339$PL4.562479@ozemail.com.au>

Hi,

I am currently writing a perl script to search for regular expressions
within a text file.  On the command line for this script the user can
specify a -wx:y option where x is the number of lines to print from the file
before the matching line and y is the number of lines to print from the file
after the matching line.

In order to validate the user has specified both the x and y options I have
included the following code in my script:

    # Validate the format of the argument
    $lengtharg=length($ARGV[$loopcount]);
    # Use the calculated lengtharg to extract the number portion
    # i.e. 12:19.  Needed to decrement two from the total length
    # to account for the -w portion.
    $bfafval= substr($ARGV[$loopcount], 2, ($lengtharg - 2));
    # Use split to obtain the number of lines to print both
    # before and after a matching line.
         @nolinesprnt=split(':',$bfafval);
    # Validate that the argument was in the correct format based
    # on the array having two elements.  This will pick up both
         # incorrect delimiter used or two values for before and
         # after lines have not been entered
    if ($#nolinesprnt != 1)
    {
           print "Error: invalid -w format \nUsage: $0 $USAGE \n";
  exit(5);
    }

The above code does not work if -w:1 is entered - it appears that the
@nolinesprnt array has an additional blank element in it.  I have tested the
length of the $bfafval and it is correct.

Any assistance would be appreciated.

Cheers
Susan Entwisle




------------------------------

Date: Sun, 14 May 2000 03:16:30 GMT
From: Michael Carman <mjcarman@home.com>
Subject: Re: Split Function
Message-Id: <391E1B48.4C6A6E25@home.com>

Susan Entwisle wrote:
> 
> The above code does not work if -w:1 is entered - it appears that the
> @nolinesprnt array has an additional blank element in it.

Yes, it would do that. In that situation, split() would return '' (the
empty string) and 1, as that is what you get when you split ':1' on the
colon. What you really want to do is use a regex:

if ($ARGV[$loopcount] =~ /(\d+):(\d+)/) {
    @nolinesprint = ($1, $2);
}
else {
    print "Error: invalid -w format \nUsage: $0 $USAGE \n";
    exit(5);
}

Note that the assignment to @nolinesprint is conditional upon a
succesful match, and that you don't need to mess around with length() or
substr() first.

-mjc


------------------------------

Date: 14 May 2000 03:02:20 GMT
From: abigail@foad.org (Abigail)
Subject: Re: spoofing identity
Message-Id: <slrn8hs5ps.92f.abigail@ucan.foad.org>

On Sat, 13 May 2000 19:21:06 GMT, blah80 <*nospam*blah80@hotmail.com> wrote:
++ I know this is pretty basic, but here goes:
++ 
++ Every 5 minutes I want to execute a pgm that hits a site and scrapes then
++ parses the html.  I don't really have permission to do this, so they might
++ spot me in the logs pretty soon and block my ip address.  I know people have
++ bots hitting sites all the time and they solve this.  How do they do that?


- You could get lots of different providers. Each time you find yourself
  blocked, move to the next provider.

- You could acquire yourself a kit that scans machines for security holes.
  Break in to lots of machines, and conduct your scraping from the
  compromised machine.

- You could ask permission from the site you are scraping. But that wouldn't
  be fun, now would it?



Abigail


------------------------------

Date: Sun, 14 May 2000 03:29:24 GMT
From: Michael Carman <mjcarman@home.com>
Subject: Re: This error catching code should work right?
Message-Id: <391E1E4D.F686465D@home.com>

malverian@my-deja.com wrote:
> 
> > $status = open (DBASE, $database);
> > if ($status > 0) {last;}
> 
> Last isn't a valid command,

last is a perfectly valid command -- it's used to break out of a loop.
It isn't really appropriate here, but I don't think it should cause
server errors. Perhaps the error is in &errorlog? At any rate, the
construct the OP has isn't needed:

unless (open(DBASE, $database)) {
   $error='failed to open';
   $file='database file';
   $location='add entries';
   &errorlog;
}
@database = <DBASE>;
unless (close(DBASE)) {
   $error='failed to close';
   $file='database file';
   $location='add entries';
   &errorlog;
}

BTW, it is better practice to *pass* parameters to your subroutines,
rather than have them accessing global variables. e.g.

errorlog('failed to open', 'database file', 'add entries');

(You also don't need the leading & if you call it with an arg list.)

-mjc


------------------------------

Date: Sat, 13 May 2000 18:52:03 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Update problem with DBI-ODBC and MSAccess
Message-Id: <391E06C3.930CDCCE@vpservices.com>

Geert-Jan wrote:
> 
> Everytime I try an "UPDATE... " or an "INSERT..." SQL command on an Access
> Database
> using a Perl program with DBI and DBD-ODBC, it fails. The SELECT-strings
> work fine though.
> The web server returns an error, like:
> 
> "DBD::ODBC::st fetchall_arrayref failed: (DBD: no select statement currently
> executing err=-1)
>  at C:\sambar41\docs\odigon_1\cgi-bin\test\update.cgi line 16."
> 
> I was also given a reference to an error in the DBI.pm.
> Here's an example of the script, although I don't think there's something
> wrong with it
> (because the SELECTs work):
> 
> #!c:\Perl\bin\perl.exe
> use DBI;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
> 
> $dbName     = "DBI:ODBC:Keywords";
> $dbUserName = "user";
> $dbPassword = "";
> 
> $dbh = &connectToDB();
> $dataObject = $dbh->prepare("UPDATE tbl_smg_dat_Class_Synonym_Ger_1 SET
> tbl_smg_dat_Class_Synonym_Ger_1.Name_Class = 'Kräuter' WHERE
> tbl_smg_dat_Class_Synonym_Ger_1.Name_Class='Gewürze'");
>     $dataObject->execute();
>     @dbRows = $dataObject->
>               fetchall_arrayref();
> 
> sub connectToDB
>  {
>  # return (DBI->connect($dbName, $dbUserName, $dbPassword));
>         $dbh = DBI->connect($dbName, $dbUserName, $dbPassword ,
>                  { RaiseError=>1 },
>                )
>  }

Hmm, the only error I can see is that you have are loading an arrayref
into an array.  This line:

	@dbRows = $data_Object->fetchall_arrayref();

Shoud be $dbRows.  Then you have to dereference the rows array.

But that error would not cause the error string you mention.  I would
usually expect that error when you try to do a prepare without first
doing an execute, but you do do an execute.  Maybe it is a variable name
thing.  Try running with -w and use strict.  If nothing shows up, try it
from the command line, maybe some warnings or something are not making
it to your browser.

-- 
Jeff


------------------------------

Date: Sun, 14 May 2000 04:54:42 GMT
From: "Chris Williams" <aahz@gol.com>
Subject: Re: What's this line which Perl added to AUTOEXEC.BAT?
Message-Id: <mkqT4.1581$uL2.110864@nnrp.gol.com>

When you type a command into the prompt, you are really executing a mini
program.  In order for you to be able to use that program from wherever you
are on the computer, it needs to be in the path (it searches the listed
directories for an executable matching the name of the command (kind of,
there is no cd.exe and rename.exe, but this is only since these programs are
part of a bigger one).)  By setting the path c:\Per\bin, it allows you to go
"perl my_program" regardless that perl.exe may be in an entirely different
directory.
If you are having problems with your OS (it has become unbootable) it will
be because your computer needs to be able to find all of its programs, which
are in c:\WINNT and c:\WINNT\Sytem32--though ActiveState should simply have
added to your path statement not overwritten it....

"bjanko" <waldo700NOwaSPAM@aol.com.invalid> wrote in message
news:19b13c48.15fccc27@usw-ex0101-007.remarq.com...
> After installing Perl from activestate.com on my Windows 98
> platform, the following line was written into my AUTOEXEC.BAT:
>
> SET PATH=C:\Perl\bin\
>
> This seemed to make my computer unbootable.  Does anyone know
> the purpose of the line?  What it does do?  Do I need it?
>
>
> * 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: 14 May 2000 02:40:19 GMT
From: abigail@foad.org (Abigail)
Subject: Re: where can i find perl?
Message-Id: <slrn8hs4gj.92f.abigail@ucan.foad.org>

On Sat,
13 May 2000 12:02:51 GMT, cdgdgjgjd@dydydhy.com <cdgdgjgjd@dydydhy.com> wrote:
++ where can i find perl?


Over there, in the corner.


Abigail


------------------------------

Date: Sun, 14 May 2000 07:00:30 GMT
From: "Chris Williams" <aahz@gol.com>
Subject: Re: where can i find perl?
Message-Id: <iasT4.1585$uL2.110888@nnrp.gol.com>

In general, check www.perl.com, if you're on a windows system go to
www.activestate.com.
<cdgdgjgjd@dydydhy.com> wrote in message
news:391d4415.14505770@news.surfree.net.il...
> where can i find perl?



------------------------------

Date: 14 May 2000 03:44:24 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Why does Perl do this?
Message-Id: <slrn8hs88o.92f.abigail@ucan.foad.org>

On Sat, 13 May 2000 19:09:15 -0400, Sydney Lu <slu_2@altavista.net> wrote:
++ I just spent about half an hour scratching my head wondering why Perl
++ kept giving me "Out of Memory" when there was clearly enough memory
++ available.
++ 
++ Turns out, I was trying to use a hash reference as the index into an
++ array. Whoops.
++ 
++ What I'm wondering is, why didn't Perl warn me about that? I ran with
++ warnings, with strict, and got a fatal error instead. :-)
++ 
++ I'm guessing that references are just stored as really big integers or
++ something internally? 

How references are stored internally doesn't matter. It could just be
pieces of string. What does matter is what the value of a reference in
numeric context is. And that is, indeed, a number - a number that's
often quite large.

++ So that when I asked for $b[ $hash_ref ], it tried to allocate a few
++ gigs of memory for an array after evaluating $hash_ref to a really
++ huge integer, and then read from it? (thus making malloc() return 0?)

Something like that, yes.

++ But either way, would there ever be a legal situation where one would
++ need to use a reference as the subscript for an array? and if not, why
++ doesn't Perl catch this type of behavior?

"legal situation where one would need to use" is vaguely defined.
And not very useful. Does one ever need to use multiplication? After
all, we do already have addition.

As for why perl doesn't catch this.... There are infinitely many
programming mistakes one can make, using no more than 50 characters.
But perl can spend only so much time in checking all possible
mistakes. One wouldn't want to have a perl that takes 60 Tb of
memory to load, and 25 years to calculate anything because it's
checking all possible mistakes.



Abigail


------------------------------

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 3040
**************************************


home help back first fref pref prev next nref lref last post