[13940] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1350 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 11 14:06:17 1999

Date: Thu, 11 Nov 1999 11:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942347115-v9-i1350@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 11 Nov 1999     Volume: 9 Number: 1350

Today's topics:
    Re: @ISA (M.J.T. Guy)
    Re: ActivePerl from a network drive? cs2400@my-deja.com
        Can Perl Modules help me? <peterclones@yahoo.com>
        Dumb Newbie date question crackbaby1@my-deja.com
    Re: FAQ 8.30: How can I convert my shell script to perl <petto@razorfish.de>
    Re: funny behaviour of Perl how to run perl script as a <navin@ti.com>
    Re: funny behaviour of Perl <mark.bluemelNOmaSPAM@siemens.co.uk.invalid>
    Re: funny behaviour of Perl <mpauser@uswest.com>
    Re: funny behaviour of Perl <latsharj@my-deja.com>
    Re: funny behaviour of Perl emarkert@my-deja.com
    Re: Help woth perl <chris@chrismail.connectfree.co.uk>
    Re: Hiding Perl Scripts? (Tad McClellan)
        How to encrypt a web log-in, and work w/accounts in Per <nickysantoro@yahoo.com>
    Re: How to encrypt a web log-in, and work w/accounts in <seshadri@ptc.com>
    Re: IO-Tty binary package for W95? (Neil Cherry)
        Jobs Opportunities at CitySearch citysearch@my-deja.com
    Re: Jobs Opportunities at CitySearch <sariq@texas.net>
    Re: MYSQL question <russellm@bellsouth.net>
    Re: new line break??? <seshadri@ptc.com>
    Re: Online OO Perl tutorial? <sariq@texas.net>
        Parse delimited file with \n's. <gkl200@my-deja.com>
    Re: Parse delimited file with \n's. <rhomberg@ife.ee.ethz.ch>
    Re: Parse delimited file with \n's. (Anno Siegel)
    Re: Parse delimited file with \n's. <sariq@texas.net>
    Re: Passing arrays + other arguments to a subroutine (Tad McClellan)
    Re: Perl and commonsense part 2 (David H. Adler)
    Re: Q: Parsing a simple script language (Tad McClellan)
        Quoting difference between Perl versions <mruedy@alidian.com>
    Re: substitution: $& equals replaced text <rhomberg@ife.ee.ethz.ch>
        to write a BAT/PERL script to lock the windowsNT file s ##defaultuser##@cse.unl.edu
    Re: Visual Package Manager (VPM) (Ken Bandes)
        Why different output between Perl.exe and perlis.dll ? <qsun@kitco.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 11 Nov 1999 18:05:59 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: @ISA
Message-Id: <80f0i7$445$1@pegasus.csx.cam.ac.uk>

In article <65DV3.57665$23.2164074@typ11.nn.bcandid.com>, CS <@mdo.net> wrote:
>After looking through perlobj, perlmod, perlmodlib, and doing a search in
>the Perl CD Bookshelf, I failed to find discussion regarding @ISA (in
>otherwords, what is it, and what exactly does it do).  Could someone please
>tell me where this is discussed.

Eh?    You must have a different version of the Perl documentation from
mine.     perlobj  has a description which looks clear enough to me.
perlmod  has a reference to it, and pointers to perlref and perltoot
for more details.

And as others have pointed out, there's lots of discussion and examples
in perltoot.


Mike Guy


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

Date: Thu, 11 Nov 1999 18:17:04 GMT
From: cs2400@my-deja.com
Subject: Re: ActivePerl from a network drive?
Message-Id: <80f16q$5e1$1@nnrp1.deja.com>


> > A few perl files at the root...
> > U:\perl.exe
> > U:\perldoc.bat
> > U:\ppm.bat
> >
> > *all* other perl files in a subdirectory...
> > U:\perl\whatever\...
> >
>
> I believe that the ActivePerl prompts you for the installation
directory
> although it shouldnt be too difficult for a competent system
administrator
> to set up a global path configuration ...

Hmmm... i don't think they will do it it it requires any change to
the workstation configs......

The idea here is to put the perl.exe file outside the install path yet
have it know to look there for any needed files. (DLLs, PMs, etc.)


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


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

Date: Thu, 11 Nov 1999 11:18:13 -0600
From: "Peter" <peterclones@yahoo.com>
Subject: Can Perl Modules help me?
Message-Id: <HTCW3.257$zG1.12024@news1.mts.net>

I've made a web chatroom using Perl cgi and it works fine, but it gets
sluggish as more people enter the room of course.  The script I have writes
messages to a common text file, then is read by all the users every few
seconds.  I don't know anything about modules, so I'm wondering if there's
someway modules could speed up this process?  If so, which ones should I be
looking at and how can I get help implementing them.  Just need to be
pointed in the right direction.

