Using defined array with split command

2003-06-05 Thread Scott, Joshua
Good evening,

I'm having a hard time figuring out how to make a portion of my script work.
Basically I'd like to split a specific field and use the names from an array
as the scalar variable names for each field.  Here is a snip of my code:

# Begin Code
$data = "A  Tab Separated   DataFile";
@fields = qw/field1 field2 field3 field4 field5/;
(@fields) = split("\t",$data);
Print "$field2\t";
Print "$field3\n";
# End Code

The print statements don't output "Tab" or "Separated" like I'd like them to
do.  What am I doing wrong here?  What is the best way to do this type of
function?  

Thank you very much for any assitance you can provide.

Joshua Scott 
Security Architect, CISSP 
626-568-7024

==
NOTICE - This communication may contain confidential and privileged 
information that is for the sole use of the intended recipient. Any viewing,
copying or distribution of, or reliance on this message by unintended
recipients is strictly prohibited. If you have received this message in
error, please notify us immediately by replying to the message and deleting
it from your computer.

==


Re: Warnings/strict still needed?

2003-06-05 Thread Rob Dixon
James Edward Gray II wrote:
> On Wednesday, June 4, 2003, at 03:45  PM, John W. Krahn wrote:
>
> > > Does it hurt performance having them?
> >
> > No.
>
> Are we sure about this?  I find it really hard to believe that
> 'warnings' isn't affecting performance on some level.  I doubt it's
> a big hit, but I would be very surprised if it doesn't cost
> something.

Hi James.

I know you weren't suggesting to the contrary, but as I keep saying
(although nobody seems to agree with me) it's pointless to worry
about the speed of the program unless it's too slow. It's worth
noting that we have a lot of questions about whether such-and-such
a construct has a performance hit, but almost never about
unnacceptably slow programs that need speeding up. I doubt if
it's because all of the optimisation tips are taken to heart!

It's twenty or thirty years since we had to write programs carefully
so that they would fit in 4KB of RAM and complete before the end of
the day.

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using defined array with split command

2003-06-05 Thread Rob Dixon
Hi Joshua

Joshua Scott wrote:
> Good evening,
>
> I'm having a hard time figuring out how to make a portion of my
> script work. Basically I'd like to split a specific field and use
> the names from an array as the scalar variable names for each
> field.  Here is a snip of my code:
>
> # Begin Code

  use strict;# always
  use warnings;  # usually

> $data = "A Tab Separated Data File";
> @fields = qw/field1 field2 field3 field4 field5/;

Here you're setting @fields to the list of field names,
as you probably knew.

> (@fields) = split("\t",$data);


And here you're overwriting those field names with
their values from $data.

> Print "$field2\t";
> Print "$field3\n";
> # End Code
>
> The print statements don't output "Tab" or "Separated" like I'd
> like them to do.

Not sure what you mean here. Is this something another language
does?

> What am I doing wrong here?  What is the best way
> to do this type of function?
>
> Thank you very much for any assitance you can provide.

Now that you've just added 'use strict', there's a way of
doing it by disabling it again :) But since it's frowned
upon I shan't tell you about it.

What you need is a hash. Then you can assign a 'slice' of
that hash like this

  use strict;
  use warnings;

  my $data = "A Tab Separated Data File";
  my @fieldnames = qw/field1 field2 field3 field4 field5/;
  my %fields;
  @[EMAIL PROTECTED] = split "\t", $data;
  print $fields{field2}, "\t";
  print $fields{field3}, "\n";

I hope this helps.

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Unix diff in perl

2003-06-05 Thread Ohad Ohad
hey,

Is there a perl function/module that will help me calculate the difference 
between two files?
Something like the diff Unix command.

10x
Ohad.
_
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Unix diff in perl

2003-06-05 Thread Sumit_Babu





>hey,
>
>Is there a perl function/module that will help me calculate the difference

>between two files?
>Something like the diff Unix command.
>
>10x
>Ohad.

There is a perl module which can do the same.

Check out http://search.cpan.org/search?query=diff&mode=all for more
information.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Unix diff in perl

2003-06-05 Thread Rai,Dharmender
use File::Compare

