[23798] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6001 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 29 19:01:04 2004

Date: Thu, 29 Jan 2004 16:00:29 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 Jan 2004     Volume: 10 Number: 6001

Today's topics:
        can this be done with Perl? (TX Italian)
    Re: can this be done with Perl? <tadmc@augustmail.com>
    Re: can this be done with Perl? <no_spam_for_jkeen@verizon.net>
    Re: can this be done with Perl? <ceo@nospan.on.net>
    Re: can this be done with Perl? <dwall@fastmail.fm>
    Re: can this be done with Perl? <lv@aol.com>
        Can this database update script be optimized? (Cheez)
    Re: Can this database update script be optimized? <gnari@simnet.is>
    Re: Can this database update script be optimized? <pkent77tea@yahoo.com.tea>
    Re: Can this database update script be optimized? ctcgag@hotmail.com
    Re: Can this database update script be optimized? (Cheez)
    Re: Can this database update script be optimized? <spamblock@nodomain.nodomain.us>
        CGI::NeedSSL 0.01 released <wherrera@lynxview.com>
        cmsg cancel <bv7444$js6@netnews.hinet.net> (jan)
    Re: Collapse .. in paths? <spamblock@nodomain.nodomain.us>
        command line log file parsing <eguttridge@nospam-buildonline.com>
    Re: command line log file parsing (Anno Siegel)
    Re: command line log file parsing <krahnj@acm.org>
    Re: Config file for Perl install (Rafael Garcia-Suarez)
    Re: Config file for Perl install <imiller@bsd.uchicago.edu>
        controlling the cwd <rdcolvin@erols.com>
    Re: controlling the cwd (Walter Roberson)
    Re: controlling the cwd <noreply@gunnar.cc>
    Re: controlling the cwd <gnari@simnet.is>
        Copy and paste information into Java program? (John)
    Re: Copy and paste information into Java program? <pkent77tea@yahoo.com.tea>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 24 Jan 2004 07:39:24 -0800
From: calabresejason@yahoo.com (TX Italian)
Subject: can this be done with Perl?
Message-Id: <2538529a.0401240739.20189e1d@posting.google.com>

I have a batch file that is used to move files from several computers,
onto a server. Since this batch file needs to be used by different
locations, is there a way to generate a "form" of sorts, where the end
user could type in the pc names at there site as well as the name of
the server the files are to be copied to, and have it generate a batch
file?
Here is an example of the batch file
cls

echo ** Copying CTI Logs  **
move /Y \\TX0CSRD53425\c$\e*.log \\tx0istd12265\c$\cti
move /Y \\TX0CSRD75569\c$\e*.log \\tx0istd12265\c$\cti
move /Y \\TX0CSRD15089\c$\e*.log \\tx0istd12265\c$\cti
move /Y \\TX0CSRD34257\c$\e*.log \\tx0istd12265\c$\cti
move /Y \\TX0CSRD71089\c$\e*.log \\tx0istd12265\c$\cti
move /Y \\TX0CSRD82769\c$\e*.log \\tx0istd12265\c$\cti
move /Y \\TX0CSRD29777\c$\e*.log \\tx0istd12265\c$\cti
move /Y \\TX0CSRD37265\c$\e*.log \\tx0istd12265\c$\cti
move /Y \\TX0CSRD77073\c$\e*.log \\tx0istd12265\c$\cti

cls

The pc's are running Windows NT

thanks,

jason


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

Date: Sat, 24 Jan 2004 10:14:56 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: can this be done with Perl?
Message-Id: <slrnc156g0.4m1.tadmc@magna.augustmail.com>

TX Italian <calabresejason@yahoo.com> wrote:

> is there a way to generate a "form" of sorts, where the end
> user could type in the pc names at there site as well as the name of
> the server the files are to be copied to, and have it generate a batch
> file?


Yes.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 24 Jan 2004 17:16:18 GMT
From: "Jim Keenan" <no_spam_for_jkeen@verizon.net>
Subject: Re: can this be done with Perl?
Message-Id: <CLxQb.60$x05.23@nwrdny03.gnilink.net>


"TX Italian" <calabresejason@yahoo.com> wrote in message
news:2538529a.0401240739.20189e1d@posting.google.com...
> I have a batch file that is used to move files from several computers,
> onto a server. Since this batch file needs to be used by different
> locations, is there a way to generate a "form" of sorts, where the end
> user could type in the pc names at there site as well as the name of
> the server the files are to be copied to, and have it generate a batch
> file?