Peter




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

Date: Thu, 11 Nov 1999 18:51:22 GMT
From: crackbaby1@my-deja.com
Subject: Dumb Newbie date question
Message-Id: <80f373$741$1@nnrp1.deja.com>

Just want to know how to create a variable with the current y2k date in
it.

Ex. 19991111

Currently using

$today_is=>($year,$mon,$mday)=localtime(time);

Thanks


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


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

Date: Thu, 11 Nov 1999 18:56:46 +0100
From: Petto Andersson <petto@razorfish.de>
Subject: Re: FAQ 8.30: How can I convert my shell script to perl?
Message-Id: <382B035E.5D1C806@razorfish.de>


shellscript:
#!/usr/bin/sh
some_unix_command -some_options someinput

translates to perl:
#!/usr/bin/perl
system "some_unix_command -some_options someinput";

got it?



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

Date: Thu, 11 Nov 1999 12:38:10 -0600
From: Navin Chander <navin@ti.com>
Subject: Re: funny behaviour of Perl how to run perl script as a command
Message-Id: <382B0D12.9C374B8@ti.com>

My apologies for not not specifying my problem correctly.
I do not get an error message. As soon as I press the enter key, it just hangs.
I am working on a SUN workstation and I have the execute permissions on the
file.
Mark Bluemel wrote:

> In article <382AF5D6.BC3FAA4B@ti.com>, Navin Chander <navin@ti.com>
> wrote:
> > If  I try to execute a perl fileby just specifying its name it
> > does not
> > work.
> > $prompt> execute_file.pl
>
> But you don't show us what _does_ happen - do you get an error message?
>
> > but if i say perl before the executable it works
> > $prompt> perl execute_file.pl
> > I have the #!/usr/local/bin/perl at the top of my file.
>
> is this where the perl interpreter is actually stored?
>
> > Any Idea why this happens??
>
> have you set execute permissions on the "execute_file.pl" file?
>
> Have you read the FAQs? Have you asked your local support people for
> some help?
>
> Finally, please consider giving a meaningful subject to your posts -
> "funny behaviour of Perl" might lead us to expect a humourous post,
> while "how can I run a Perl script as a command?" would help us be
> prepared for your question.
>
> Regards
> --
>
> Mark Bluemel
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!

--
****************************************************
                       Navin Chander
                    Design, SEAL_TEAM_1
1394 Host Design                  Ph: (972)480-2430
Texas Instruments, Dallas TX      Fax: (972)480-6400
Email: navin@ti.com         http://www.ti.com/sc/bus
****************************************************





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

Date: Thu, 11 Nov 1999 09:03:38 -0800
From: Mark Bluemel <mark.bluemelNOmaSPAM@siemens.co.uk.invalid>
Subject: Re: funny behaviour of Perl
Message-Id: <09920fb9.3b099861@usw-ex0101-008.remarq.com>

In article <382AF5D6.BC3FAA4B@ti.com>, Navin Chander <navin@ti.com>
wrote:
> If  I try to execute a perl fileby just specifying its name it
> does not
> work.
> $prompt> execute_file.pl

But you don't show us what _does_ happen - do you get an error message?

> but if i say perl before the executable it works
> $prompt> perl execute_file.pl
> I have the #!/usr/local/bin/perl at the top of my file.

is this where the perl interpreter is actually stored?

> Any Idea why this happens??

have you set execute permissions on the "execute_file.pl" file?

Have you read the FAQs? Have you asked your local support people for
some help?

Finally, please consider giving a meaningful subject to your posts -
"funny behaviour of Perl" might lead us to expect a humourous post,
while "how can I run a Perl script as a command?" would help us be
prepared for your question.

Regards
--

Mark Bluemel


* 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: Thu, 11 Nov 1999 11:09:14 -0600
From: mpauser <mpauser@uswest.com>
Subject: Re: funny behaviour of Perl
Message-Id: <382AF83A.1A2AEBA1@uswest.com>

You need to associate .pl with Perl.exe.

If your on a Win32 machine, here's the process:

1.Open the My Computer icon on the Desktop. The My Computer window should
appear.

  2.From the View menu in the My Computer window, choose Options. The
Options dialog box appears.

  3.In the Options dialog box, select the File Types tab.

  4.Click the New Type button. The Add New File Type dialog box appears.

  5.In the ``Description of type'' box, type ``Perl Script''.

  6.In the ``Associated extension'' box, type ``.pl''.

  7.Leave the Content Type (MIME) box blank.

  8.Click the New button beneath the Actions list. The New Action dialog