> --
> From: Ohad Ohad[SMTP:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2003 2:31 PM
> To:   [EMAIL PROTECTED]
> Subject:  Unix diff in perl
> 
> hey,
> 
> Is there a perl function/module that will help me calculate the difference
> 
> between two files?
> Something like the diff Unix command.
> 
> 10x
> Ohad.
> 
> _
> Protect your PC - get McAfee.com VirusScan Online 
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Confidential:  This electronic message and all contents contain information
from Syntel, Inc. which may be privileged, confidential or otherwise
protected from disclosure. The information is intended to be for the
addressee only. If you are not the addressee, any disclosure, copy,
distribution or use of the contents of this message is prohibited.  If you
have received this electronic message in error, please notify the sender
immediately and destroy the original message and all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



One more newbie OLE question

2003-06-05 Thread Leon
I am just learning about OO programming and it is definitely really cool.  I am 
reading David Roth's Win 32 Perl Programming and he uses word and excel as example 
applications.  He calls a bunch of different (I think the term i am looking for here 
is methods but I just posted a question about methods and functions so no flames 
please) and I was just wondering this; where do you find out all the different method 
calls.  I am guessing that you would have to find that stuff on the developers 
website?  I am most interested in M$ methods since the enviroment I work in is 
primarily a M$ shop.  So I am wondering: Where do you find the methods that relate to 
applications and specifically if anyone has any links to Microsoft ones.
 
Thx,
Leon


-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

RE: One more newbie OLE question

2003-06-05 Thread Tobias Hoellrich
Try this as a starting point for the description of the Office Object model:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaof10/htm
l/oftocObjectModelApplication.asp
 
In order to disect Type-Libraries, which contain information about
Objects/Methods either use the OLE-Browser that comes with ActiveState's
perl build (mine is at C:\Perl\html\OLE-Browser\Browser.html) or download
Microsoft's OLE/COM Viewer from
http://www.microsoft.com/com/resources/oleview.asp
 
Cheers
  Tobias

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Leon
Sent: Wednesday, June 04, 2003 10:59 AM
To: win32
Cc: perl
Subject: One more newbie OLE question


I am just learning about OO programming and it is definitely really cool.  I
am reading David Roth's Win 32 Perl Programming and he uses word and excel
as example applications.  He calls a bunch of different (I think the term i
am looking for here is methods but I just posted a question about methods
and functions so no flames please) and I was just wondering this; where do
you find out all the different method calls.  I am guessing that you would
have to find that stuff on the developers website?  I am most interested in
M$ methods since the enviroment I work in is primarily a M$ shop.  So I am
wondering: Where do you find the methods that relate to applications and
specifically if anyone has any links to Microsoft ones.
 
Thx,
Leon



  _  

Do you Yahoo!?
Free online  
calendar with sync to Outlook(TM).



RE: Unix diff in perl

2003-06-05 Thread Rai,Dharmender
you can use File::Compare module to achieve that. 

> --
> From: Ohad Ohad[SMTP:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2003 2:31 PM
> To:   [EMAIL PROTECTED]
> Subject:  Unix diff in perl
> 
> hey,
> 
> Is there a perl function/module that will help me calculate the difference
> 
> between two files?
> Something like the diff Unix command.
> 
> 10x
> Ohad.
> 
> _
> Protect your PC - get McAfee.com VirusScan Online 
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Confidential:  This electronic message and all contents contain information
from Syntel, Inc. which may be privileged, confidential or otherwise
protected from disclosure. The information is intended to be for the
addressee only. If you are not the addressee, any disclosure, copy,
distribution or use of the contents of this message is prohibited.  If you
have received this electronic message in error, please notify the sender
immediately and destroy the original message and all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



What's the matter about the install?

2003-06-05 Thread Ying Liu
I don't have the root permission and I can't write to the root folder. I
set the "PREFIX=/mz/hd/liuyi", and I changed the following direction:
INSTALLPRIVLIB
INSTALLARCHLIB
INSTALLSITELIB
INSTALLSITEARCH
INSTALLBIN
INSTALLSCRIPT
INSTALLMAN1DIR
INSTALLMAN3DIR
such as: INSTALLPRIVLIB=$(PREFIX)/perl5/5.00503

But when I run(t.pl):
#!/bin/perl
use lib "/mz/hd/liuyi/perl5/site_perl/5.005";
use Heap "/mz/hd/liuyi/perl5/site_perl/5.005";

It told me:
"/mz/hd/liuyi/perl5/site_perl/5.005" is not exported by the Heap module at
t.pl line 3
Can't continue after import errors at t.pl line 3
BEGIN failed--compilation aborted at t.pl line 3.

What's the matter with my install? During install, it skiped lots of
steps. Is it important? How can I install it under my folder?

Thank you very much!
Ying




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Sending free SMS through perl

2003-06-05 Thread Tarun Dua
On Sat, 31 May 2003 20:55:13 +0530, Aman Thind wrote:

> Hi All
> 
> How can I send a free SMS through perl ?
> 
> I am fighting a losing battle with WWW-SMS-0.09.
> 
> I created an account on gomobile.ch but everytime i try to send an sms using
> gomobile as the submodule I get an error msg saying my number is not
> compatible with gomobile gateway...however it took the same number in it's
> registration form.
> 
> Could anyone point me to the light please...is their a sure and simple way
> to achieve the same ?
> 
> Thanks
> Aman


Dear Aman,

If you intend to merely send an SMS to a number your should use the
web-based interface or the e-mail2SMS gateway that most service providers
provide for free. What WWW-SMS-0.09 is providing you is a web-based
access to a few supported service providers scripted through perl. 
Does gomobile.ch directly provide Internet2SMS/Web2SMS/SMS2SMS gateway
services by interconnecting to all GSM providers(directly or indirectly ).

Tarun Dua

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unix diff in perl

2003-06-05 Thread Elias Assmann
On Thu, Jun 05, 2003 at 02:56:01PM +0530, [EMAIL PROTECTED] wrote:

> >Is there a perl function/module that will help me calculate the difference
> 
> >between two files?
> >Something like the diff Unix command.
> 
> There is a perl module which can do the same.
> 
> Check out http://search.cpan.org/search?query=diff&mode=all for more
> information.

There is also the Perl Power Tools diff implementation:

http://www.perl.com/language/ppt/src/diff/index.html

Elias

-- 
I grew up assuming women were our equals. I can't imagine thinking I'm
better suited to hack C code because of my penis -- frankly, I rarely
use my penis at all while I'm working.
-- Dave Eisen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Is empty directory?

2003-06-05 Thread Mark G

- Original Message - 
From: "Jair Santos" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 05, 2003 7:00 PM
Subject: Is empty directory?


> Hi all,
> 
> does anybody knows how to check if a diretory is empty?

 You can open it {opendir } and see for your self {readdir}

Mark G


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Flush Everything

2003-06-05 Thread Voodoo Raja
Hi there

I have got a script running..

Its ment to  repeat  a particular sub routine using the "after" syntax

All i want to do is clear everything in buffer ... since it eats up the 
memory

I do not need any varaibles which I have defined in the sub.

there are more then enough to init manually.

Is there any command I can use to kill any constants assigned.

any piiece of code will be helpful

thanks
SAM
_
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Learning Graphics - Problem with Hello World Example / Fixed it!

2003-06-05 Thread Todd Wade

"Clint" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I was able to get it fixed. Here's what I did in case someone else runs
into
> the same problem:
>
> Changed from these lines:
>  my $image = new GD::Image(401,201);  (btw: this line is different than
what
> is found in the text)
>  $image->trueColor();
>
> to these lines:
> my $image = new GD::Image->new(401,201);

Sometimes I hate indirect object notation. It looks slick, but there are a
few gotchas involved.

You can get rid of that first new and it will still work:

[EMAIL PROTECTED] trwww]$ perl -MO=Deparse
use GD::Graph;
$image = new GD::Image->new(401, 201);
Ctrl-D
$image = 'GD::Image'->new->new(401, 201);
- syntax OK

The line after Ctrl-D is output by the Deparse module to show how perl
interpreted your statement. Your code works, but only by chance.

Todd W.

>
> Clint
>
> On Wednesday June 4 2003 10:51 pm, Clint wrote:
> > I am new to Perl and trying to learn graphics by the examples given in
> > Shaun Wallace's Perl Graphics Programming.  I'm using Perl 5.8 and have
> > installed GD and GD::Graph using CPAN.  I've checked to verify both
modules
> > are installed using a "findmodules" script I found elsewhere, and here
is a
> > snippet with the versions:




Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Warnings/strict still needed?

2003-06-05 Thread Todd Wade

"Michael Weber" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Just wondering.
>
> After I debug my perl scripts do I still need the strict and warnings
> flags?
>
> Does it hurt performance having them?
>
> Does it hurt security removing them?
>
> The scripts are for system admin only, not CGI where I would assume
> they should be left in.

My large programs usually have a state object. What I like to do is look at
a warning as an event and set my own handler for $SIG{__WARN__} that emails
me my state object ala Data::Dumper.

So at that point I consider warmings a requirement and not a development
option.

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl - Web Development

2003-06-05 Thread Todd Wade

"Paul Kraus" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This may be asking for biased opinions but here goes anyways...
>
> Is perl still a good choice for the web. For instance I need to setup a
> couple sites that are going to be running on IIS. Is perl still a good
> choice for speed ect...
>
> Or should I look at the newer technologies such as vb.net on for that
> matter c#.

I really hate playing (mico)devils advocate, but ASP.NET combined with
Visual Studio.NET is really, really, REALLY nice. Mainily what I am talking
about is the debugging features. When you right click on the solution in the
solution explorer, you can choose a file to load in the solution, you can
type in a url to debug, or it has an option that says "wait for external
process to connect". Then when you hit F10 the debugger will fire up in
whatever mode that was specified, and debug an enire browsing session, not
just a single request. For example, after the first debugging page loads the
debugger does not stop. If the next link you click or html form you submit
goes back to your server, the debugging session continues. So you can
thoretically step over every line of code in your app from log in to log out
in one debugging session.

And I havent even mentioned intellisense. If you thought VS6 intellisense
was even kind of okay, VS.NETs intellisense is absolutely amazing. Strong
typing is enforced, but it dosent really matter becase intellisense tells
you what data type each function/method returns, so you dont have to dig in
the docs to determine how to declare your object. There is even a XML based
documentation system so you (the class author) can tell your users what
datatypes your functions/methods reurn. The user adds a reference to your
assembly in thiers, and your assembly works just like a builtin .NET class
library.

*nix web development has absolutely nothing like this. The best I have found
is Apache -X and ptkdb for mod_perl, or activestate's CGI environment debugg
ing (that handles perl, python, and PHP) which are mediocre at best when
compared to VS.NET

And then there is the FOR XML clauses in Transact-SQL, a SQL superset
supported by SQL Server 2000. Its, well, really nice.

But I did prototype an app on a redhat mod_perl Apache httpd and it was
noticeably faster than the app I subsequently converted to ASP.NET.

> I know perl and the idea of being able to use the same language in
> everything I do would be great but am I going to take a hit on
> performance. Can it be embedded into html? What is mason does that run
> on IIS.

Embedding logic in markup is a maintanence nightmare. Learn, Live, Love the
model-view-controller pattern. Vive XML.

> I use perl now for admin task and reports(yes perl is good for reporting
> ;) ). I can use the same tools I design on my Linux, UNIX, and window$
> machines. But is it wise to do so for the web. CGI has been around for a
> long time and there are a lot of new emerging technologies.
>

I learned ASP.NET because I had to for a job. All my freelance work was and
is still developed in mod_perl, if that says anything. I would just like a
nice IDE. VS.NET has spoiled me.

I guess we could make one, Mozilla has alot of the work done already. Group?

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Flush Everything

2003-06-05 Thread Tassilo von Parseval
On Fri, Jun 06, 2003 at 04:12:11PM +1200 Voodoo Raja wrote:

> I have got a script running..
> 
> Its ment to  repeat  a particular sub routine using the "after" syntax

What is the "after" syntax? Do you mean statement-modifiers as in

function() for 1 .. 10;

?

> All i want to do is clear everything in buffer ... since it eats up the 
> memory

Which buffer?

> I do not need any varaibles which I have defined in the sub.

If you don't need them, why did you define them in the first place?

> there are more then enough to init manually.
> 
> Is there any command I can use to kill any constants assigned.

Why do you assign constants if you want to kill them?

> any piiece of code will be helpful

I think it's up to you to provide the code you have so far and want
assistance with. Right now I don't have even a vague idea of what your
problem is.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Regular expressions

2003-06-05 Thread R. Joseph Newton
Saurabh Singhvi wrote:

> well i was trying to understand the "regular
> expressions" in perl when i came across 

Please recognize this as the coincidence it is.  Regular expressions
and filehandles are two different subjects.  If you are somehow
linking the particular built-in filehandle with the regular
epression tools, you should break the linkage, and study each on its
own.

> i
> tried my best but i havent been able to get the
> slightest idea on how the input thing works.

The thing that works is not the filehandle itself, but the getline
operator <>.  Placing the filehandle STDIN within the angle
barckets--in a context where the expreesion is an rvalue in a scalar
assignment, tells the operator to act on STDIN.  Likewise, when
taken in an array or list context, the operator gets all
lines/records from the file and pushes each into the list on the
left of the assignment.

> The
> editor i use is DzSoft.

Was this editor designed for Perl?  I would recommend using a simple
code editor that offers auto-indent and Unix line endings. but
without code-sensitive features.  Your best bet is to take the error
and warnings messages directly from the command-line, since an
intermediary application may simply add another layer of confusion

> And it shows something like
> "get" and something else below like script something

"something"s will seldom lead to progess in debugging.  I don't mean
to be picky here, but programming is a preisise art, where each
character is in the code for a specific, and hopefully
well-tought-out reason.  Likewise, debugging messages arte delivered
in as exact a form as logically possible.

 I put it this way because the interpreter generally issues an error