It seems to me that this would be a fairly straightforward use of Perl for
CGI.  You would place a CGI script, written in Perl (and probably using Perl
extension CGI.pm), on a server.  The script would generate an HTML form
which would have fields where end-users could enter file names.  But if
there are only a few different places to which those files are being moved,
use radio buttons instead of text areas.  When the end user clicks on
Submit, the script would execute the required moves.

There are a number of books on the topic of Perl and CGI that can guide you
through the process.  There are Usenet newsgroups specifically devoted to
CGI, and there are mailing lists at learn.perl.org and nntp.perl.org that
are Perl/CGI-focused.  Once you get a script together, those places will be
better for getting comments on your script.

Jim Keenan




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

Date: Sun, 25 Jan 2004 04:42:13 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: can this be done with Perl?
Message-Id: <FOHQb.308$m05.306@newssvr31.news.prodigy.com>

TX Italian wrote:
> I have a batch file that is used to move files from several computers,
> onto a server. Since this batch file needs to be used by different
> locations, is there a way to generate a "form" of sorts, where the end
> user could type in the pc names at there site as well as the name of
> the server the files are to be copied to, and have it generate a batch
> file?
> Here is an example of the batch file
> cls
> 
> echo ** Copying CTI Logs  **
> move /Y \\TX0CSRD53425\c$\e*.log \\tx0istd12265\c$\cti
> move /Y \\TX0CSRD75569\c$\e*.log \\tx0istd12265\c$\cti
> move /Y \\TX0CSRD15089\c$\e*.log \\tx0istd12265\c$\cti
> move /Y \\TX0CSRD34257\c$\e*.log \\tx0istd12265\c$\cti
> move /Y \\TX0CSRD71089\c$\e*.log \\tx0istd12265\c$\cti
> move /Y \\TX0CSRD82769\c$\e*.log \\tx0istd12265\c$\cti
> move /Y \\TX0CSRD29777\c$\e*.log \\tx0istd12265\c$\cti
> move /Y \\TX0CSRD37265\c$\e*.log \\tx0istd12265\c$\cti
> move /Y \\TX0CSRD77073\c$\e*.log \\tx0istd12265\c$\cti
> 
> cls
> 
> The pc's are running Windows NT
> 

Why have Perl write a lobotomized batch file?  The power of Windows 
batch files compares like an ant to a bullbozer with regard to Perl. 
Just do all your work in Perl and toss batch files (for everything 
really).  Microsoft actually certifies ActiveState Perl for use in these 
kinds of administrative tasks -- AS Perl is included on their Windows 
Resource Kit CDs (albeit they include a way out of date version -- 
typical of them.)

Install ActiveState's latest Perl and just use that to do all the work. 
  There is no need to write a batch file to execute.

If you want a form, run this off of an IIS server using an HTML form 
end.  ActiveState Perl allows you to install PerlScript -- a VBScript 
replacement.  Write your form and processing script in PerlScript and 
serve it out on your company LAN using HTTP and ASP.  It's easy.

(No need to do CGI this way either.  PerlScript runs native, classic ASP.)

Chris
-----
Chris Olive
chris (-at-) technologEase (-dot-) com
http://www.technologEase.com
(pronounced "technologies")



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

Date: Sun, 25 Jan 2004 07:23:45 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: can this be done with Perl?
Message-Id: <Xns947B185F993F7dkwwashere@216.168.3.30>

Chris <ceo@nospan.on.net> wrote:

> TX Italian wrote:
>> I have a batch file that is used to move files from several computers,
>> onto a server. Since this batch file needs to be used by different
>> locations, is there a way to generate a "form" of sorts, where the end
>> user could type in the pc names at there site as well as the name of
>> the server the files are to be copied to, and have it generate a batch
>> file?

Yes, but it's not Perl-specific.  A CGI program to do what you want can be 
written in many languages.  Perl is well-suited for CGI, so it's a common 
choice (and a good choice, IMHO).  But it's not the only choice.

> Why have Perl write a lobotomized batch file?  The power of Windows 
> batch files compares like an ant to a bullbozer with regard to Perl. 

Granted, but that would require the OP to install Perl at every location.  
What s/he wants is to install Perl *once* on a web server, then use Perl to 
create a batch file that can be used without having to have Perl installed.