box will appear.

  9.In the Action box, type ``Open'' (it's important to use this name for
the action!).

 10.In the ``Application used to perform action'' box, type [full path to
perl]\perl.exe %1 %*, where [full path to perl] is the full path to
perl.exe on your machine. If perl is in your path, you can put just
perl.exe, but for esoteric reasons it's better to put the full path. Also,
if the path to your interpreter includes spaces (like C:\Program
Files\perl5) put in the DOS path instead (C:\progra~1\perl5).

 11.Click OK to close the New Action dialog box.

 12.Click OK to close the Add New File Type dialog box.

 13.Click OK to close the Options dialog box.


Navin Chander wrote:

> If  I try to execute a perl fileby just specifying its name it does not
> work.
> $prompt> execute_file.pl
>
> but if i say perl before the executable it works
>
> $prompt> perl execute_file.pl
>
> I have the #!/usr/local/bin/perl at the top of my file.
>
> Any Idea why this happens??
> thanks in advance
> navin
>
> --
> ****************************************************
>                        Navin Chander
>                     Design, SEAL_TEAM_1
> 1394 Host Design                  Ph: (972)480-2430
> Texas Instruments, Dallas TX      Fax: (972)480-6400
> Email: navin@ti.com         http://www.ti.com/sc/bus
> ****************************************************



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

Date: Thu, 11 Nov 1999 18:34:33 GMT
From: Dick Latshaw <latsharj@my-deja.com>
Subject: Re: funny behaviour of Perl
Message-Id: <80f27i$68k$1@nnrp1.deja.com>

In article <382AF5D6.BC3FAA4B@ti.com>,
  Navin Chander <navin@ti.com> wrote:
> If  I try to execute a perl fileby just specifying its name it does
> not work.
> $prompt> execute_file.pl
>
> but if i say perl before the executable it works
>
> $prompt> perl execute_file.pl
>
> I have the #!/usr/local/bin/perl at the top of my file.

And execute_file.pl's directory is in your path?
Try:
$prompt>./execute_file.pl

--
Regards,
Dick


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


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

Date: Thu, 11 Nov 1999 18:40:20 GMT
From: emarkert@my-deja.com
Subject: Re: funny behaviour of Perl
Message-Id: <80f2id$6kp$1@nnrp1.deja.com>

Well since you didn't state the OS you are using it makes it a bit
difficult to help...

However, if you are running this on UNIX it is most likely a permission
problem.  Make sure that you have this file set for at least r-x--x--x.

If it's Windoze then make sure that the .pl extension is associate with
the perl binary perl.exe

In article <80f27i$68k$1@nnrp1.deja.com>,
  Dick Latshaw <latsharj@my-deja.com> wrote:
> In article <382AF5D6.BC3FAA4B@ti.com>,
>   Navin Chander <navin@ti.com> wrote:
> > If  I try to execute a perl fileby just specifying its name it does
> > not work.
> > $prompt> execute_file.pl
> >
> > but if i say perl before the executable it works
> >
> > $prompt> perl execute_file.pl
> >
> > I have the #!/usr/local/bin/perl at the top of my file.
>
> And execute_file.pl's directory is in your path?
> Try:
> $prompt>./execute_file.pl
>
> --
> Regards,
> Dick
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: Thu, 11 Nov 1999 17:19:12 -0000
From: "Chris" <chris@chrismail.connectfree.co.uk>
Subject: Re: Help woth perl
Message-Id: <382b0887.0@news2.cluster1.telinco.net>

It's meant to input data URL EMAIL and FORWARD this opens the file URL which
is a shortcut url e.g !www.whatever.com then if it has data in there then it
should print a message saying it has been taken if not it should print a
message saying there site has been accepted then a file is created for them
called there URL with FORWARD in it then it emails them at EMAIL with info
about there account

forward is meant to bring in a forward address signed up to using the other
script and for ward ing them to the address in the file.
--
Chris
chris@chrismail.connectfree.co.uk
www.bl-soft.com/chrissite




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

Date: Thu, 11 Nov 1999 06:35:41 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Hiding Perl Scripts?
Message-Id: <slrn82lagd.u1o.tadmc@magna.metronet.com>

On Thu, 11 Nov 1999 01:10:20 -0800 (PST), Mohammad Akram Ali Mehkri 
   <mehkri@yahoo.com> wrote:

>why dont u use perlcc to compile to the script to a bin code. 


   Because he wants to hide it, as he said in the Subject.

   "bin code" is not hidden, as the FAQ explains (have you even looked
   at that FAQ's answer?).



   And on top of that, he already said:


>> LorainCounty.com Webmaster (webmaster@LorainCounty.com) wrote:

>> :     I have read the FAQ (3 & 8) about compiling the code but as I read
>> : them
>> : that didn't seem to be the answer.


   So you are repeating (Jeopardy style) what the original poster
   already said (and following up to a followup without saying
   anything pertaining to the followup).


   Check out

       news.announce.newusers

   for a few days. Then come back and help us give people _good_ answers.



-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 11 Nov 1999 17:25:28 GMT
From: Nick <nickysantoro@yahoo.com>
Subject: How to encrypt a web log-in, and work w/accounts in Perl cgi?
Message-Id: <80eu68$2r3$1@agate.berkeley.edu>

Hello, I was wondering how to create accounts a while ago, and while I
couldn't find any prewritten scripts, I figured it couldn't be too hard.
Basically set up a passwd file and use a cgi log in page for the login...but
is it essentail that this is encrypted and how would you do that with Perl?
Also, once the user is logged in, bascially I just want them to be able to access
and change their account details, essentailly just one or two files of text.
Is the best way to do this is set a cookie and use that or is there some way
that you have a 'cookie' of sorts in every link for any of the 'actions' that
the user may need to do. 
Thanks for any info.



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

Date: Thu, 11 Nov 1999 12:41:13 -0500
From: Seshadri <seshadri@ptc.com>
Subject: Re: How to encrypt a web log-in, and work w/accounts in Perl cgi?
Message-Id: <382AFFB9.EA9BB31C@ptc.com>

On a similar prob. before, I'd used "htpasswd" in the apache/bin directory to create
a passwd.txt containing the username and their encrypted passwords. The encrypted
passwd, as far as I know, cannot be decrypted back to the original passwd. To
authenticate, I'd used "crypt" function in perl.. you can find info. about it at a
number of places.

Also, I wouldn't use cookies for authentication, ever.... unless security is a
non-issue!

Hope this helps.

- Sesh

Nick wrote:

> Hello, I was wondering how to create accounts a while ago, and while I
> couldn't find any prewritten scripts, I figured it couldn't be too hard.
> Basically set up a passwd file and use a cgi log in page for the login...but
> is it essentail that this is encrypted and how would you do that with Perl?
> Also, once the user is logged in, bascially I just want them to be able to access
> and change their account details, essentailly just one or two files of text.
> Is the best way to do this is set a cookie and use that or is there some way
> that you have a 'cookie' of sorts in every link for any of the 'actions' that
> the user may need to do.
> Thanks for any info.



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

Date: Thu, 11 Nov 1999 18:26:43 GMT
From: njc@dmc.uucp (Neil Cherry)
Subject: Re: IO-Tty binary package for W95?
Message-Id: <slrn82m2h1.qa6.njc@dmc.uucp>

On 11 Nov 1999 15:06:45 GMT, Bbirthisel wrote:
>Hi Neil:
>
>>Does anyone have a binary package (or a ppd) for the module IO-Tty?
>>I'm trying to get Expect.pm to work and it complains about pty's. Am I
>>looking for the right stuff?
>
>Probably not. I started down this path at one time on W95 and
>then abandoned the effort and put a subset of Expect.pm into
>Win32::SerialPort. Expect.pm really wants to treat processes
>and data streams as "virtual users" (hence the ptys) and W95
>doesn't really think in those terms. The author of Expect.pm
>seems to have come to a similar conclusion (based on the
>correspondence I had with him a couple years ago).

I sorta came to the same conclusion, rats.

>If your stream is coming from a serial device, and you need
>more than the current subset from Win32::SerialPort, let me
>know.

The stream is a socket, but thank you. I'll just have to write the
program a bit differently. I've been spoiled by the Expect package
under Linux. A few lines of code goes a long way (but then again that
is what Perl is for :-).

-- 
Linux Home Automation           Neil Cherry             ncherry@home.net
http://members.home.net/ncherry                         (Text only)
http://meltingpot.fortunecity.com/lightsey/52           (Graphics GB)



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

Date: Thu, 11 Nov 1999 17:20:10 GMT
From: citysearch@my-deja.com
Subject: Jobs Opportunities at CitySearch
Message-Id: <80ets4$2sp$1@nnrp1.deja.com>

Ticketmaster-Online CitySearch is an award-
winning provider of locally-developed online
information and transaction services relevant to
people’s everyday lives.  Established in 1994,
CitySearch went public in 1998 and has enjoyed
continued success and will expand into 20-30 new
markets in the next 2 years.

To facilitate our expansion into new and exciting
cities, we need bright, energetic, cutting edge
people to fuel our growth.  Here is one position
CitySearch is currently recruiting for:

Title: 	Manager, Web Application Development

Responsibilities:
This candidate will be responsible for managing
the Web Applications Development group.
Responsibilities include project and resource
management. This is a hands on management
position that will include analysis, design,
implementation, and testing of various software
systems and applications for TMCS - Ticketing. As
a key member of Technology, this candidate with
interface and implement software solutions for
internal groups, as well as TMCS's Internet
consumers. The solutions will cover areas related
to application design and development, plug-in
development, and database integration using a
variety of toolsets and development environments.
Qualifications:
· BS in Computer Science, Engineering or
  equivalent.
· 7+ years experience in software development.
· Strong application and project design skills.
· Experience with a variety of different
  programming languages (e.g., VB, Java, c/c++,
  Perl a plus).
· Strong application design and development
  skills; including Workflow models, Object
  Oriented design, and Application development
  life-cycles.
· At least 3 years of Internet development
  experience, using Web technologies (e.g., ASP,
  Perl, shell scripting, Web APIs, middleware
  platforms).
· At least 2 years of project (lead) management
  experience.
· Background in information and data management
  or transaction processing; good SQL experience.
· Experience with a variety of Operation Systems
  (e.g., NT, Mac, Solaris).
· Excellent project management skills. Must
  posses the ability to meet deadlines and manage
  tasks in an efficient manner.

If anyone is interested in being part of the “No.
1 City Guide” according to USA
Today/Intelliquest, please submitt your resume to
me via e-mail at eric_jaffe@citysearch.com.  If
you have any question please check out our
website at www.citysearch.com.



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


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

Date: Thu, 11 Nov 1999 12:36:16 -0600
From: Tom Briles <sariq@texas.net>
To: citysearch@my-deja.com
Subject: Re: Jobs Opportunities at CitySearch
Message-Id: <382B0CA0.5A9B4C40@texas.net>

['Courtesy' copy sent to citysearch@my-deja.com]

citysearch@my-deja.com wrote:
> 

<snipped Jobs Opportunities at CitySearch>

Excuse Me,

But where do you see the word 'job' in comp.lang.perl.misc?

- Tom


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

Date: Thu, 11 Nov 1999 11:43:47 -0600
From: Mark Russell <russellm@bellsouth.net>
Subject: Re: MYSQL question
Message-Id: <382B0052.40A59B58@bellsouth.net>

Yes, MySQL can do that, and much, much more. Look at www.mysql.com, and
subscribe to the list (mysql@lists.mysql.com).

Markic

sxbktm@my-deja.com wrote:

> Hi all,
>
> Can Mysql do select(distinct(count))?
> How about nested selects.
>
> I'd appreciate an answer, since I think MySQL is really good for what I
> am doing.  I just hope the answers to the above questions is 'yes'.
>
> BTW, is there a dedicated MYSQL forum.
>
> Thanks in advance.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Thu, 11 Nov 1999 11:46:06 -0500
From: Seshadri <seshadri@ptc.com>
Subject: Re: new line break???
Message-Id: <382AF2CE.21E39B48@ptc.com>

pch. pch... sorry... didn't realize the foolish mistake!  :-(

Larry Rosler wrote:

> In article <382A759C.23D67E97@worldnet.att.net> on Wed, 10 Nov 1999
> 23:51:56 -0800, Seshadri Sriperumbudur <seshadri9@worldnet.att.net>
> says...
> > Files with "^M" never caused me any trouble and I used the file in scripts as I
> > would use the same file without the "^M"s comfortably.
>
> I too have had no difficulty running DOS-formatted Perl files on Unix.
> But that is because I always use the '-w' flag.  If there are no flags
> on the hashbang line, the shell doesn't launch the perl process
> properly.  So in general the carriage-return characters should be
> stripped.
>
> >           I'm not a perl guru but try this:
> >
> > while (<FILE>) {
> >     $_ =~ s/.*[^]M//g; # mebbe i meant $_ =~ s/(.*)\cM$/$1/g; but it would still
> not match "^M"s in between the line. It might work only for lines that end with
> ^M.... might.

>
> >     print OUT $_;
> > }
>
> Your regex is irrelevant, because the string '^M' has nothing to do with
> the control character "\cM".  Even if you meant "\cM", would you want to
> wipe out all characters ahead of it?  And how can it match more than
> once on a line?
>
> > Of course you should have filehandles FILE and OUT "open"ed be4 u try this.
>
> Well, *that*'s true, no matter how k3wl you think your spelling is,
> d00d!
>
> > YoungJoon Yoon wrote:
>
> <SNIP> of out-of-place quotation of the roiginal post.
>
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com



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

Date: Thu, 11 Nov 1999 10:52:51 -0600
From: Tom Briles <sariq@texas.net>
Subject: Re: Online OO Perl tutorial?
Message-Id: <382AF463.6FA7D0B5@texas.net>

Brian Simpson wrote:
> 
> I'm looking for a online crash course in object-oriented Perl
> on the Internet.  Does anyone know of any good sites?
> 
> Brian Simpson
> bsimpson -at- fc -dot- hp -dot- com

perldoc perltoot

- Tom


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

Date: Thu, 11 Nov 1999 17:04:10 GMT
From: gkl200 <gkl200@my-deja.com>
Subject: Parse delimited file with \n's.
Message-Id: <80esu6$20n$1@nnrp1.deja.com>

Hi, is there a Perl function or an easy way to parse the following line
of data below into three fields? I want to take exported tab delimited
text data from MSAccess and import into MySQL.

I know I can use MySQL's "LOAD DATA INLINE" function, but I was
wondering if there was a similar function in Perl.
thanks

data:
"AAA"\t"BBB"\t"CCC\nDDD\nEEE\nFFF"\n

becomes:
$field1 = "AAA"
$field2 = "BBB"
$field3 = "CCC\nDDD\nEEE\nFFF"


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


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

Date: Thu, 11 Nov 1999 18:27:54 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Parse delimited file with \n's.
Message-Id: <382AFC9A.46D67CB3@ife.ee.ethz.ch>

gkl200 wrote:
> 
> Hi, is there a Perl function or an easy way to parse the following line
> of data below into three fields? I want to take exported tab delimited
> text data from MSAccess and import into MySQL.

> data:
> "AAA"\t"BBB"\t"CCC\nDDD\nEEE\nFFF"\n

look at the documentation for split:
perldoc -f split

my @fields = split /\t/, qq{"AAA"\t"BBB"\t"CCC\nDDD\nEEE\nFFF"\n};

#@fields = (qq("AAA"), qq("BBB"), qq("CCC\nDDD\nEEE\nFFF"\n))

- Alex


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

Date: 11 Nov 1999 17:28:47 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Parse delimited file with \n's.
Message-Id: <80eucf$oc4$1@lublin.zrz.tu-berlin.de>

gkl200  <gkl200@my-deja.com> wrote in comp.lang.perl.misc:
>Hi, is there a Perl function or an easy way to parse the following line
>of data below into three fields? I want to take exported tab delimited
>text data from MSAccess and import into MySQL.
>
>I know I can use MySQL's "LOAD DATA INLINE" function, but I was
>wondering if there was a similar function in Perl.
>thanks
>
>data:
>"AAA"\t"BBB"\t"CCC\nDDD\nEEE\nFFF"\n
>
>becomes:
>$field1 = "AAA"
>$field2 = "BBB"
>$field3 = "CCC\nDDD\nEEE\nFFF"

perldoc -f chomp
perldoc -f split

Anno


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

Date: Thu, 11 Nov 1999 11:54:18 -0600
From: Tom Briles <sariq@texas.net>
Subject: Re: Parse delimited file with \n's.
Message-Id: <382B02CA.79069977@texas.net>

gkl200 wrote:
> 
> data:
> "AAA"\t"BBB"\t"CCC\nDDD\nEEE\nFFF"\n
> 
> becomes:
> $field1 = "AAA"
> $field2 = "BBB"
> $field3 = "CCC\nDDD\nEEE\nFFF"

perldoc -f chomp
perldoc -f split

If this is the answer (meaning there isn't more to the problem that you
haven't stated here), then you really need to make some sort of effort
towards Learning Perl (hint, hint) before posting.

- Tom


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

Date: Thu, 11 Nov 1999 06:58:04 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Passing arrays + other arguments to a subroutine
Message-Id: <slrn82lbqc.u1o.tadmc@magna.metronet.com>

On Thu, 11 Nov 1999 13:42:01 +0100, Alex Rhomberg 
   <rhomberg@ife.ee.ethz.ch> wrote:
>irf@netexecutive.com wrote:

>> however, what if i want to pass other arguments to the subroutine,
>> for example,
>> 
>> mySub(@xArray, $xVar, $yVar, zVar); ?
>> 
>> Now, within the sub, I would like to access $xVar by using $_[1],
>> $yVar by using $_[2] and so on.
>
>I recommend against using $_[]. It is better to shift (or pop) the
>contents into my-vars.


   That depends entirely on the semantics needed by the subroutine.

   If it only needs "read" access to the vars, then copying them
   and working with the copy is indeed A Good Idea (unless there
   is lots of stuff to copy and performance is an issue).

   But if the sub is supposed to modify its args, then that
   won't work (and so, of course, can't be "recommended"  :-)



>Here are three possibilites to pass an array and other args:
>1. (Recommended) Array last:


   That works without having to understand references.

   But for arrays of any significant size, #3 (passing a reference)
   is Recommended.


>sub mySub1 {
>  my ($a,$b,$c) = (shift,shift,shift); #shift them from head of @_
>  my @arr = @_;


   That's a lot of mess that can be rewritten thus:

      my($A, $B, $c, @arr) = @_;

   ( I can't bring myself to use $a and $b outside the context of sorting. )


>2. Array first:
>
>sub mySub2 {
>  my ($c,$b,$a) = (pop,pop,pop);  #pop args from tail of @_
>  my @arr = @_;
>  print "@arr -- $a,$b,$c\n";
>}
>
>3. w/reference, see perlre manpage:
                     ^^^^^^

   make that: see perlref manpage :-)


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 11 Nov 1999 13:40:45 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: Perl and commonsense part 2
Message-Id: <slrn82m3dc.q97.dha@panix.com>

On Wed, 10 Nov 1999 14:23:48 -0500, Ala Qumsieh <aqumsieh@matrox.com>
wrote:

>If Perl knew what you were expecting, then why would it generate a
>different result? Perl has a history with DWIM (Do What I Mean)
>approaches, and most (if not all) of its shortcuts are geared towards
>that.

Indeed.  The downside is that we get this thread.  :-)

Kidding aside, I think that threads like this *are* the result of perl
being very DWIM, stemming, specifically, from the fact that some
people (not that surprisingly) don't see the fine line between
*trying* to DWIM and *actually* DWIM.  Perl is not (yet :-) psychic.
It can't do what *everyone* means *all* the time, because there is no
standard for that.  Nevertheless, since perl tries so hard to DWIM,
some people think that it (unlike most computer languages) *should*
DWIM.

Just my take on this particular philosophical issue.

dha
-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
I see people didn't read the smiley I didn't include.
      - John W. Baxter


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

Date: Thu, 11 Nov 1999 07:27:42 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Q: Parsing a simple script language
Message-Id: <slrn82ldhu.u1o.tadmc@magna.metronet.com>

On Thu, 11 Nov 1999 02:49:53 +0100, Thomas Ĺhlen <thomas2@dalnet.se> wrote:

>I have made a perl package that parse an html template and inserts data from
                                               ^^^^^^^^

   Have you had a look at CPAN for modules with "template" in
   their name?

   There are a bunch of them. Maybe one can be adapted to your purposes...


>an MySql database.
>To make things a bit dynamic i have made a little script language which i
                                     ^^^^^^^^^^^^^^^^^^^^

   Why not use Perl as the script language?


>insert in the templates.
>Well it might look something like this:

[snip]

>        <!--A_IF product_price > 100 -->
>          <td>@@product_name@@</td><td>@@product_description@@</td>
>        <!--A_IF_END-->

>Currently i use regular expressions to match the blocks and do the
>insertion.


   Since you have an if() statement, a regex won't cut it if you
   are allowed to nest if() statements to an arbitrary depth.


>But i don't like it. If i want to insert some new functionality there will
>be
>some regs. to change an it doesn't feel good or dynamic.
>
>Someone with experience with this kind of problem.


   the Text::Template module does pretty much what you have
   described, but uses Perl as the scripting language.


      http://www.plover.com/~mjd/perl/Template/

-----------------------------
Text::Template is a module for filling in templates. A template is a 
file or a string that has bits of Perl code, called
program fragments, embedded in it. Program fragments are 
delimited by curly braces. They can be simple variable
references like {$var} or complicated programs that define 
and call functions and assemble big chunks of HTML text.
When a template is filled in, the program fragments are executed, 
and each is replaced with the values they compute, so
for example {$var} is replaced with the value of $var. 
Parts of the template that are not program fragments are returned
verbatim.

This is useful for generating form letters, CGI program output, and 
many other kinds of text. 
-----------------------------



>What is the best way to make a simple parser that handles nested
                         ^^^^^^^^^^^^^^^^^^^^

   I would opt for a "parser that already exists" over making
   up a new one, unless there is some compelling reason that
   requires Yet Another Language.


>if, elsif och elses and some other homebrewed tokens.
>Bison, yacc?


   Oh. So you already know that regexes aren't enough. Sorry.


>We used yacc in school a couple of years ago, I hardly remeber it now.
>Is it worth relearning for the problem described above?
>
>Well all you perl experts how do you do it..:)


   We don't know enough to give any expert opinion.

   We don't know _why_ you "need" to create your own language.

   Maybe you don't need to.

   Or maybe you do (restricting to a "sandbox", for instance)


   If you really need to create your own language, then you
   should read up on how to process languages _before_ you
   design it. You may be able to design it in such a way that
   it is easier to process.

   There are modules that can help implement the parsing on
   CPAN, such as Parse::RecDescent.

   Good luck!


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 11 Nov 1999 11:02:34 -0800
From: "Mark Ruedy" <mruedy@alidian.com>
Subject: Quoting difference between Perl versions
Message-Id: <382b1191$0$231@nntp1.ba.best.com>