only when the meaning or intent of code is impossible to decipher.
When you use strict, you essentially tell the interpreter to do a
little ;ess mind-reading, and to tell you when your instructions are
too vague to be dependable.

>
> with blank space.
>
> Any  hopes 4 me?? :-(

Sure.
use strict;
Pay attention to the exact wording of messages returned by the
interpreter.
Don't deal with thingies, gizmos, or whatnots.  Learn specific
program structures and constructs, and respect the material.

If you have a true passion for creating process, and you are willing
to put serous and careful work into it, you can learn to program.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl - Web Development

2003-06-05 Thread Gabor Urban
From: "Paul Kraus" <[EMAIL PROTECTED]>
Subject: Perl - Web Development
Date: Wed, 4 Jun 2003 09:49:10 -0400

> This may be asking for biased opinions but here goes anyways...
> 
> Is perl still a good choice for the web. For instance I need to setup a
> couple sites that are going to be running on IIS. Is perl still a good
> choice for speed ect...
> 
> Or should I look at the newer technologies such as vb.net on for that
> matter c#.

Be alert if you choose new technologies they may be not so
mature. (For example whisky is the best at 12 years :-) ) C# and .net
are Microsoft stuff, so you'll lose the platform independence.

> I know perl and the idea of being able to use the same language in
> everything I do would be great but am I going to take a hit on
> performance. Can it be embedded into html? What is mason does that run
> on IIS. 
> 
> I use perl now for admin task and reports(yes perl is good for reporting
> ;) ). I can use the same tools I design on my Linux, UNIX, and window$
> machines. But is it wise to do so for the web. CGI has been around for a
> long time and there are a lot of new emerging technologies.

Old reliable tools. You may check PHP, too.
> 
> Rule of thumb is choose the best tool for the job. So all input is
> appreciated.
> 
Agreed, good luck.

Gabaux
Linux is like a wigwam: no gates, no windows, and an apache
inside!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl - Web Development

2003-06-05 Thread Shlomi Fish
On Wed, 4 Jun 2003, Paul Kraus wrote:

> This may be asking for biased opinions but here goes anyways...
>
> Is perl still a good choice for the web.

Yes. Perl is a very good choice from all aspects.

> For instance I need to setup a
> couple sites that are going to be running on IIS. Is perl still a good
> choice for speed ect...
>

If you're running it on IIS, you can try using ActiveState's PerlEx:

http://www.activestate.com/Products/PerlEx/

This will make Perl very fast, in a comparable speed to Apache's mod_perl.

> Or should I look at the newer technologies such as vb.net on for that
> matter c#.
>

I don't know too much about VB.Net C#, or ASP.Net so I cannot comment. I
know ASP.Net has a problem in which you need to explicitly deallocate all
the allocated resources, or else they'll leak.

> I know perl and the idea of being able to use the same language in
> everything I do would be great but am I going to take a hit on
> performance. Can it be embedded into html? What is mason does that run
> on IIS.
>

Mason can run on top of IIS by means of its CGI emulation. However,
there's also Perl ASP, which is a native IIS technology. They are similar
in spirit but Mason is more powerful.

> I use perl now for admin task and reports(yes perl is good for reporting
> ;) ). I can use the same tools I design on my Linux, UNIX, and window$
> machines. But is it wise to do so for the web. CGI has been around for a
> long time and there are a lot of new emerging technologies.
>

Perl can utilize other technologies besides CGI using much the same
interface. You can run Perl on top of mod_perl, or PerlEx, or something
similar. They are faster than CGI.

> Rule of thumb is choose the best tool for the job. So all input is
> appreciated.
>

I believe Perl is still the best tool for the job of web-publishing.

Regards,

Shlomi Fish

> PK
>
>
>



--
Shlomi Fish[EMAIL PROTECTED]
Home Page: http://t2.technion.ac.il/~shlomif/

An apple a day will keep a doctor away. Two apples a day will keep two
doctors away.

Falk Fish

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: cgi LWP::Simple script and Apache

2003-06-05 Thread Dan Muey
> > So now my questions would be:
> > Can you open 216.239.51.100 in a browser?
> www.google.com
> > Can you open 172.20.250.1 in a browser?
> www.wokingham.gov.uk
> 
> Yes for both...I'm checking to see if the protocol is
> okay as we have a firewall and that may be
> interfering...

Perhaps the firewall, perhaps something is looking at the UserAgent and not seeing IE 
or Mozilla says 'no site for you!'.

This may be something you want to ask the LWP mailing list about. 
Not sure of their address but take a look at www.perl.org

Hope you get her figured out!

Dan

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: cgi LWP::Simple script and Apache

2003-06-05 Thread NYIMI Jose (BMB)
Here :
http://lists.perl.org/showlist.cgi?name=libwww
http://lists.perl.org/

José.

> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, June 04, 2003 4:27 PM
> To: Ben Crane
> Cc: [EMAIL PROTECTED]
> Subject: RE: cgi LWP::Simple script and Apache
> 
> 
> > > So now my questions would be:
> > >   Can you open 216.239.51.100 in a browser?
> > www.google.com
> > >   Can you open 172.20.250.1 in a browser?
> > www.wokingham.gov.uk
> > 
> > Yes for both...I'm checking to see if the protocol is
> > okay as we have a firewall and that may be
> > interfering...
> 
> Perhaps the firewall, perhaps something is looking at the 
> UserAgent and not seeing IE or Mozilla says 'no site for you!'.
> 
> This may be something you want to ask the LWP mailing list about. 
> Not sure of their address but take a look at www.perl.org
> 
> Hope you get her figured out!
> 
> Dan
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: cgi LWP::Simple script and Apache: Thanx

2003-06-05 Thread Ben Crane
Dan,

Thanx a million for your help...It's given me more to
look at and figure out.

Hope I can return the favour sometime!

Regards
Ben

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: cgi LWP::Simple script and Apache

2003-06-05 Thread Bob Showalter
Dan Muey wrote:
> > > So now my questions would be:
> > >   Can you open 216.239.51.100 in a browser? www.google.com
> > >   Can you open 172.20.250.1 in a browser? www.wokingham.gov.uk
> > 
> > Yes for both...I'm checking to see if the protocol is
> > okay as we have a firewall and that may be
> > interfering...
> 
> Perhaps the firewall, perhaps something is looking at the
> UserAgent and not seeing IE or Mozilla says 'no site for you!'.

Are you using a proxy? If it works in the browser but not with LWP, you need
to check the browser for proxy settings and supply those to LWP.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Error

2003-06-05 Thread lobach
OK, for anyone who runs into this or for myself if this happens again...

I removed everything Perl and re-installed the ActiveState version
(ActivePerl-5.8.0.806-MSWin32-x86.msi)... got the exact same error... so I
removed everything again and installed an older version
(ActivePerl-5.8.0.804-MSWin32-x86.msi)... everything was hunky dory...
whew..

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Through much digging I found AddScrollbars was defined in Tk::Frame..
>
> #!perl -w
> # Pchopler.pl
> use strict;
> use Tk 800.000;
> # These are all the modules that we are using in this script.
> use Tk::Frame;
> use Tk::TextUndo;
> use Tk::Text;
> use Tk::Scrollbar;
> use Tk::Menu;
> use Tk::Menubutton;
> use Tk::Adjuster;
> use Tk::DialogBox;
> use Net::FTP;
>
> . . .
> #  this is where things are failing..
> #  from the debug frame:
> #Can't locate Tk/AddScrollbars.pm in @INC (@INC contains c:/Perl/lib
> C:/Perl/site/lib) at C:/Perl/lib/Tk/Widget.pm line 261.
>
#Tk::Widget::_AutoloadTkWidget('Tk::Frame=HASH(0x22f1734)','AddScrollbars')
> called at C:/Perl/llib/Tk/Widget.pm line 1118
>
#Tk::Widget::Scrolled('Tk::Frame=HASH(0x1d14000)','Text','-height',1,'-width
> ',1,'-scrollbars','osoe') called at pchopler.pl line 27
> # line 27 v
> my($OutputText) = $rf->Scrolled('Text',
> -height => '1',
> -width => '1',
> -scrollbars => 'osoe',
> );
>
>   my($PegText) = $rf->Scrolled('TextUndo',
>   -height => '1',
>   -width => '1',
>   -scrollbars => 'osoe',
>   );
>
> "Paul Kraus" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > No changes to the system? Perl upgrade? System reload? Anything at all
> > that you can remember?
> >
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Monday, June 02, 2003 9:39 AM
> > To: [EMAIL PROTECTED]
> > Subject: Error
> >
> >
> > Can't locate Tk/AddScrollbars.pm in @INC (@INC contains: C:/Perl/lib
> > C:/Perl/site/lib .) at C:/Perl/lib/Tk/Widget.pm line 261.
> >
> >
> >
> > I was using this perl script without problems, then all of the sudden I
> > am getting this error... I googled it and go nowhere.. any ideas?  I
> > tried to re-install TK from ActiveState (version 5.8)..
> >
> > From what I gather, Widget.pm calls the method AddScrollbars but there
> > is no associated pm to that method.. is there some dll or something else
> > that needs to load for this to work?
> >
> >
> >
> > Thanks, Steve.
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: cgi LWP::Simple script and Apache: Thanx