I've occasionally done something similar to this. Sometimes it's quicker 
for me to write a Perl program to generate a batch file than it would be to 
write a Perl program to do the same job.  Perl is vastly more powerful than 
batch files, but sometimes I don't need all that power.  I just want to get 
something done as quickly as possible while expending minimum effort.


> Just do all your work in Perl and toss batch files (for everything 
> really).  Microsoft actually certifies ActiveState Perl for use in these 
> kinds of administrative tasks -- AS Perl is included on their Windows 
> Resource Kit CDs (albeit they include a way out of date version -- 
> typical of them.)

Yeah, that figures.

 
> Install ActiveState's latest Perl and just use that to do all the work. 
>   There is no need to write a batch file to execute.

A batch file is not *necessary* when you have Perl, but for quick-and-dirty 
repetitive tasks, it can be easier to generate a batch file.  Who cares how 
you get results as long as the work gets done?

-- 
David Wall


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

Date: Sun, 25 Jan 2004 11:42:33 -0600
From: l v <lv@aol.com>
Subject: Re: can this be done with Perl?
Message-Id: <7eTQb.5974$5M.143790@dfw-read.news.verio.net>

Jim Keenan wrote:
> "TX Italian" <calabresejason@yahoo.com> wrote in message
> news:2538529a.0401240739.20189e1d@posting.google.com...
> 
>>I have a batch file that is used to move files from several computers,
>>onto a server. Since this batch file needs to be used by different
>>locations, is there a way to generate a "form" of sorts, where the end
>>user could type in the pc names at there site as well as the name of
>>the server the files are to be copied to, and have it generate a batch
>>file?
> 
> 
> It seems to me that this would be a fairly straightforward use of Perl for
> CGI.  You would place a CGI script, written in Perl (and probably using Perl
> extension CGI.pm), on a server.  The script would generate an HTML form
> which would have fields where end-users could enter file names.  But if
> there are only a few different places to which those files are being moved,
> use radio buttons instead of text areas.  When the end user clicks on
> Submit, the script would execute the required moves.
> 
> There are a number of books on the topic of Perl and CGI that can guide you
> through the process.  There are Usenet newsgroups specifically devoted to
> CGI, and there are mailing lists at learn.perl.org and nntp.perl.org that
> are Perl/CGI-focused.  Once you get a script together, those places will be
> better for getting comments on your script.
> 
> Jim Keenan
> 
> 

Wouldn't the CGI process require authentication to all of the pc's to 
copy from?

Len



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

Date: 21 Jan 2004 23:14:02 -0800
From: cheez2112@yahoo.com (Cheez)
Subject: Can this database update script be optimized?
Message-Id: <1e85f7c8.0401212314.26159394@posting.google.com>

Hi there, 

I have a script that inserts and updates a mySQL table using data from
a text file.  I am checking for duplicate records by first doing a
SELECT.  If the record exists and 1) increase a counter by one and 2)
concatenate text in a field with a string.  If the record doesn't
exist, I INSERT the data normally.

It's slow.  I am performing this update with about 50,000 records at a
time.  I think there's an exponential increase in processing time as
the table grows in size.  Initially I have about 40 of these files to
process to create a table with about 2 million records.

My questions are:

1. using Perl is this the most efficient approach?  
2. would a native SQL query using the database GUI be faster?
3. I am really poor at choosing when and where for 'die' statements. 
Any pointers of where I should put these would be great.

Thanks,
Cheez


code below:


print "\nINSERTER_SEQUENCE: inserting data into table\n";

use DBI;

my $dbh = DBI->connect("dbi:mysql:mydb", "", "");

open(FILE, "seqparsed.txt");

while (my $data = <FILE>) {

     	($wherefound,$sequence) = split /\t/, $data;
	
	dupcheck ();		#this sub does all the work

	}

close (FILE);