Hi,

I was using the perl5.004_04 build for Intel, which came with MKS toolkit.
After I had developed a lengthy script I realized that I wanted to use a
module to allow me to send email.  I found that the MKS distribution was
missing some standard modules required for the sendmail module that I want
to use.  So I downloaded another, more complete version: perl5.004_04 built
for MSWin32-x86.  The email works great, but the new version of perl breaks
my script in another place.  I have not been able to figure out how to get
around this problem.

This type of thing worked fine in the version built for Intel:

$cmd = "\"N:\\Program Files\\Microsoft Visual Studio\\Vss\\Win32\\ss.exe\"
Get \$/sw   \"-VLBuild 18 (AUTOMATIC)\"     |";
open(CMD,$cmd);
while(<CMD>) {
   print "$_\n";
}
close(CMD);
$sStatus = eval($? / 256);
print "$sStatus\n";

Here I am trying to invoke the SourceSafe command line.  The problem appears
to be the parameter:

\"-VLBuild 18 (AUTOMATIC)\"

Which properly expands to :

"-VLBuild 18 (AUTOMATIC)"

in the command line.  If I remove this -V parameter, SourceSafe executes as
expected.   In the perl version build for MSWin32-86, the 'print $_' line
looks the same, but for some reason it appears that the system can't
understand the call.  What I see from the 'print $_' line is:

The name specified is not recognized as an
internal or external command, operable program or batch file.

(The NT version of 'Bad command or filename')

How can I properly quote this parameter, or is there another way I can make
the SourceSafe call?

Thanks in advance.






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

Date: Thu, 11 Nov 1999 18:09:16 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: substitution: $& equals replaced text
Message-Id: <382AF83C.F697CFE5@ife.ee.ethz.ch>

rafala@my-deja.com wrote:

> This would be necessessary for complex patterns that use lots of
> $scalers, optional wildcards (?), and alternation ( a|b ). That is,
> when looking for many different variations of some text to be
> standardized, sometimes you can't avoid matching the desired version of
> the text.

You can store this in a variable in the s/// statement:

my $repltxt;
$_ = "hallo du da";
s/ (du?)/$repltxt = "($1)"/e;
generally:
s/complexregexp/$repltxt = "complex substituion"/e;

> A contrived example would be:
> 
> s/(S(mith)?)[\/\-\s]?(\sand|&)?\s?(J(ones)?)/[stuff]$1[otherstuff]$3
> $4/g;

Using s///g is not so optimal, you will only be able to grab the last
replaced text.

you could do
my @a;

s/ (du?)/push(@a, [$&,"($1)"]), $a[-1][1]/eg;
To grab all of the replace/new text pairs, but explicit iteration would
be better.