2003-06-05 Thread Dan Muey
> Dan,
> 
> Thanx a million for your help...It's given me more to
> look at and figure out.

No sweat, this list has helped me out a zillion times.

> 
> Hope I can return the favour sometime!

Cool.

> 
> Regards
> Ben

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Where is @INC saved and other installation issues

2003-06-05 Thread Michael Muratet
Greetings

I am trying to resolve a problem I had with the perl 5.8 that comes
bundled with RedHat 9.0. It absolutely would not parse a regex the way
it should, and so I downloaded a new tarball from CPAN and reloaded
perl. RedHat puts perl in /usr/lib/perl5 rather than
/usr/local/lib/perl5 and I let the installation use the default. RedHat
also has a lot of dependancies on libperl.so and other components so
it's not a simple matter to just change a path. 

Installing perl from the CPAN tarball left the system thinking that @INC
contains entries in the path /usr/local/lib/perl5. Reinstalling the rpm
for perl from RedHat did not change it back to /usr/lib/perl5. make
realclean in the build directory did not affect @INC. Nothing in the
environment variables looks like it, and I can't find anything in the
perl docs.

How do I get things _really_ clean? Where does @INC live? I'd like to
start over, keep the RedHat path, reload a new distribution over the top
of it if the perl still has regex problems, and get on with what I need
to do.

Thanks

Mike

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl - Web Development

2003-06-05 Thread Jenda Krynicky
From: Shlomi Fish <[EMAIL PROTECTED]>
> On Wed, 4 Jun 2003, Paul Kraus wrote:
> 
> > This may be asking for biased opinions but here goes anyways...
> >
> > Is perl still a good choice for the web.
> 
> Yes. Perl is a very good choice from all aspects.

Definitely. Wish the bosses would see that.
 
> > Or should I look at the newer technologies such as vb.net on for
> > that matter c#.
> >
> 
> I don't know too much about VB.Net C#, or ASP.Net so I cannot comment.
> I know ASP.Net has a problem in which you need to explicitly
> deallocate all the allocated resources, or else they'll leak.

Yeah I've been told some scary things about the garbage collector in 
.Net

On the other side, you may try Perl.NET ( 
http://www.activestate.com/Products/Perl_Dev_Kit/) and PerlASPX 
(http://www.activestate.com/Products/PerlASPX/)
 
> > I know perl and the idea of being able to use the same language in
> > everything I do would be great but am I going to take a hit on
> > performance. Can it be embedded into html? What is mason does that
> > run on IIS.
> 
> Mason can run on top of IIS by means of its CGI emulation. However,
> there's also Perl ASP, which is a native IIS technology. They are
> similar in spirit but Mason is more powerful.

Last time I looked the performance of ASP+PerlScript wasn't great. It 
was much better to run perl via PerlIS.DLL (inprocess interpreter of 
Perl for IIS, part of the free ActivePerl) or even PerlEx.
 
Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Fw: Where is @INC saved and other installation issues

2003-06-05 Thread Michael Muratet


> Begin forwarded message:
> 
> Date: Wed, 4 Jun 2003 11:20:44 -0500
> From: Michael Muratet <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Where is @INC saved and other installation issues
> 
> How do I get things _really_ clean? Where does @INC live? I'd like to
> start over, keep the RedHat path, reload a new distribution over the
> top of it if the perl still has regex problems, and get on with what I
> need to do.

I got something to work finally, although I don't know if it's the
correct solution.

@INC is apparently embedded in the perl binary. make realclean does not
delete the executable that it writes to /usr/local/bin. Replacing
/usr/local/bin/perl with a link to /usr/bin/perl fixes the problem. 

Mike

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Where is @INC saved and other installation issues

2003-06-05 Thread Peter Scott
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Michael Muratet) writes:
>Greetings
>
>I am trying to resolve a problem I had with the perl 5.8 that comes
>bundled with RedHat 9.0. It absolutely would not parse a regex the way
>it should, and so I downloaded a new tarball from CPAN and reloaded
>perl. 

Built it from source?  Then I would expect you to have been asked
a bunch of questions by Configure, including which directories to
install to.  Just change the default prefix from /usr/local to /usr
if you want to overwrite RH's perl.

If you were installing a binary, then try installing the source.
You should be able to zip through by saying

./Configure -de -Uprefix=/usr
make test
make install

-- 
Peter Scott
http://www.perldebugged.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Braindead this morning - unwanted

2003-06-05 Thread Harry Putnam
Probably painfully obvious...

Where is this preceding space coming from:

cat test_space.pl
^
#!/usr/local/bin/perl -w
open(FILE,">file");
@array = (
  "line 1\n",
  "line 2\n",
  "line 3\n",
  "\n",
 );

print FILE  "@array";
system("cat file");


(Run test_space.pl)

reader $ ./test_space.pl
line 1
 line 2
 line 3
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Braindead this morning - unwanted

2003-06-05 Thread James Edward Gray II
On Wednesday, June 4, 2003, at 11:17  AM, Harry Putnam wrote:

Where is this preceding space coming from:
print FILE  "@array";
It's coming from your interpolation of the array in a string 
("@array").  It joins them, adding a space between them by default.  
Try this:

print FILE join '', @array;

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Braindead this morning - unwanted

2003-06-05 Thread Bob Showalter
Harry Putnam wrote:
> Probably painfully obvious...
> 
> Where is this preceding space coming from:
> 
> cat test_space.pl
> ^
> #!/usr/local/bin/perl -w
> open(FILE,">file");
> @array = (
>   "line 1\n",
>   "line 2\n",
>   "line 3\n",
>   "\n",
>  );
> 
> print FILE  "@array";

Don't use the double quotes here. That's where the extra space is coming
from.

just use:

   print FILE @array;

see perldoc perlvar, search for the special variable $" (dollar-quote)

> system("cat file");
> 
> 
> (Run test_space.pl)
> 
> reader $ ./test_space.pl
> line 1
>  line 2
>  line 3


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Database connection (ODBC) not closing?

2003-06-05 Thread BK GOOD
I have the following code to create a record into 2 tables in my SQL
database.  The 2 tables are WorkRequest where WRID is the KEY/Unique
Identifier and File_details where FileID is the KEY/Unique Identifier but
has WRID as a KEY for linking to the Work Request table.

When I run this code, it will create the records with no problem.  However,
when I try to update the table in MS Access manually I get a WRITE CONFLICT
error.   It is acting like the database connection to that record is still
open. However, I can update it with an UPDATE QUERY with no problems.

I have tried rearranging the $db1->Close(); statements a hundred ways and
nothing seems to work.

Anyone have any ideas?  I have put the code below.
Thanks,
Kristi

$db1 = new Win32::ODBC("DSN=dmcprod;UID=nDMC45;PWD=nDMC65;");


$db1->Sql("INSERT INTO WorkRequest(DCA, Billing_Status, Create_Date, AccRep,
CC, BU_Group, ClientID, Customer_Name, ProjectID, WRType, IntorData,
ShipDate, Ext)  VALUES('NONE' , 'NONE', '$lstamp', 'person', 'people',
'SERVICES', '000', 'customer', ' ', 'Outbound', 'Dataset', '$sstamp',
'2')");


$db1->Sql("SELECT [EMAIL PROTECTED]@IDENTITY AS 'Identity'" );
$db1->FetchRow();
%db1hash = $db1->DataHash();
$wrnum = $db1hash{'Identity'};

$db1->Sql("INSERT INTO File_Details(WRID, FileName, MediaType,
Conversion_Type, PCOMMENTS, Output_Filename, Record_Count, Record_Length,
Additional_Info, Status) VALUES('$wrnum', 'SEE ADDITIONAL INFORMATION ',
'CDROM', 'LOAD FILE AS IS', 'Auto Create WR for CD', 'SAME', '0', '0',
'information' , 'CREATED' )");

$db1->Close();


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to print a string that uses variables and operators

2003-06-05 Thread deborah
How do you get Perl to print an operator as a string? I want to print a 
mathematical expression and then print the answer. I've tried every 
combination that I can think of, but the script keeps getting aborted 
"due to compilation errors" because "string found where operator 
expected." Well, yeah... I'm intending to turn the operator into a 
string. How do I get Perl to see it as a string?

Example: I want to print out " $hours +35 = 45."  The "45" would 
actually be derived from the following line: $hours += 35;

I'm using Perl 5.6 on a Mac OSX, which seems to be the same as any 
Linux system.

Thanks!

Deb

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Am i taking the right approach (i have to learn to code this!)

2003-06-05 Thread Angel Gabriel
As some of you know, I'm attempting to create an internal system to
automate some stuff. This is how I plan to do this...



#!/usr/local/bin/perl

include email reading modules
include grep modules (if exists, not found any yet)
include MySQL writing modules

read email from pop mail box
take email addresses from header or attachment, (maybe both)
add to MySql database
forward email to another pop account
delete email
end


i am hopping that all the steps that i hope to do, can actually be
achieved in perl.

if anyone knows of any gotchas that i might face, can someone say so?

TIA



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Braindead this morning - unwanted

2003-06-05 Thread Harry Putnam
James Edward Gray II <[EMAIL PROTECTED]> writes:

> On Wednesday, June 4, 2003, at 11:17  AM, Harry Putnam wrote:
>
>> Where is this preceding space coming from:
>> print FILE  "@array";
>
> It's coming from your interpolation of the array in a string
> ("@array").  It joins them, adding a space between them by default.
> Try this:
>
> print FILE join '', @array;

Thanks ... that was a mighty fast response.  And dead on too.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to print a string that uses variables and operators

2003-06-05 Thread deborah
Thank you! The separating comma was what I was leaving out. Also, I 
wanted to actually print the variable name, so I escaped the $ symbol.

Deb

On Wednesday, June 4, 2003, at 12:00 PM, James Edward Gray II wrote:

On Wednesday, June 4, 2003, at 11:47  AM, deborah wrote:

Example: I want to print out " $hours +35 = 45."  The "45" would 
actually be derived from the following line: $hours += 35;
There is nothing wrong with the string you posted.  Something like 
this would print it:

print "$hours + 35 = ", $hours + 35, ".\n";

If you're getting that far, post your code and I'll be happy to take a 
look.

I'm using Perl 5.6 on a Mac OSX, which seems to be the same as any 
Linux system.
"Good choice," I say, from on Mac OS X user to another.  ;)