sub dupcheck {

	$sth = $dbh->prepare("SELECT sequence, wherefound FROM      
        sequence5  WHERE  sequence=?");

  	$sth->execute($sequence);  

        #selecting any records that match $sequence

  	if (@row = $sth->fetchrow_array) {   

             #a match results in frequency++ 
             #and update of where it was found

             my ($seq, $wheref) = @row; 

	     $wherefound = "$wherefound, $wheref";

             $sth = $dbh->prepare("update sequence5 SET   
             frequency=frequency+1, wherefound=? WHERE sequence=?");

 	     $sth->execute($wherefound,$sequence);  

  		     }

	else {	      

             # if no records match $sequence then INSERT new data

 	     $sth = $dbh->prepare("INSERT INTO sequence5 (wherefound, 
             sequence) VALUES (?, ?)");

	     $sth->execute( $wherefound, $sequence); 	

		     }
}


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

Date: Thu, 22 Jan 2004 08:24:14 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Can this database update script be optimized?
Message-Id: <buo1gv$vbp$1@news.simnet.is>

"Cheez" <cheez2112@yahoo.com> wrote in message
news:1e85f7c8.0401212314.26159394@posting.google.com...
> Hi there,
>
>
> It's slow.  I am performing this update with about 50,000 records at a
> time.  I think there's an exponential increase in processing time as
> the table grows in size.

have you checked your indexes?

gnari






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

Date: Thu, 22 Jan 2004 16:55:40 +0000
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Can this database update script be optimized?
Message-Id: <pkent77tea-9BC148.16554022012004@ptb-nnrpp01.plus.net>

In article <1e85f7c8.0401212314.26159394@posting.google.com>,
 cheez2112@yahoo.com (Cheez) wrote:

> I have a script that inserts and updates a mySQL table using data from
> a text file.  I am checking for duplicate records by first doing a
 ...
> 2. would a native SQL query using the database GUI be faster?

Ghod no, with all that GUI stuff and dialogs and menus in the way :-) 
 ... or do you mean the database's native client libraries? If you do, 
well the perl DBI hooks directly into them (in all cases I know of) so 
you get the bets speed.


> 3. I am really poor at choosing when and where for 'die' statements. 
> Any pointers of where I should put these would be great.

use the 'RaiseError' => 1 option in the DBI connect() call - there's 
examples in the docs. And always check the return value of open().

And always use strict and warnings (or -w on older versions of perl).


> sub dupcheck {
> 
> 	$sth = $dbh->prepare("SELECT sequence, wherefound FROM      
>         sequence5  WHERE  sequence=?");

This is a bad, or at least  inefficient, thing to do, because you call 
this sub once for every line - and you're prepare()ing the same thing 
every time. You need to prepare() _once_ outside the loop and then use 
the resulting statement handle over and over inside the loop.


>  	     $sth = $dbh->prepare("INSERT INTO sequence5 (wherefound, 
>              sequence) VALUES (?, ?)");

ditto for this one - prepare once, use many times.

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

Date: 22 Jan 2004 17:09:03 GMT
From: ctcgag@hotmail.com
Subject: Re: Can this database update script be optimized?
Message-Id: <20040122120903.641$sK@newsreader.com>

cheez2112@yahoo.com (Cheez) wrote:
> Hi there,
>
> I have a script that inserts and updates a mySQL table using data from
> a text file.  I am checking for duplicate records by first doing a
> SELECT.  If the record exists and 1) increase a counter by one and 2)
> concatenate text in a field with a string.

Are you sure you don't want master=>detail tables, rather than
concatting into a field?

>  If the record doesn't
> exist, I INSERT the data normally.
>
> It's slow.

How slow is it?  How fast does it need to be?

> I am performing this update with about 50,000 records at a
> time.

You are performing the update one record at a time, 50,000 times.

> I think there's an exponential increase in processing time as
> the table grows in size.

I really doubt it.  I bet it is, at worst, N^2.  If you can demonstrate
that it is exponential, that would be quite interesting (and perhaps useful
for finding the problem).


> Initially I have about 40 of these files to
> process to create a table with about 2 million records.

40*50,000 = 2 million.  So how many times does the "pre-existing record"
branch of the code acutally get executed?

> My questions are:
>
> 1. using Perl is this the most efficient approach?

I would move all the prepares to outside the inner loops, although
for MySQL I doubt it matters.  If the insert branch is frequent and the
update branch is rare, I'd do the insert pre-emptively, and then do the
update only if the insert throws you a primary key violation.

But most likely, it isn't a Perl problem but a mysql one.  Is "sequence" a
primary key or otherwise indexed?

> 2. would a native SQL query using the database GUI be faster?

I have no idea what you are talking about.  I doubt that this is a
question for a perl group.

> 3. I am really poor at choosing when and where for 'die' statements.
> Any pointers of where I should put these would be great.

First, use strict.  Pass $wherefound,$sequence into dupcheck() as
arguments. you need to die (or otherwise handle) a failure to open.

Use RaiseError=>1 in your db connection.  If you don't do that, then
you should have "die" statements in damn near every line.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: 22 Jan 2004 22:32:24 -0800
From: cheez2112@yahoo.com (Cheez)
Subject: Re: Can this database update script be optimized?
Message-Id: <1e85f7c8.0401222232.6733db61@posting.google.com>

Thanks again all for the replies.  Very useful stuff.  Since it did
end up taking a very long time...20,000 records/hour were updated
using this script!  That's too slow.  I am going to build a hash table
using 'sequence' as the key and then incrementing a 'value' by one for
duplicates.  Maybe try with all 3 million records?

I just can't say enough about how useful these comments are.

Cheers,
Cheez


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

Date: Fri, 23 Jan 2004 17:30:01 +0000
From: Bruce Horrocks <spamblock@nodomain.nodomain.us>
Subject: Re: Can this database update script be optimized?
Message-Id: <t29iO$KZoVEAFwNQ@nodomain.nodomain.us>

In message <1e85f7c8.0401212314.26159394@posting.google.com>, Cheez 
<cheez2112@yahoo.com> writes
>2. would a native SQL query using the database GUI be faster?

See my response to your previous "SQL insert/update duplicate entries" 
post.

Regards,
-- 
Bruce Horrocks
Surrey
England
<firstname>@<surname>.plus.com -- fix the obvious for email


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

Date: Thu, 22 Jan 2004 05:16:32 GMT
From: Bill <wherrera@lynxview.com>
Subject: CGI::NeedSSL 0.01 released
Message-Id: <HrwMM1.8BB@zorch.sf-bay.org>

NAME
     CGI::NeedSSL - module to check SSL status of a CGI call.

LIBRARY TYPE
     Pure Perl.

DESCRIPTION
     Though some servers are configured with a separate cgi-bin
directory for SSL-only CGI, many allow CGI to be called either via
http: or https: URLs. This module allows SSL-only to be checked and
enforced by a perl CGI program.

SYNOPSIS
     use CGI::NeedSSL qw( croak_unless_via_SSL ); croak_unless_via_SSL();




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

Date: 28 Jan 2004 02:30:39 GMT
From: purr@mail2.intellect.com.tw(jan)
Subject: cmsg cancel <bv7444$js6@netnews.hinet.net>
Message-Id: <bv76sf$3d3@netnews.hinet.net>



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

Date: Wed, 21 Jan 2004 22:02:09 +0000
From: Bruce Horrocks <spamblock@nodomain.nodomain.us>
Subject: Re: Collapse .. in paths?
Message-Id: <ZN0fQhOhbvDAFwwP@nodomain.nodomain.us>

In message <slrnc0ru6u.5ls.tadmc@magna.augustmail.com>, Tad McClellan 
<tadmc@augustmail.com> writes
>Robin <robin@csf.edu> wrote:
>
>> windows and unix
>> have diff operating systems.
>
>
>LOL

Easy mistake to make - 'i' is next to 'u' on the keyboard.
;-)