- Alex


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

Date: Thu, 11 Nov 1999 12:52:54 -0600
From: ##defaultuser##@cse.unl.edu
Subject: to write a BAT/PERL script to lock the windowsNT file structure
Message-Id: <382B1086.2C262850@cse.unl.edu>

I am new to perl. Could anyone help me writing a PERL/BAT script to lock
windows NT file structure. I will be thankful to you.
Terlapu
email id: terlapu@hotmail.com



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

Date: Thu, 11 Nov 1999 17:44:20 GMT
From: kbandes@home.com (Ken Bandes)
Subject: Re: Visual Package Manager (VPM)
Message-Id: <8E7B876B1kbandeshomecom@192.168.123.1>

mpauser@uswest.com (mpauser) wrote in <382AD6A0.B89A57A9@uswest.com>:
>Is there a way to get VPM without getting the whole PRK?
>
>I'm not trying to warez,  I just need VPM without the rest of the PRK.

Why not use PPM?  It comes with the free ActiveState distribution.  I
have the PRK but I use PPM anyway.

Ken Bandes


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

Date: Thu, 11 Nov 1999 12:33:37 -0500
From: Qinqiang Sun <qsun@kitco.com>
Subject: Why different output between Perl.exe and perlis.dll ?
Message-Id: <382AFDF1.EB2FD3BA@kitco.com>

Hi,
I use active perl building522  and IIS4.0 on WinNT4.0.
When using perl.exe to run scripts, everything is fine. I changed to use
perlis.dll to run scripts and got the header on my page I don't want
"HTTP/1.0 200 OK Date: Thu, 11 Nov 1999 17:30:37 GMT Server:
Microsoft-IIS/4.0".

What makes the difference? Please help?

Sun



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

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


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