James



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Am i taking the right approach (i have to learn to code this!)

2003-06-05 Thread Janek Schleicher
Angel Gabriel wrote at Wed, 04 Jun 2003 17:44:28 +0100:

> As some of you know, I'm attempting to create an internal system to
> automate some stuff. This is how I plan to do this...

Year, that's exactly the way, you should start.
It will be possible to translate your pseudo code nearly 1:1 to Perlish :-)

> 
> 
> #!/usr/local/bin/perl
> 
> include email reading modules

There are a lot of them on CPAN, depending what email system you are using
(mbox, pop, imap, whatever windows uses, ...) and what kind of interface
you prefer.

> include grep modules (if exists, not found any yet)

I'm not sure what you mean with that.
grep is a perl and a shell command with similar, but not exact the same
behaviour.
Perhaps it's better, when you clarify that point a bit better.

> include MySQL writing modules

Erm, the normal way is to use the generic database indepentend module
DBI
and a driver for MySQL, should be
DBD::mysql
(both on CPAN).

The documentation for them is very large and should already help you.

(If you plan simple database things,
 you might also have a look to the CPAN module
 DBIx::Simple
)

> read email from pop mail box

Simple with the right module (Net::POP3 could be one).

> take email addresses from header or attachment, (maybe both)

Taking from header is simple (I would suggest Mail::Header),
taking from attachment is a bit more difficult.
A bit more clarification could be helpful.

> add to MySql database

Easy with the DBI and DBD::mysql (alltough it's perhaps more an INSERT)

> forward email to another pop account

Also easy with the right module, I suggest e.g. Mail::Mailer (allthough,
there are many other ones)

> delete email

Done by Net::POP3 e.g.

> end

> i am hopping that all the steps that i hope to do, can actually be
> achieved in perl.
> 
> if anyone knows of any gotchas that i might face, can someone say so?


Good luck, you're on the right way to (camel) heaven.

If you get problems in the specific implementation, this group will be
there to help you.


Greetings,
Janek

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl - Web Development

2003-06-05 Thread Janek Schleicher
Paul Kraus wrote at Wed, 04 Jun 2003 09:49:10 -0400:

> This may be asking for biased opinions but here goes anyways...
> 
> Is perl still a good choice for the web. For instance I need to setup a
> couple sites that are going to be running on IIS. Is perl still a good
> choice for speed ect...

In addition to the others,
Perl's greatest benifitit is perhaps the
choice for speed of the (expensive) programmers.

Everything that can be done with Perl, can also be done with C, C#,
VB.net, ... (and if you are good than also quicker), but a good Perl
programmer will be much quicker than good C, good C#, good VB.net, ...
programmers. (The only exception, I see, is PHP, but that's not such
powerful than Perl is - but powerful enough for web applications)

If you are already familiar with Perl but not with PHP, you should choose
Perl, IMHO, reducing the extra work.


Greetings,
Janek

PS: And for big, specialised applications (e.g. shopping websites), there
are expensive, but convenient tools (like the one of Intershop).

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Am i taking the right approach (i have to learn to code this!)

2003-06-05 Thread Jenda Krynicky
From: Angel Gabriel <[EMAIL PROTECTED]>

> As some of you know, I'm attempting to create an internal system to
> automate some stuff. This is how I plan to do this...
> 
> 
> 
> #!/usr/local/bin/perl
> 
> include email reading modules

use Net::POP3;
#or
# use Mail::POP3Client;

> include grep modules (if exists, not found any yet)

use MIME::Parser;

> include MySQL writing modules

use DBI;
# and DBD::mysql

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Scalars and Strict

2003-06-05 Thread Jeff Westman
This may sound trivial, but I am trying to declare and assign multiple
scalars to the same variable in the same statement.  This is what I have:

 #!/bin/perl -w
 $a = $b = "apple";# works
 use strict;
 my ($a = $b) = "apple";   # does not works
 my $a = my $b = "apple";  # works .. but looks ugly

I'm trying to get away from using multiple "my"s in the same statement.  I
looked at FTP.pm, and for *lists* it's possible:
 my ($ftp, $dir, $recurse) = @_;

Is there something I am not seeing? 

Thanks

Jeff


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Help with OO and Tk::FileDialog

2003-06-05 Thread David Faler
I'm trying to figure out how to get a directory or text entry in Perl/Tk.  I 
am very new to this, but I can't figure out why this won't work.  It works 
maybe 1 time out of 10. The rest of the time I get this error:
Tk::Error: grab failed: window not viewable at 
/usr/lib/perl5/site_perl/5.8.0/Tk/FileDialog.pm line 986.
 Tk callback for grab
Tk::FileDialog::RescanFiles at
/usr/lib/perl5/site_perl/5.8.0/Tk/FileDialog.pm line 986
Tk::FileDialog::Show at /usr/lib/perl5/site_perl/5.8.0/Tk/FileDialog.pm
 line 654
main::get_dir at ./barfoo line 
main::__ANON__ at ./barfoo line 


Here is my poor code:


#!/usr/bin/perl -w
use strict;
use English;
use Tk;
use Tk::FileDialog;

my $main = MainWindow->new();
$main->title(" CardToDir");
$main->minsize( qw(250 250));

my $input_fr = $main->Frame()->pack(side => 'top');

my $src_fr = $input_fr->Frame()->pack(-side => 'top', -fill => 'x');
my $src_lbl = $src_fr->Label(-text => 'Enter Source Directory',
 )->pack(-side => 'left');
my $src_file = $src_fr->Button(-text => '...',
)->pack(-side => 'right',
-fill => 'x');
my $src_entry = $src_fr->Entry(-width => 40
  )->pack(-side => 'right');
$src_entry->insert('end' => '/home/user');

$src_file->bind('<1>' =>
sub {
  get_dir($src_entry);   # Called here
} );
$main->Button(-text => 'Quit',
  -command => sub{exit}
  )->pack(-side => 'bottom');
MainLoop();

sub get_dir {
  my $file = shift;
  my $selection ;
  my $DirDialog = $input_fr->FileDialog(-Title => 'Titlexxx',
  -Path => $file->get );
  $selection = $DirDialog->Show();   # Error Here
  $file->delete(0,'end');
  $file->insert('end' => $selection);
}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Scalars and Strict

2003-06-05 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Jeff Westman wrote:
> This may sound trivial, but I am trying to declare and assign multiple
> scalars to the same variable in the same statement.  This is what I
> have: 
> 
>  #!/bin/perl -w
>  $a = $b = "apple";# works
>  use strict;
>  my ($a = $b) = "apple";   # does not works
do:
my ($a,$b) = ("apple", "apple");

Wags ;)

>  my $a = my $b = "apple";  # works .. but looks ugly
> 
> I'm trying to get away from using multiple "my"s in the same
> statement.  I looked at FTP.pm, and for *lists* it's possible:
>  my ($ftp, $dir, $recurse) = @_;
> 
> Is there something I am not seeing?
> 
> Thanks
> 
> Jeff
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com



**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tr///

2003-06-05 Thread zentara
On Wed, 04 Jun 2003 10:55:40 +1000, [EMAIL PROTECTED] (Paul
Morris) wrote:

>I found this at:
>
>http://www.suse.com/us/private/support/howto/secprog/secprog8.html
>
>...but am having difficulty working it out, because it doesn't seem to 
>do what I think it should (and "I" may be the problem!).
>
>To quote:
>
>The best solution is to select a filter for Perl, just like for shell, 
>which only accepts authorized characters.
>
>unless($userinput =~ tr/[EMAIL PROTECTED]//)
>{
> print "Nice try, pal!\n";
> exit(1);
>}

While playing around with this, I noticed that tr won't
convert to nothing. Maybe that should be a space?
Or probably they meant s instead of tr?

Anyways, I came up with this to do what they intended?
##
#!/usr/bin/perl
use strict;

foreach my $inputString (){
  chomp $inputString;
  print "$inputString-> ";
  $inputString =~ s/[EMAIL PROTECTED]//g;  
print "$inputString-> ";
 if((length $inputString) == 0){print "GOOD\n"}else{print "BAD\n"}
}  
__DATA__
!#$%^**()
[EMAIL PROTECTED]
#gh#$HJ99
Abc99dEgg
#

As far as tr goes, substitute this line in the above script,
and run it translating to //  versus / /.  It refuses to translate to
//.

$inputString =~ tr/[EMAIL PROTECTED]//;  #won't work
$inputString =~ tr/[EMAIL PROTECTED]/ /;  #works









-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Scalars and Strict

2003-06-05 Thread George Schlossnagle
On Wednesday, June 4, 2003, at 02:40  PM, Wagner, David --- Senior 
Programmer Analyst --- WGO wrote:

Jeff Westman wrote:
This may sound trivial, but I am trying to declare and assign multiple
scalars to the same variable in the same statement.  This is what I
have:
 #!/bin/perl -w
 $a = $b = "apple";# works
 use strict;
 my ($a = $b) = "apple";   # does not works
do:
my ($a,$b) = ("apple", "apple");
or

my ($a, $b) = ("apple")x2;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Scalars and Strict

2003-06-05 Thread Stuart White
Would declaring all your variables with one my
suffice?  then your first line before use strict;
should work.  Like this:

my ($a, $b);
$a = $b = 'apple';


--- Jeff Westman <[EMAIL PROTECTED]> wrote:
> This may sound trivial, but I am trying to declare
> and assign multiple
> scalars to the same variable in the same statement. 
> This is what I have:
> 
>  #!/bin/perl -w
>  $a = $b = "apple";# works
>  use strict;
>  my ($a = $b) = "apple";   # does not works
>  my $a = my $b = "apple";  # works .. but looks ugly
> 
> I'm trying to get away from using multiple "my"s in
> the same statement.  I
> looked at FTP.pm, and for *lists* it's possible:
>  my ($ftp, $dir, $recurse) = @_;
> 
> Is there something I am not seeing? 
> 
> Thanks
> 
> Jeff
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to
> Outlook(TM).
> http://calendar.yahoo.com
> 
> -- 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Scalars and Strict

2003-06-05 Thread Jeff Westman
yeah, that works, but I was trying to do it in one statement as a scalar
assigment.

Thanks

JW

--- Stuart White <[EMAIL PROTECTED]> wrote:
> Would declaring all your variables with one my
> suffice?  then your first line before use strict;
> should work.  Like this:
> 
> my ($a, $b);
> $a = $b = 'apple';
> 
> 
> --- Jeff Westman <[EMAIL PROTECTED]> wrote:
> > This may sound trivial, but I am trying to declare
> > and assign multiple
> > scalars to the same variable in the same statement. 
> > This is what I have:
> > 
> >  #!/bin/perl -w
> >  $a = $b = "apple";# works
> >  use strict;
> >  my ($a = $b) = "apple";   # does not works
> >  my $a = my $b = "apple";  # works .. but looks ugly
> > 
> > I'm trying to get away from using multiple "my"s in
> > the same statement.  I
> > looked at FTP.pm, and for *lists* it's possible:
> >  my ($ftp, $dir, $recurse) = @_;
> > 
> > Is there something I am not seeing? 
> > 
> > Thanks
> > 
> > Jeff
> > 
> > 
> > __
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync to
> > Outlook(TM).
> > http://calendar.yahoo.com
> > 
> > -- 
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Scalars and Strict

2003-06-05 Thread Jeff Westman
I like this solution! Cool

Thanks George and David.


JW


--- George Schlossnagle <[EMAIL PROTECTED]> wrote:
> 
> On Wednesday, June 4, 2003, at 02:40  PM, Wagner, David --- Senior 
> Programmer Analyst --- WGO wrote:
> 
> > Jeff Westman wrote:
> >> This may sound trivial, but I am trying to declare and assign multiple
> >> scalars to the same variable in the same statement.  This is what I
> >> have:
> >>
> >>  #!/bin/perl -w
> >>  $a = $b = "apple";# works
> >>  use strict;
> >>  my ($a = $b) = "apple";   # does not works
> > do:
> > my ($a,$b) = ("apple", "apple");
> 
> or
> 
> my ($a, $b) = ("apple")x2;
> 


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tr///

2003-06-05 Thread John W. Krahn
Zentara wrote:
> 
> On Wed, 04 Jun 2003 10:55:40 +1000, [EMAIL PROTECTED] (Paul
> Morris) wrote:
> 
> >I found this at:
> >
> >http://www.suse.com/us/private/support/howto/secprog/secprog8.html
> >
> >...but am having difficulty working it out, because it doesn't seem to
> >do what I think it should (and "I" may be the problem!).
> >
> >To quote:
> >
> >The best solution is to select a filter for Perl, just like for shell,
> >which only accepts authorized characters.
> >
> >unless($userinput =~ tr/[EMAIL PROTECTED]//)
> >{
> > print "Nice try, pal!\n";
> > exit(1);
> >}
> 
> While playing around with this, I noticed that tr won't
> convert to nothing. Maybe that should be a space?

In this context it is not being used to convert characters, it is being
used to count characters.


> Or probably they meant s instead of tr?
> 
> Anyways, I came up with this to do what they intended?
> ##
> #!/usr/bin/perl
> use strict;
> 
> foreach my $inputString (){
>   chomp $inputString;
>   print "$inputString-> ";
>   $inputString =~ s/[EMAIL PROTECTED]//g;

That doesn't match the same characters as tr/[EMAIL PROTECTED]// does.  '['
and ']' define a character class in s/// and m// but in tr/// they just
match the characters '[' and ']'.  The person that wrote the referenced
web site probably had the same misunderstanding.


> print "$inputString-> ";
>  if((length $inputString) == 0){print "GOOD\n"}else{print "BAD\n"}
> }
> __DATA__
> !#$%^**()
> [EMAIL PROTECTED]
> #gh#$HJ99
> Abc99dEgg
> #
> 
> As far as tr goes, substitute this line in the above script,
> and run it translating to //  versus / /.  It refuses to translate to
> //.
> 
> $inputString =~ tr/[EMAIL PROTECTED]//;  #won't work
> $inputString =~ tr/[EMAIL PROTECTED]/ /;  #works

If you want to delete characters with tr/// then use the /d option.

$inputString =~ tr/a-zA-Z0-9@//d;


perldoc perlop


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Scalars and Strict

2003-06-05 Thread royce . wells
try

 my ($a,$b)=("apples","apples");

In the other example it was pulling values from an array of scalars.

In your example you are only providing 1 scalar for 2 scalar variables to
share.

Royce



"The right word may be effective, but no word was ever as effective as a
rightly timed pause."
   --Mark Twain



   
  
  Jeff Westman 
  
  <[EMAIL PROTECTED]To:   beginners <[EMAIL 
PROTECTED]>  
  om>  cc: 
  
   Subject:  Scalars and Strict
  
  06/04/2003 01:36 
  
  PM   
  
   
  
   
  




This may sound trivial, but I am trying to declare and assign multiple
scalars to the same variable in the same statement.  This is what I have:

 #!/bin/perl -w
 $a = $b = "apple";# works
 use strict;
 my ($a = $b) = "apple";   # does not works
 my $a = my $b = "apple";  # works .. but looks ugly

I'm trying to get away from using multiple "my"s in the same statement.  I
looked at FTP.pm, and for *lists* it's possible:
 my ($ftp, $dir, $recurse) = @_;

Is there something I am not seeing?

Thanks

Jeff


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Scalars and Strict

2003-06-05 Thread Rob Dixon
Jeff Westman wrote:
> --- George Schlossnagle <[EMAIL PROTECTED]> wrote:
> >
> > On Wednesday, June 4, 2003, at 02:40  PM, Wagner, David --- Senior
> > Programmer Analyst --- WGO wrote:
> >
> > > Jeff Westman wrote:
> > > > This may sound trivial, but I am trying to declare and assign
> > > > multiple scalars to the same variable in the same statement.
> > > > This is what I have:
> > > >
> > > >  #!/bin/perl -w
> > > >  $a = $b = "apple";# works
> > > >  use strict;
> > > >  my ($a = $b) = "apple";   # does not works
> > > do:
> > > my ($a,$b) = ("apple", "apple");
> >
> > or
> >
> > my ($a, $b) = ("apple")x2;
> >
>
> I like this solution! Cool
>
> Thanks George and David.

I presume this was an exercise, as I don't see any reason to
confine youself to your rules otherwise.

I think both replies were a little tongue-in-cheek, but I
don't like either very much. The first one relies on manually
programming the same assigned value twice, and the second one
needs you to count the number of variables. These are both
things that the language should be doing for you. Much more
Perlish is

  $_ = 'apple' foreach my ($x, $y)

but it's still a rather odd thing to code!

Oh, and I'm surpised nobody's jumped in yet to say that
you shouldn't be using $a and $b anyway. They are
variables that are used implicitly by 'sort' and are
automatically predeclared as package variables for you.
For this reason they're not picked up by 'use strict "vars"'
so they are best avoided.

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Regular expressions

2003-06-05 Thread zentara
On Tue, 3 Jun 2003 22:38:47 -0700 (PDT), [EMAIL PROTECTED]
(Saurabh Singhvi) wrote:

>well i was trying to understand the "regular
>expressions" in perl when i came across  i
>tried my best but i havent been able to get the
>slightest idea on how the input thing works. The
>editor i use is DzSoft. And it shows something like
>"get" and something else below like script something
>with blank space. 
>
>Any  hopes 4 me?? :-(
>Well i hope for me anyways ;)
>Help please
>Thanks in advamce :)

All programs have 3 default input-output filehandles,
they are STDIN, STDOUT, and STDERR. For Standard
Input, Standard Output, and Standard Error.

They default to: 
STDIN -> keyboard input
STDOUT -> your screen
STDERR -> your screen

They are used so often, that alot of short-cuts have
evolved, so you don't always have to write them out.

Run this and watch what it does.

#!/usr/bin/perl
while(<>){print}

without the shortcuts, it would look like this:
while(){print STDOUT}




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Scalars and Strict

2003-06-05 Thread Jeff Westman
Hi Rob,

--- Rob Dixon <[EMAIL PROTECTED]> wrote:
> Jeff Westman wrote:
> > --- George Schlossnagle <[EMAIL PROTECTED]> wrote:
> > >
> > > On Wednesday, June 4, 2003, at 02:40  PM, Wagner, David --- Senior
> > > Programmer Analyst --- WGO wrote:
> > >
> > > > Jeff Westman wrote:
> > > > > This may sound trivial, but I am trying to declare and assign
> > > > > multiple scalars to the same variable in the same statement.
> > > > > This is what I have:
> > > > >
> > > > >  #!/bin/perl -w
> > > > >  $a = $b = "apple";# works
> > > > >  use strict;
> > > > >  my ($a = $b) = "apple";   # does not works
> > > > do:
> > > > my ($a,$b) = ("apple", "apple");
> > >
> > > or
> > >
> > > my ($a, $b) = ("apple")x2;
> > >
> >
> > I like this solution! Cool
> >
> > Thanks George and David.
> 
> I presume this was an exercise, as I don't see any reason to
> confine youself to your rules otherwise.

This was a totally trivial example of a real world script I am writing.
 
> I think both replies were a little tongue-in-cheek, but I
> don't like either very much. The first one relies on manually
> programming the same assigned value twice, and the second one
> needs you to count the number of variables. These are both
> things that the language should be doing for you. Much more
> Perlish is
> 
>   $_ = 'apple' foreach my ($x, $y)

I'm using a fixed number of arguments (2) so this seems to be not only harder
to read, but overkill for a simple list.

> but it's still a rather odd thing to code!

It may be more perlish, but I will always have two arguments, so I'm not
really "counting" as it were.  I am using it basically to assign a login ID
and a passwd (which unfortunately, are the same, ie, for security sake).
 
> Oh, and I'm surpised nobody's jumped in yet to say that
> you shouldn't be using $a and $b anyway. They are
> variables that are used implicitly by 'sort' and are
> automatically predeclared as package variables for you.
> For this reason they're not picked up by 'use strict "vars"'
> so they are best avoided.

Okay, it was a bad example, and I am well aware of $a and $b.  As noted, it
was a totally trivial example.  Thanks for the advice though.

> Cheers,
> 
> Rob

JW

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Modify links

2003-06-05 Thread Dan Muey
I'm trying to work out a regex that will do this:

Take an entire page's html: my $html_code; # all lines in thes one variable

And make any href's that are relative absolute by prepending $url into them:
$url = "http://myclonesite.com";;
make  into http://myclonesite.com/documents/help.html";>
$html_code =~ s/href\=\"\.?\/?(.*)\"/href\=\"$url\/"/ig;
the rpobolem with this is it prepends $url to absolute url's also

I need to say :
Put $url in front of relative urls (make ./foo /foo or foo $url/foo and ../foo would 
have to be treated differently, ignored for now) in href if href does not start with 
https?://

Any ideas?

TIA
Dan


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Modify links

2003-06-05 Thread Hanson, Rob
Try using URI to figure out the absolute URL.

use URI;

# the base is the *current absolute page*
my $base_url = 'http://foo.com/documents/help.html';

print URI->new_abs('doc1.html', $base_url), "\n";
print URI->new_abs('./doc2.html', $base_url), "\n";
print URI->new_abs('../documents/doc3.html', $base_url), "\n";
print URI->new_abs('http://somewhere.com/', $base_url), "\n";

<<< SCRIPT OUTPUT >>>
http://foo.com/documents/doc1.html
http://foo.com/documents/doc2.html
http://foo.com/documents/doc3.html
http://somewhere.com/

So your regex *might* look like this (untested)...

my $base = 'http://foo.com/documents/help.html';
$html_code =~ s/href="(.*?)"/'href="' . URI->new_abs($1, $base) . '"'/seg;

Rob


-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 3:26 PM
To: [EMAIL PROTECTED]
Subject: Modify links


I'm trying to work out a regex that will do this:

Take an entire page's html: my $html_code; # all lines in thes one variable

And make any href's that are relative absolute by prepending $url into them:
$url = "http://myclonesite.com";;
make  into http://myclonesite.com/documents/help.html";>
$html_code =~ s/href\=\"\.?\/?(.*)\"/href\=\"$url\/"/ig;
the rpobolem with this is it prepends $url to absolute url's also

I need to say :
Put $url in front of relative urls (make ./foo /foo or foo $url/foo and
../foo would have to be treated differently, ignored for now) in href if
href does not start with https?://

Any ideas?

TIA
Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Regular expressions

2003-06-05 Thread John W. Krahn
Zentara wrote:
> 
> On Tue, 3 Jun 2003 22:38:47 -0700 (PDT), [EMAIL PROTECTED]
> (Saurabh Singhvi) wrote:
> 
> >well i was trying to understand the "regular
> >expressions" in perl when i came across  i
> >tried my best but i havent been able to get the
> >slightest idea on how the input thing works. The
> >editor i use is DzSoft. And it shows something like
> >"get" and something else below like script something
> >with blank space.
> >
> >Any  hopes 4 me?? :-(
> >Well i hope for me anyways ;)
> >Help please
> >Thanks in advamce :)
> 
> All programs have 3 default input-output filehandles,
^
5

> they are STDIN, STDOUT, and STDERR.

ARGV, ARGVOUT

> For Standard Input, Standard Output, and Standard Error.
> 
> They default to:
> STDIN -> keyboard input
> STDOUT -> your screen
> STDERR -> your screen
> 
> They are used so often, that alot of short-cuts have
> evolved, so you don't always have to write them out.
> 
> Run this and watch what it does.
> 
> #!/usr/bin/perl
> while(<>){print}
> 
> without the shortcuts, it would look like this:
> while(){print STDOUT}

<> is not exactly the same as  it is closer to .

perldoc perlsyn
perldoc perlvar



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Warnings/strict still needed?

2003-06-05 Thread Michael Weber
Just wondering.

After I debug my perl scripts do I still need the strict and warnings
flags?

Does it hurt performance having them?

Does it hurt security removing them?

The scripts are for system admin only, not CGI where I would assume
they should be left in.

Thanx!

-Michael

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Regular expressions

2003-06-05 Thread John W. Krahn
"John W. Krahn" wrote:
> 
> Zentara wrote:
> >
> > All programs have 3 default input-output filehandles,
> ^
> 5
> 
> > they are STDIN, STDOUT, and STDERR.
> 
> ARGV, ARGVOUT

Or eight if you include stdin, stdout and stderr.

:-)