-- 
Bruce Horrocks
Surrey
England
<firstname>@<surname>.plus.com -- fix the obvious for email


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

Date: Mon, 26 Jan 2004 12:18:41 +0000
From: "Euan" <eguttridge@nospam-buildonline.com>
Subject: command line log file parsing
Message-Id: <401505a2$0$15032$afc38c87@news.easynet.co.uk>

Hi,
Please advise best cmd line method to parse a log file to return lines that meet certain criteria. For example:
Input (log file)
2004.01.26 11:21:20.461 874 /servlet/user
2004.01.26 11:23:30.211 64 /servlet/user2
Perl command
(print top STDOUT all lines where the third column > 500)
Output
> 2004.01.26 11:21:20.461 874 /servlet/user

Thanks.......


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

Date: 26 Jan 2004 12:27:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: command line log file parsing
Message-Id: <bv3135$ngq$2@mamenchi.zrz.TU-Berlin.DE>

Euan <eguttridge@nospam-buildonline.com> wrote in comp.lang.perl.misc:
> Hi,
> Please advise best cmd line method to parse a log file to return lines
> that meet certain criteria. For example:
> Input (log file)
> 2004.01.26 11:21:20.461 874 /servlet/user
> 2004.01.26 11:23:30.211 64 /servlet/user2
> Perl command
> (print top STDOUT all lines where the third column > 500)
> Output
> > 2004.01.26 11:21:20.461 874 /servlet/user

Check out the -a switch to perl (perldoc perlrun) and the @F array
(perldoc perlvar).

Anno


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

Date: Mon, 26 Jan 2004 12:45:47 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: command line log file parsing
Message-Id: <40150BD0.3B1C2F5B@acm.org>

Euan wrote:
> 
> Please advise best cmd line method to parse a log file to return lines
> that meet certain criteria. For example:
> Input (log file)
> 2004.01.26 11:21:20.461 874 /servlet/user
> 2004.01.26 11:23:30.211 64 /servlet/user2
> Perl command
> (print top STDOUT all lines where the third column > 500)
> Output
> > 2004.01.26 11:21:20.461 874 /servlet/user

perl -nae'print if $F[2] > 500' log_file


John
-- 
use Perl;
program
fulfillment


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

Date: 30 Dec 2003 11:17:28 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Config file for Perl install
Message-Id: <slrnbv2ndb.blv.rgarciasuarez@rafael.serd.lyon.hexaflux.loc>

xman wrote:
>Yes I am a sysadmin not a programer..
>So here is the question   Is their a configuration file for which compiler
>is used by perl 5.8.0   ?
>I did a package install on a solaris system and is it set for cc   but I
>only have the Gnu gcc.

You might want to use Solaris-PerlGcc, which does the Config.pm magic
fudging for you :

    http://search.cpan.org/~aburlison/Solaris-PerlGcc-1.3/

-- 
Untenable is not *NIX


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

Date: Tue, 30 Dec 2003 09:59:06 -0600
From: "xman" <imiller@bsd.uchicago.edu>
Subject: Re: Config file for Perl install
Message-Id: <WbhIb.21$Y4.13095@news.uchicago.edu>

Thanks Rafael for your helpful response.
"Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in message
news:slrnbv2ndb.blv.rgarciasuarez@rafael.serd.lyon.hexaflux.loc...
> xman wrote:
> >Yes I am a sysadmin not a programer..
> >So here is the question   Is their a configuration file for which
compiler
> >is used by perl 5.8.0   ?
> >I did a package install on a solaris system and is it set for cc   but I
> >only have the Gnu gcc.
>
> You might want to use Solaris-PerlGcc, which does the Config.pm magic
> fudging for you :
>
>     http://search.cpan.org/~aburlison/Solaris-PerlGcc-1.3/
>
> -- 
> Untenable is not *NIX




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

Date: Mon, 19 Jan 2004 17:39:36 -0500
From: Colvin <rdcolvin@erols.com>
Subject: controlling the cwd
Message-Id: <400C5CA8.9060403@erols.com>

I'm using Perl to write a CGI script, and for the most part it works. 
My directory structure looks like the following:

/webfolder/*.html
/webfolder/images/*.jpeg
/webfolder/js/*.js
/webfolder/cgi-bin/*.pl

My current design loads the html files into scalar variables, performs 
some regex manipulation, and then outputs the (modified) scalar to the 
browser.  The problem is that all of the references to images/*.jpeg are 
getting changed to cgi-bin/images/*.jpeg  I tried inserting a chdir ".." 
into the Perl scripts, but that only changed the cwd of the script and 
not the cwd of the html.  What's the best way to solve this?

Thank you,
Alec Colvin



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

Date: 19 Jan 2004 22:55:28 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: controlling the cwd
Message-Id: <buhn90$fhq$1@canopus.cc.umanitoba.ca>

In article <400C5CA8.9060403@erols.com>, Colvin  <rdcolvin@erols.com> wrote:
:I'm using Perl to write a CGI script, and for the most part it works. 
:My directory structure looks like the following:

:My current design loads the html files into scalar variables, performs 
:some regex manipulation, and then outputs the (modified) scalar to the 
:browser.  The problem is that all of the references to images/*.jpeg are 
:getting changed to cgi-bin/images/*.jpeg  I tried inserting a chdir ".." 
:into the Perl scripts, but that only changed the cwd of the script and 
:not the cwd of the html.  What's the best way to solve this?

Sounds like perhaps you should set a base document in your HTML.
Alternately, use your regex's to change the paths to absolute paths
instead of relative.
-- 
   I've been working on a kernel
   All the livelong night.
   I've been working on a kernel
   And it still won't work quite right.      -- J. Benson & J. Doll


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

Date: Tue, 20 Jan 2004 00:07:28 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: controlling the cwd
Message-Id: <buhnvt$hc7m5$1@ID-184292.news.uni-berlin.de>

Colvin wrote:
> I'm using Perl to write a CGI script, ...

<snip>

> My current design loads the html files into scalar variables,
> performs some regex manipulation, and then outputs the (modified)
> scalar to the browser.  The problem is that all of the references
> to images/*.jpeg are getting changed to cgi-bin/images/*.jpeg

<snip>

> What's the best way to solve this?

If the script you wrote does not do what you expect it to do, you'd
better modify it.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Tue, 20 Jan 2004 00:15:10 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: controlling the cwd
Message-Id: <buhs3t$665$1@news.simnet.is>

"Colvin" <rdcolvin@erols.com> wrote in message
news:400C5CA8.9060403@erols.com...
> I'm using Perl to write a CGI script, and for the most part it works.
> My directory structure looks like the following:
>
> /webfolder/*.html
> /webfolder/images/*.jpeg
> /webfolder/js/*.js
> /webfolder/cgi-bin/*.pl
>
> My current design loads the html files into scalar variables, performs
> some regex manipulation, and then outputs the (modified) scalar to the
> browser.  The problem is that all of the references to images/*.jpeg are
> getting changed to cgi-bin/images/*.jpeg  I tried inserting a chdir ".."
> into the Perl scripts, but that only changed the cwd of the script and
> not the cwd of the html.  What's the best way to solve this?

several ways. among them:
 a) skip the silly cgi-bin directory and keep your *.pl files
in webfolder/
 b) fix the html output to point at the correct location
 c) keep the images that the *.pl refer to in cgi-bin/images/
 d) make a symbolic link between images/ and cgi-bin/images/

I would go for a)

gnari







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

Date: 23 Jan 2004 18:57:04 -0800
From: alkalox@hotmail.com (John)
Subject: Copy and paste information into Java program?
Message-Id: <3303a2cb.0401231857.71e73e93@posting.google.com>

Hi guys,

I have a commercial Java program
to which I do not have the source
code. When the program is started
up, it presents some text fields
into which information can be pasted.

I want to use Perl to automatically
paste information (text) into one
of these text fields. The Java program
toggles between text fields by means
of radio buttons. Also, there is some
default text in the text fields (some user 
instructions). I know how to start
programs using the system call, but I
have no idea about how to paste text
into the text fields of this Java program.

Ideally, I would like to remove the default
text in the text fields and paste in my own
text using Perl. Any help on this would be appreciated.
Thank you.

John


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

Date: Sat, 24 Jan 2004 13:18:37 +0000
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Copy and paste information into Java program?
Message-Id: <pkent77tea-5E1360.13183724012004@pth-usenet-01.plus.net>

In article <3303a2cb.0401231857.71e73e93@posting.google.com>,
 alkalox@hotmail.com (John) wrote:

> I have a commercial Java program
> to which I do not have the source
> code. When the program is started
> up, it presents some text fields
> into which information can be pasted.

If it's any use there's the java disassembler 'javap', e.g. 'javap 
-private -c ClassName'

> I want to use Perl to automatically
> paste information (text) into one
> of these text fields. The Java program
 ...

I don't know how java interacts with the input devices, but if it 
listens to standard input for keystrokes then you can simply (on Unix) 
open a pipe, fork off the child, and send keystrokes down the pipe. If 
the program uses the standard GUI library (it's AWT or Swing I think...) 
then I believe that keyboard traversal of the GUI is something you get 
for free.

On the other hand I'd find it more likely that the GUI will bypass such 
things and use the system's event-based GUI. E.g. when you press a key 
or move a mouse then an event is generated. Now I would bet that on 
MacOS you can use AppleEvents to create and dispatch such events. I'm 
sure there's a similar thing under Win32 which you can hook into with 
perl. And under X11 there are perl modules to do stuff with X11... maybe 
it's possible to send the correct events to the program like this, too.

OTOH you could be evil and rewrite the relevant classes, e.g. 
java.awt.Whatever, to expose the interface that you want, and then get 
the java interpreter to load your special versions first, and then load 
the classes for this program. It's probably a fair amount of work, 
though.

Also, read the docs for this program and see what other means it 
supports for automation. E.g. maybe it has some kind of script file, or 
maybe you can change the default settings.

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 6001
***************************************


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