John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Warnings/strict still needed?

2003-06-05 Thread John W. Krahn
Michael Weber wrote:
> 
> Just wondering.
> 
> After I debug my perl scripts do I still need the strict and warnings
> flags?

No.

> Does it hurt performance having them?

No.

> Does it hurt security removing them?

No.

> The scripts are for system admin only, not CGI where I would assume
> they should be left in.

Having strictures and warnings enabled does not guarantee that the code
will be correct or robust or secure.  They are only provided to help you
find obvious mistakes.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Modify links

2003-06-05 Thread Dan Muey
That did the trcik! Nice and clean, thanks Rob

> -Original Message-
> From: Hanson, Rob [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, June 04, 2003 2:55 PM
> To: Dan Muey; [EMAIL PROTECTED]
> Subject: RE: Modify links
> 
> 
> Try using URI to figure out the absolute URL.
> 
> use URI;
> 
> # the base is the *current absolute page*
> my $base_url = 'http://foo.com/documents/help.html';
> 
> print URI->new_abs('doc1.html', $base_url), "\n";
> print URI->new_abs('./doc2.html', $base_url), "\n";
> print URI->new_abs('../documents/doc3.html', $base_url), 
> "\n"; print URI->new_abs('http://somewhere.com/', $base_url), "\n";
> 
> <<< SCRIPT OUTPUT >>>
> http://foo.com/documents/doc1.html
> http://foo.com/documents/doc2.html
> http://foo.com/documents/doc3.html
> http://somewhere.com/
> 
> So your regex *might* look like this (untested)...
> 
> my $base = 'http://foo.com/documents/help.html';
> $html_code =~ s/href="(.*?)"/'href="' . URI->new_abs($1, 
> $base) . '"'/seg;
> 
> Rob
> 
> 
> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 04, 2003 3:26 PM
> To: [EMAIL PROTECTED]
> Subject: Modify links
> 
> 
> I'm trying to work out a regex that will do this:
> 
> Take an entire page's html: my $html_code; # all lines in 
> thes one variable
> 
> And make any href's that are relative absolute by prepending 
> $url into them:
>   $url = "http://myclonesite.com";;
>   make  into  href="http://myclonesite.com/documents/help.html";>
>   $html_code =~ s/href\=\"\.?\/?(.*)\"/href\=\"$url\/"/ig;
>   the rpobolem with this is it prepends $url to absolute 
> url's also
> 
> I need to say :
> Put $url in front of relative urls (make ./foo /foo or foo 
> $url/foo and ../foo would have to be treated differently, 
> ignored for now) in href if href does not start with https?://
> 
> Any ideas?
> 
> TIA
> Dan
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Warnings/strict still needed?

2003-06-05 Thread James Edward Gray II
On Wednesday, June 4, 2003, at 03:45  PM, John W. Krahn wrote:

Does it hurt performance having them?
No.
Are we sure about this?  I find it really hard to believe that 
'warnings' isn't affecting performance on some level.  I doubt it's a 
big hit, but I would be very surprised if it doesn't cost something.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Warnings/strict still needed?

2003-06-05 Thread John W. Krahn
James Edward Gray II wrote:
> 
> On Wednesday, June 4, 2003, at 03:45  PM, John W. Krahn wrote:
> 
> >> Does it hurt performance having them?
> >
> > No.
> 
> Are we sure about this?  I find it really hard to believe that
> 'warnings' isn't affecting performance on some level.  I doubt it's a
> big hit, but I would be very surprised if it doesn't cost something.

Well, you could always use the Benchmark module to test your theory.

:-)

John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Warnings/strict still needed?

2003-06-05 Thread Paul Johnson
On Wed, Jun 04, 2003 at 03:58:44PM -0500, James Edward Gray II wrote:
> On Wednesday, June 4, 2003, at 03:45  PM, John W. Krahn wrote:
> 
> >>Does it hurt performance having them?
> >
> >No.
> 
> Are we sure about this?  I find it really hard to believe that 
> 'warnings' isn't affecting performance on some level.  I doubt it's a 
> big hit, but I would be very surprised if it doesn't cost something.

Yep, there's a tiny hit.  I would expect the number of applications
where it is significant to be vanishingly small.  Perl, the program, is
lovingly crafted to ensure that turning on warnings does not cause a
performance problem.

Try it and see.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Appending to beginning of file?

2003-06-05 Thread Josh Berkus
Folks,

Hit there!  I just joined the list.  Amazing what one can do with rudimentary 
web-browsing skills.

Is there any easy way to append a line or lines to the *beginning* of a text 
file?  I've been through the Llama and Camel books, and the perldoc for Open, 
and I can't seem to find an easy way to do this.

Pointers to online docs are fine with me.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Appending to beginning of file?

2003-06-05 Thread Beau E. Cox

- Original Message - 
From: "Josh Berkus" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 04, 2003 11:17 AM
Subject: Appending to beginning of file?


Folks,

Hit there!  I just joined the list.  Amazing what one can do with
rudimentary
web-browsing skills.

Is there any easy way to append a line or lines to the *beginning* of a text
file?  I've been through the Llama and Camel books, and the perldoc for
Open,
and I can't seem to find an easy way to do this.

Pointers to online docs are fine with me.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco

No, there is no way. You must write your prepended lines to a
new file and then append your old file, and, delste ( or
rename to a backup) your old file, and rename your new file back to the old
file. All easy to do with Perl.

Aloha => Beau;



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Appending to beginning of file?

2003-06-05 Thread John W. Krahn
Josh Berkus wrote:
> 
> Folks,

Hello,

> Hit there!  I just joined the list.  Amazing what one can do with rudimentary
> web-browsing skills.
> 
> Is there any easy way to append a line or lines to the *beginning* of a text
> file?  I've been through the Llama and Camel books, and the perldoc for Open,
> and I can't seem to find an easy way to do this.
> 
> Pointers to online docs are fine with me.

This is a Frequently Asked Question and the answer can be found in
Perl's FAQs.

perldoc -q "beginning of a file"


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Appending to beginning of file?

2003-06-05 Thread Josh Berkus
John, Beau,

> This is a Frequently Asked Question and the answer can be found in
> Perl's FAQs.
> 
> perldoc -q "beginning of a file"

Thanks!   The perldoc -q  technique is really good to know about.

Looks like I'd be able to do this if I was using 5.80, but I'm not :-(

So I'll just transfer the file from one to another.

Thanks again.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Appending to beginning of file?

2003-06-05 Thread James Edward Gray II
On Wednesday, June 4, 2003, at 04:43  PM, Josh Berkus wrote:

Looks like I'd be able to do this if I was using 5.80, but I'm not :-(
Tie::File can be retrieved off of the CPAN for earlier versions of Perl 
where is wasn't standard, if you can install modules.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Appending to beginning of file?

2003-06-05 Thread Josh Berkus
James,

> Tie::File can be retrieved off of the CPAN for earlier versions of Perl 
> where is wasn't standard, if you can install modules.

Yeah.  Sadly, it's a vendor system :-(  I can't install anything.

Happily, copying file content is very fast, even with 40,727 lines in the 
file!

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Scalars and Strict

2003-06-05 Thread Rob Dixon
Jeff Westman wrote:
> Hi Rob,
>
> --- Rob Dixon <[EMAIL PROTECTED]> wrote:
> > Jeff Westman wrote:
> > > --- George Schlossnagle <[EMAIL PROTECTED]> wrote:
> > > >
> > > > On Wednesday, June 4, 2003, at 02:40  PM, Wagner, David ---
> > > > Senior Programmer Analyst --- WGO wrote:
> > > >
> > > > > Jeff Westman wrote:
> > > > > > This may sound trivial, but I am trying to declare and
> > > > > > assign multiple scalars to the same variable in the same
> > > > > > statement.
> > > > > > This is what I have:
> > > > > >
> > > > > >  #!/bin/perl -w
> > > > > >  $a = $b = "apple";# works
> > > > > >  use strict;
> > > > > >  my ($a = $b) = "apple";   # does not works
> > > > > do:
> > > > > my ($a,$b) = ("apple", "apple");
> > > >
> > > > or
> > > >
> > > > my ($a, $b) = ("apple")x2;
> > > >
> > >
> > > I like this solution! Cool
> > >
> > > Thanks George and David.
> >
> > I presume this was an exercise, as I don't see any reason to
> > confine youself to your rules otherwise.
>
> This was a totally trivial example of a real world script I am
> writing.
>
> > I think both replies were a little tongue-in-cheek, but I
> > don't like either very much. The first one relies on manually
> > programming the same assigned value twice, and the second one
> > needs you to count the number of variables. These are both
> > things that the language should be doing for you. Much more
> > Perlish is
> >
> >   $_ = 'apple' foreach my ($x, $y)
>
> I'm using a fixed number of arguments (2) so this seems to be not
> only harder to read, but overkill for a simple list.
>
> > but it's still a rather odd thing to code!
>
> It may be more perlish, but I will always have two arguments, so
> I'm not really "counting" as it were.  I am using it basically to
> assign a login ID and a passwd (which unfortunately, are the same,
> ie, for security sake).
>
> > Oh, and I'm surpised nobody's jumped in yet to say that
> > you shouldn't be using $a and $b anyway. They are
> > variables that are used implicitly by 'sort' and are
> > automatically predeclared as package variables for you.
> > For this reason they're not picked up by 'use strict "vars"'
> > so they are best avoided.
>
> Okay, it was a bad example, and I am well aware of $a and $b.  As
> noted, it was a totally trivial example.  Thanks for the advice
> though.

Then what you want is:

  my ($user, $pass) = qw/robdixon secret/;

:)

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Warnings/strict still needed?

2003-06-05 Thread Tassilo von Parseval
On Wed, Jun 04, 2003 at 03:58:44PM -0500 James Edward Gray II wrote:
> On Wednesday, June 4, 2003, at 03:45  PM, John W. Krahn wrote:
> 
> >>Does it hurt performance having them?
> >
> >No.
> 
> Are we sure about this?  I find it really hard to believe that 
> 'warnings' isn't affecting performance on some level.  I doubt it's a 
> big hit, but I would be very surprised if it doesn't cost something.

Perl internally uses a bit-mask to determine when to warn (stored in
${^WARNINGS_BITS}). When interpreting a script perl has to check against
this bitmask regardless of whether warnings are turned on or not,
therefore there's no change in run-time performance.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]