Multipart Documents
I want to create a HTML document that i can output the results of, and also provide the file in XML format (i.e. not pretty printed in XML, just data). Ideally I want the web page to display and then the user to get a (download product) dialog box to save the XML file. I'm pretty sure that's possible using a multipart/mixed (server push) document, but I can't find any tutorials on how to do it (preferably using CGI.pm). Can anyone either explain it or point me to a good resource? Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: can i do it with perl ?
On Fri, 2004-01-23 at 20:49, John McKown wrote: On Fri, 23 Jan 2004, Dan Anderson wrote: Give me a little bit of time with a soldering iron, some wire, and a laptop connected to your home network and your dishwasher and that can be rectified. :-D -Dan I don't think that the lady who comes in and does my dishes is going to let you anywhere near her with a soldering iron in your hand! grin We are borg. You will be assimilated. Resistance is futile. grin -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: binary perl
On Fri, 2004-01-23 at 20:44, Dan Brow wrote: Is it possible to make a perl script/program a binary file? There is an experimental perl compiler. It's not recommended for production use but is a cool toy. When Perl 6 comes out that will all change though... -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: can i do it with perl ?
On Fri, 2004-01-23 at 18:07, wolf blaum wrote: I there, Hi, I need to write a web database application using perl, and i need a way that when the users logs into the system i download all the information regarding to the user to its local computer and make all the transaction locally. After that, when the user logs out of the system all the information and transaction that were made by that user are then updated to the database server. Can i do it with perl ?, which modules ?, thanks. Why does it have to be a web application? Or rather just a client/server thing? What Database? I didnt find a way to do the dishes yet, anything else I ever tried works in perl. Give me a little bit of time with a soldering iron, some wire, and a laptop connected to your home network and your dishwasher and that can be rectified. :-D -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Calling SUPER::constructor in the constructor
Is it possible to call the constructor that a function inherits from its parent? I tried calling SUPER:: and SUPER- in a constructor and got errors. Am i correct in assuming that if I rewrite the constructor that a copy of the parent object won't be available? Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Survey : Max size allowable for slurping files
On Thu, 2004-01-22 at 13:18, Dan Muey wrote: There are always comments like you can slurp the file as long as it's not too big or becareful not to slurp a really big file or you'll be in trouble. I'd like to add that some of it depends on swap space. I've slurped well past physical memory and most of it went to swap. Although the script was significantly lower it still ran. However, if you get to a certain point your machine -- no matter what OS you are running -- will crash and burn. Of course, this is *if* you can get to that level. Users of *BSD systems with limit installed know that if your process eats too much memory IT will die and not the system. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Newbie
On Thu, 2004-01-22 at 14:13, Joo Figueira wrote: Well, I'm a newbie. Just got started in Perl and was stunned by its power. The thing is i'm running the scripts in WinXP. Can you tell how to use CGI scripts in XP, because if ai try to set a CGI script as ACTION in a forme it just gets read and doesn't execute. I've heard about the bat wrapping, but i really wanted to use the scripts as they are. Are you using Apache or IIS? Dump IIS for apache if you're using it. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Is it necessary to set the headers when using LWP::UserAgent-post
I noticed in the POD for LWP::UserAgent that the post method doesn't have an option to add headers. Are headers (like UserAgent:) not needed for POSTing? Or am I missing how to do it? Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Survey : Max size allowable for slurping files
On Thu, 2004-01-22 at 16:16, Dan Muey wrote: On Thu, 2004-01-22 at 13:18, Dan Muey wrote: There are always comments like you can slurp the file as long as it's not too big or becareful not to slurp a really big file or you'll be in trouble. I'd like to add that some of it depends on swap space. I've slurped well past physical memory and most of it went to swap. Although the script was significantly lower it still ran. However, if you get to a certain point your machine -- no matter what OS you are running -- will crash and burn. Of course, this is *if* you can get to that level. Users of *BSD systems with limit installed know that if your process eats too much memory IT will die and not the system. Good info Dan, I'm surprised more folks aren't adding their .02 since it seems (to me anyway) like people are just as religious about slurping as they are strict and warnings. I think a lot of it is a problem of how exactly to answer. There will always be situations where slurping is a great idea and situations where slurping is a horrible idea. I wish it were possible to give a better example like, Use formula _ to calculate whether or not you can slurp safely. But there are just too many variables that change from computer to computer and program to program then to say anything besides: If you slurp watch the resources your program is using and kill it off before it DOSes your computer. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Survey : Max size allowable for slurping files
On Thu, 2004-01-22 at 16:32, Dan Muey wrote: On Thu, 2004-01-22 at 16:16, Dan Muey wrote: On Thu, 2004-01-22 at 13:18, Dan Muey wrote: There are always comments like you can slurp the file as long as it's not too big or becareful not to slurp a really big file or you'll be in trouble. I'd like to add that some of it depends on swap space. I've slurped well past physical memory and most of it went to swap. Although the script was significantly lower it still ran. However, if you get to a certain point your machine -- no matter what OS you are running -- will crash and burn. Of course, this is *if* you can get to that level. Users of *BSD systems with limit installed know that if your process eats too much memory IT will die and not the system. Good info Dan, I'm surprised more folks aren't adding their .02 since it seems (to me anyway) like people are just as religious about slurping as they are strict and warnings. I think a lot of it is a problem of how exactly to answer. There will always be situations where slurping is a great idea and situations where slurping is a horrible idea. I wish it were possible to give a better example like, Use formula _ to calculate whether or not you can slurp safely. But there are just too many variables that change from computer to computer and program to program then to say anything besides: If you slurp watch the resources your program is using and kill it off before it DOSes your computer. Yeah it's tough because it is so vague, that's what I was hoping to clarify. It's easy to say use strict because But I see a lot of don't slurp that and I was hoping for more clear reasons/situatuions to or not to slurp so people positn code can have a better idea why a perosn said: do(n't) slurp your file here Basically we need to expalin why more: - Don't slurp this because it's STDIN and it may be huge, so huge in fact it could overload your system. - If this is an html file you'd probably be safe slurping it up to ease it's processing. I think it's like using a no warnings or no strict pragma to do some dangerous things because you know what you're doing. It's there for people when they get advanced enough to need it, but it's not a good idea to encourage its use on a beginners list. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Survey : Max size allowable for slurping files
On Thu, 2004-01-22 at 16:49, Dan Muey wrote: But I see a lot of don't slurp that and I was hoping for more clear reasons/situatuions to or not to slurp so people positn code can have a better idea why a perosn said: do(n't) slurp your file here Basically we need to expalin why more: - Don't slurp this because it's STDIN and it may be huge, so huge in fact it could overload your system. - If this is an html file you'd probably be safe slurping it up to ease it's processing. I think it's like using a no warnings or no strict pragma to do some dangerous things because you know what you're doing. It's there for people when they get advanced enough to need it, but it's not a good idea to encourage its use on a beginners list. Good comparison, I never see advice to use no warnigns and no strict though :) I've actually seen it a few times in code, but it's usually surrounded by: ## ## #WARNING!! ## # Warnings / Strict turned off here because you know what you're doing, right? :-D -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Survey : Max size allowable for slurping files
On Thu, 2004-01-22 at 17:59, James Edward Gray II wrote: On Jan 22, 2004, at 4:12 PM, Tim Johnson wrote: Here's another argument against slurping: When you slurp a file all at once, even if your program isn't using up much of the CPU, on many machines it will slow down performance considerably if you slurp a large file (large, of course, is still sometimes relative). If that is the only thing you are running at the time, it may not make much of a difference, but it is usually not a good idea to assume that. The flip side of that argument. A quote from the earlier posted article: Another major win for slurping over line by line is speed. Perl's IO system (like many others) is slow. Calling for each line requires a check for the end of line, checks for EOF, copying a line, munging the internal handle structure, etc. Plenty of work for each line read in. On the other hand, slurping, if done correctly, will usually involve only one I/O call and no extra data copying. The same is true for writing files to disk, and we will cover that as well. --Uri Guttman Just to add my $0.02, while you are likely to see your machine slow to a halt if you slurp too big a file, there is no guarantee that the extra overhead required for going line by line will be noticed, especially if you're doing enough other things on every line. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Survey : Max size allowable for slurping files
On Thu, 2004-01-22 at 18:21, Dan Anderson wrote: On Thu, 2004-01-22 at 17:59, James Edward Gray II wrote: On Jan 22, 2004, at 4:12 PM, Tim Johnson wrote: Here's another argument against slurping: When you slurp a file all at once, even if your program isn't using up much of the CPU, on many machines it will slow down performance considerably if you slurp a large file (large, of course, is still sometimes relative). If that is the only thing you are running at the time, it may not make much of a difference, but it is usually not a good idea to assume that. The flip side of that argument. A quote from the earlier posted article: Another major win for slurping over line by line is speed. Perl's IO system (like many others) is slow. Calling for each line requires a check for the end of line, checks for EOF, copying a line, munging the internal handle structure, etc. Plenty of work for each line read in. On the other hand, slurping, if done correctly, will usually involve only one I/O call and no extra data copying. The same is true for writing files to disk, and we will cover that as well. --Uri Guttman Just to add my $0.02, while you are likely to see your machine slow to a halt if you slurp too big a file, there is no guarantee that the extra overhead required for going line by line will be noticed, especially if you're doing enough other things on every line. I just thought of a really good example to add. Let's say you're migrating from Database A to Database B. And, because the SQL dump of database A does something that breaks standards or doesn't work in database B (i.e. mySQL's AUTO_INCREMENT), you decide to create a perl script to transform the SQL You'd have a large number of operations per line (relative to the cost of reading in a file line by line), and if -- for instance -- you passed it around your department and somebody tried using it with a database which was several gigabytes (or possibly even terabytes if you work at a data wharehouse), you would be asking for trouble. On the other hand, somebody mentioned slurping web pages because very few browsers are going to be set to receive 100 GB web pages. Very true. But you also need to look at what you're doing. A spider that indexes or coallates pages across several sites might need to slurp up a large number of pages -- which even at a few kilobytes a piece would be costly on system resources. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How to take command line argument and use it to run an upgrade script.
On Thu, 2004-01-22 at 18:14, Jeff Collins wrote: I'm a perl newby. I'm looking on taking a command line argument from STDIN and use it for input to a script that upgrades software. Any examples would be greatly appreciated. STDIN is already open when your perl script starts so you can read in from it by using: my $variable = STDIN And there are interfaces to curses, tk, and gtk if you feel like creating a nice user interface. Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Need help comparing lines in two files
Lets say file 1 is: foo bar ... continues on for 100 lines And file 2 is: foo baz bar ... continues on exactly the same 100 lines as file 1 Would file 2 be different from file 1 from line 2 and down? Or would it be different for line 2 and 3? Also, the keywords: next; Brings you to the next iteration in a loop last; leaves the loop Should help you iterate through a while loop (or empty loop) i.e. { # this is a loop, just two sets of brackets # put a last statement and it will leave. # put one of these in your for loops, or outside of your for loops. } Also you can get tricky by naming loops, i.e.: FOO: { print foo; BAR: { last FOO; } # anything below here never executes print bar; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Need help comparing lines in two files
One more thing, those loops I was telling you about, just using a pair of brackets, also keep their scope. It's a good way to clean up with yourself, i.e. my $foo = 40; { my $foo = 50; print $foo; # prints 50 # garbage collector called on all declarations before here } print $foo; # prints 40 Also: use strict; use warnings; Should ALWAYS be at that op of your scripts until you know enough Perl to know when to bend or break this rule. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: CGI.pm *with* a templating system?
On Wed, 2004-01-21 at 01:45, Andrew Gaffney wrote: Dan Anderson wrote: On Tue, 2004-01-13 at 16:05, R. Bryant wrote: Hi List, Is it possible to use CGI.pm in conjunction with a templating system? Whenever you send out anything from your CGI object you'll do something like this, correct? my $cgi = CGI-new; print $cgi-header; Well you're *printing* anything you send out. So if you wanted to insert something between something else you would just print it. However, I'm not quite sure this response is exactly what you're looking for. I don't know of any templating systems off the top of my head that allow you to read in some template file and spit out some data. However, I would assume it would not be too hard to implement. Back when I was writing CGI in C (my pre-Perl days), I would create an HTML file that contained %s, %d, etc. in place of where values should go. I would then read in the file to a variable. I would do something like: printf($file_that_i_read, value1, value2, value3, value4, value5, value6); which worked fairly well. The only problem was that I had to create/edit the HTML templated by hand because any HTML editor would try to escape my '%s' and '%d'. Of course, since I write my HTML by hand anyway, that's not really a problem ;) Perl's substitution regular expressions work great for that. I often use HTML templates where in a section for a table I'll put something like: ##PUT#DATA#HERE## And regular expression s[##PUT#DATA#HERE##][$foo] where foo is what I'm putting in works wonderfully. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Help with fileglob: Unix vs. Windows?
On Wed, 2004-01-21 at 11:52, McMahon, Chris wrote: Hello... This script works fine on Unix: #!/usr/local/bin/perl use warnings; use strict; my $dir = /usr/home/admin; my @files = glob ($dir/*); print @files; But this script doesn't do right in Windows: use warnings; use strict; my $dir = E:\\Documents and Settings\\cmcmahon\\Desktop; print $dir\n; my @files = glob( $dir\\*); print @files; The print $dir\n statement works fine, but the print @files statement yields the value E:./Documentsand. Can someone explain what Windows needs here? It's not windows, your spaces aren't escaped. Either replace them with a \s (whitespace char) or properly escape them. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Program to write code
On Wed, 2004-01-21 at 17:32, Marcelo wrote: Hi, could anyone recommend a good program to write code, currently using notepad. I really like Emacs, but it has a high learning curve. Check out: http://www.xemacs.org/ And, of course, not everyone likes Emacs. Better check out ViM as well: http://www.vim.org/ -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: help with progress bar
On Thu, 2004-01-15 at 09:48, zentara wrote: On Tue, 13 Jan 2004 22:38:18 -0500, [EMAIL PROTECTED] (Gerry Creighton) wrote: Hi, I have a situation where I want people to upload large files to my server after filling out a form with several fields. I have an uploader form that works great in processing the form, uploading the file and sending me the form results as well as a copy to the person who filled out the form. What I need is a progress bar so that the visitor isn't looking at a page that looks stalled out. I have often had people close the window which cancels the upload. I waited to see if anyone gave you answer, so I guess I'll give you the bad news. You can't really do it in a good way. The basic problem is that you have to have the server send something back to the browser, with the upload progress. This will interfere with the upload, and slow it down. Well actually, it is possible to put an upload bar on a web page. As you mentioned, you need the server to communicate with the client, or the client to figure out its upload speed, all of which could be done if you created a Java applet to upload. However, creation of such a script is pretty off topic. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: CGI.pm *with* a templating system?
On Tue, 2004-01-13 at 16:05, R. Bryant wrote: Hi List, Is it possible to use CGI.pm in conjunction with a templating system? Whenever you send out anything from your CGI object you'll do something like this, correct? my $cgi = CGI-new; print $cgi-header; Well you're *printing* anything you send out. So if you wanted to insert something between something else you would just print it. However, I'm not quite sure this response is exactly what you're looking for. I don't know of any templating systems off the top of my head that allow you to read in some template file and spit out some data. However, I would assume it would not be too hard to implement. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Writing custom cookies using LWP::UserAgent
I am having LWP::UserAgent fetch information from a site that uses Javascript to write a cookie like this: document.cookie = jscript=1; path=/;; Is there any way to tell my User Agent to add that cookie to the cookie jar? Thanks, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Loop Runners
Can people please contribute on other ways to do the same thing. Please begin by #3, #4.. etc as you read on different ways. use strict; use sub; my @a = @ARGV; my @array = @a; # 1 while (scalar (@array)) { my $element = shift (@array); main::process($element); } @a = @ARGV; #2 main::process( $i ) for my $i (@a); @a = @ARGV; #3 main::process( $i ) foreach my $i (@a); @a = @ARGV; #4 main::process(shift (@a)) while (scalar (@a)); sub process { # do what needs to be done } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: exit perl script and cd in bash?
On Mon, 2004-01-19 at 02:05, John W. Krahn wrote: Kenton Brede wrote: I've been searching the archives and google for an answer. I suspect it can't be done but thought I'd ask. What I'm trying to do is create a tool such as cdargs, in perl, to simplify moving between directories on the command line. The problem I'm having of course is actually changing the shell's working directory from the Perl script. Is there anyway I can do this with Perl? It is very easy to change the directory from inside a Perl program however as soon as the program exits the changes will be lost. This is true of Perl or C or Bash or anything that runs as a child of the shell. He's right, out of curiousity I tried the following: % perl -e `cd ..`;; % ./test # where test was: #! /bin/bash cd .. And neither worked. However, if he wanted to he could create a script that moved to that directory, and ran a copy of sh or bash, couldn't he? Then pipe commands back and forth. It would be terribly inefficient though. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
OT: Re: parse email
On Mon, 2004-01-19 at 09:50, Paul Kraus wrote: Is there anyway I can get outlook to run a perl script whenever mail from a particular user arrives? Evolution (Sorry, Linux only) and (I believe) Mozilla support shell commands on e-mails. Switching would also block infection from a number of viruses Outlook always seems to be plagued with. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Re: parse email
On Mon, 2004-01-19 at 11:00, Paul Kraus wrote: Evolution (Sorry, Linux only) and (I believe) Mozilla support shell commands on e-mails. Switching would also block infection from a number of viruses Outlook always seems to be plagued with. Agreed. I am Linux man myself but here at work the entire office is connected via outlook for appointments and everything else. Having my machine not connected this way would be more of a pain in the ass then using office. Have you tried the Exchange connector for Evolution? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Saying an item is empty
scalar (@array) can be used to find the number of elements in @array. @{$foo} can be used to work with the array represented by the array reference $foo you can combine the two for scalar(@{$foo}) Also remember hashes are even sized arrays. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: C# on linux OT
On Mon, 2004-01-19 at 04:26, rhlinux wrote: hello all, Do any one know how can i run C# on linux, and if i can use the visual studio editor. and How please This is way off topic. However, there are a number of ways to run windows programs on Linux, including Wine, Crossover Office, VMWare (I think that's what it's called), and Exceed hummingbird. Google for all of those. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: C# on linux
One problem though... you can't use Visual Studio on Linux, because it's MS-ware. That's not 100% true. Of course, whether or not he can run it without any problems is a different story. If I remember correctly and Hummingbird allows him to do the Windoze equivalent of an ssh with X forwarding into a windows box, he could. Of course, for $500+ a head, why not just use Windoze? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Calculations with date
100:1 there's a date arithmetic module on CPAN which would do exactly what you need. However, (at least from my point on the net), CPAN appears to be down. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Suggestions for Submitting to CPAN
I've read the tutorial on creating a Makefile.PL for a module I'm submitting to CPAN, and I've applied for a PAUSE ID, but I was curious if anyone whos been through the process before knows of any pit falls I should be careful of, or any suggestions on how to make my life easier. Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Why isn't perl used more in business and industry
Most of the scripts I see end in an extension like .jsp, .asp, .dll, or something which says that they aren't perl. Is there a reason more businesses and online companies don't use perl? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: what is this data structure?
On Fri, 2004-01-16 at 11:03, Jack Chen wrote: Hi, I don't know how to work with this data structure: my @array = ((a = 'appple'), (b = 'tree'), (c = 'chair')); That array is an array of hashes. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Why isn't perl used more in business and industry
- Are those on servers you work with? Those specific ones may use those for whatever reason. No, just whenever I cruise the net I'm always surprised to see scripts ending in .asp or .jsp. I understand that some people prefer Java to Perl, but I know there are a lot of people out there who like perl. Which has made me wonder more then once if in a security through obscurity approach sites pass perl scripts off as ASP, etc. For instance, Ebay's servers are run by IBM (hence the big blue IBM logo on their sites). But all the forms like through to files ending in .dll. That doesn't make much sense to me, I would think IBM would run AIX / *nix servers for Ebay. - *nix systems come with perl installed and use perl for lots of stuff, Perhaps I should have better said, why isn't it used more on the web? - Perl is run as .cgi a lot of times so you may not notice it's Perl like you would the other kinds. Yes, but ASP and JSP end scripts in .asp and .jsp respectively, which makes me wonder why I don't see less JSP and ASP tags. Thanks for all your comments, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: what is this data structure?
On Sat, 2004-01-17 at 15:12, James Edward Gray II wrote: On Jan 17, 2004, at 2:02 PM, Dan Anderson wrote: On Fri, 2004-01-16 at 11:03, Jack Chen wrote: Hi, I don't know how to work with this data structure: my @array = ((a= 'appple'), (b= 'tree'), (c = 'chair')); That array is an array of hashes. It was probably meant to be, but it is not as written. Look again. Ahhh, you're right. Correct me if I'm wrong, but the arrays expand out, so although (a - 'apple') is a hash and (b = 'tree') is a hash, it actually contains the hash: ( a = 'apple', b = 'tree', c = 'chair', ) Correct? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: unscribe
On Fri, 2004-01-16 at 11:43, Walter Valenti wrote: How i can unscribe ??? At the bottom of all e-mails you'll see this: -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Why isn't perl used more in business and industry
On Sat, 2004-01-17 at 15:21, Dan Muey wrote: Which has made me wonder more then once if in a security through obscurity approach sites pass perl scripts off as ASP, etc. Maybe, I don't see why I'd want to make people think I'm using insecure stuff when I'm really using the best, but maybe. Well just to throw people off. I've often contemplated throwing up a world readable /scripts directory on my server so anyone scanning my box would say, h, insecure IIS and provide me with enough notice they were trying to hack me then if, for instance, they said He's using Mandrake Linux, better hang around the mailing lists looking for the latest vulnerability. Of course, there's really not too much of value on my box besides Nethack bones files so I'm not too worried. For instance I was talking to a gentleman who was showing me his new web server ($$$ for Winders and IIS) with his new sexxy web app he was looking forward to using, and he was proud because He had connections that saved him 10% so he only paid $3000 for it. I was shocked so I looked at his site with him and got a list of it's awesome features. That night I did the same thing in Perl and used the html/css from his site for the looks and I showed him the next day and he about died because mine did everything his did, looked the same and it was free. The only differenece was now he had a sort of torn and bleeding feeling in his bottom LOL... -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: what is this data structure?
You're terminology is a little confusing, but I think you have the right idea. For the benefit of the original poster: The = symbol is usually used to signify a hash and automatically quote the key to the left of it. I.e.: my %hash1 = ( foo = 'bar', bar = 'baz', baz = 'foo', ); However a hash is just an even valued list, so %hash1 is the same as %hash2: my %hash2 = ('foo', 'bar', 'bar', 'baz', 'baz', 'foo'); However, a lot of times you'll see a hash in a hash reference, i.e.: my $hashref = { foo = 'bar', bar = 'baz', baz = 'foo', }; So that instead of accessing elements by $hash1{foo} you'd access them by $hash1-{foo}. I think I've successfully improved, right? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Emacs Wizards
On Wed, 2004-01-14 at 11:07, Paul Kraus wrote: Is there a way to easily have emacs comment out xnumber of lines. M-x comment-region will comment out a marked region. C-x ( starts defining a macro. Type the keys you'd normally type to comment out a line, i.e. C-a # SPC Now hit C-x ). The macro can be executed by C-x e. Hit ESC n C-x e to execute the macro n times. THere are a million other cool tricks. E-mail me privately if you want me to continue. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Apel of VIM was Emacs Wizards
On Wed, 2004-01-14 at 18:22, Jeff Westman wrote: Incidently, emacs has a 'dired mode' (directory editor) which is very nice... much like the old 'list' shareware in DOS land of the dark past you can bring up a list of files (like 'ls -l'), then view and selectively execute or delete all that you mark. It's very nice, and it can also be used when accessing remote servers. Not to mention it allows syntax highlighting. Yes, and since Emacs is built on top of a LISP interpreter you can customize it till your hearts content -- including changing the regular expressions emacs matches files with in Dired mode. As driex pointed out, it is the start-up time that is preferred in vi/vim. But again, a true emacs die-hard never exits the editor and does all his/her tasks inside the of it. I'd like to add that emacs allows a Server Mode. So you start it up once every time you boot, it runs nicely in the background, and whenever you need to edit a file you use emacs in client mode (i.e. type emacsclient instead of emacs). Not to mention, the learning curve for emacs is horrific. I spent a lot of time learning both Vi and Emacs when I first came to the *nix world. Both sides had some very smart people with very good arguments as to why one was better then the other. So I figured the best way to figure out which one was best for me was to spend a couple hours mucking around with each one. I ended up choosing Emacs because, despite the learning curve, it's a damned good IDE. In emacs I can view packages, methods, and a bunch of other code related things in the speedbar, and I have found I code much faster in Emacs then vi (by over a thousand lines a day). Most of it boils down to the fact that 30% of code tends to be reusable. For instance, take the following: my $query = qq+SELECT * FROM foo WHERE bar = baz+; my $result = $DBI_connection-prepare($query) or die(Can't prepare $query because $!); $result-execute or die(Can't execute $query because $!); I've created an Emacs macro that will allow me to type three keys, and everything with the exception of the contents of the query are created. Then I fill in the query and hit alt } and I'm at the next point in my code. It's much quicker then I ever could have done under vi. Throw into that abbreviation mode (you can define abbreviations, so type the abbreviation and have it automatically expand, i.e. every time I type [EMAIL PROTECTED] [EMAIL PROTECTED] might be automatically replaced). This, again, increases my efficiency because I can fly through code and many common mistakes are automatically corrected. Now, vi may have support for some of the features I've listed above. (For instance Vi does have macros, but it's not built atop a programming language like LISP so I'd assume they're not that powerful...But that's conjecture). But the point is that ***I*** liked emacs better, so I use emacs. Because it's more efficient for ***me***. It may be that for ***you*** Ed, or another editor may be a better choice. I encourage everyone to try out all the alternatives out there to make up his or her own mind, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: JPG FILE DOUBTS
Check out http://search.cpan.org/ . I found a number of results doing a quick search for both JPEG and JPG. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Dumping values of all vars
On Thu, 2004-01-15 at 12:35, zentara wrote: On Wed, 14 Jan 2004 12:40:31 -0700, [EMAIL PROTECTED] (Jdavis) wrote: Hello, Is it possible to dump the values of all the vars in a perl script easily? I want to have a sub called Error that when called will tell me the current value of all the vars in the script. thanks, I use the Data::Dump package which is a standard module. Be warned that calling Data::Dump::dump($variable) will undef $variable! -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Dumping values of all vars
On Thu, 2004-01-15 at 17:59, James Edward Gray II wrote: On Jan 15, 2004, at 4:40 PM, Dan Anderson wrote: I use the Data::Dump package which is a standard module. I'm willing to bet you actually use Data::Dumper. Nope. I use Data::Dump. Then I call Data::Dump::dump() to dump a variable. http://search.cpan.org/~gaas/Data-Dump-1.02/lib/Data/Dump.pm I was, however, mistaken that it's part of the default Perl install when you build it from source (although it is part of the default install on Mandrake Linux). -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Dumping values of all vars
On Thu, 2004-01-15 at 17:59, James Edward Gray II wrote: On Jan 15, 2004, at 4:40 PM, Dan Anderson wrote: I use the Data::Dump package which is a standard module. I'm willing to bet you actually use Data::Dumper. Oh yeah, how much are we betting? My car could use turbo chargers and NOS. :-D From the POD: The Data::Dump module grew out of frustration with Sarathy's in-most-cases-excellent Data::Dumper. Basic ideas and some code are shared with Sarathy's module. The Data::Dump module provides a much simpler interface than Data::Dumper. No OO interface is available and there are no configuration options to worry about (yet :-). The other benefit is that the dump produced does not try to set any variables. It only returns what is needed to produce a copy of the arguments. This means that dump(foo) simply returns foo, and dump(1..5) simply returns (1, 2, 3, 4, 5). And I agree that Data::Dumper is much more complicated then it needs to be. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Dumping values of all vars
As a rule though, Data::Dumper doesn't erase data, as you can see below: One more thing. I have noticed a problem with Data::Dump where if the data structures are too complex the data can disapear. I'm not quite sure why. Usually I use it in {}s on a temporary variable which is a copy of what I'm dumping -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Dumping values of all vars
On Thu, 2004-01-15 at 18:17, James Edward Gray II wrote: On Jan 15, 2004, at 5:06 PM, Dan Anderson wrote: And I agree that Data::Dumper is much more complicated then it needs to be. Data::Dumper is a standard module and I find it super useful. I just showed it in a one liner, so I don't think we can say it's too hard to get into. I encourage others to check it out for themselves. Well yes it is useful. Perhaps I should have said that I /prefer/ Data::Dump because that's the Perl module I originally found to do dumping. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RFC: Prototyping, do or don't?
I am somewhat confused as to when to prototype a subroutine. Under the tips section Programming Perl makes the following points: 1. Prototyping can lead to inlined functions which increases the speed of commonly used functions. Prototype when you can. 2. As soon as somebody uses your function in a way it wasn't supposed to be used, your program can explode. Never prototype. (This is not verbatim -- but it's the same general idea) Can anyone go more in depth about the pros and cons of prototyping? Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: script works from shell but not http
On Mon, 2004-01-12 at 12:12, [EMAIL PROTECTED] wrote: Thanks everyone, The reason the BEGIN statement was there is I don't exactly know where my error logs are and it's faster to just read the file. Plus if it wasn't a script problem the err.txt file wouldn't be created. I don't know if anyone has mentioned this, but you are clobbering your error logs and not acquiring locks on the files, nor do you have any provisions to prevent a race condition should 2 people be using your script at the exact same time. You may want to reconsider using it for anything other then testing. Then again, maybe you're using it on a very small scale and the probability of a race condition is so low as to not make it worth it. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Matching invalid characters in a URL
On Fri, 2004-01-09 at 16:54, Wiggins d Anconia wrote: Any suggestions? Thanks for your help and thoughts. It is much easier to define the set all chars must be in then not. Use the =! which is the complement of all charachters matched by =~. Alternatively, I believe there is a c option you can use. -Dan That (I presume) should be !~ instead of != to complement =~ as opposed to ==. When trying to include a dash in a character class (and not make it a range), [], place it as the first character in the class, when including a carat ^ do NOT place it as the first character (as that negates the class). Ooops... My apologies. I was typing too quick and without much caffeine. :-( -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: script works from shell but not http
On Sun, 2004-01-11 at 11:47, zentara wrote: On Sun, 11 Jan 2004 06:10:32 EST, [EMAIL PROTECTED] wrote: #!/usr/bin/perl -w use strict; BEGIN{open(STDERR, ./err.txt)} print Content-Type: text/html\n\n; foreach my $key (sort keys %ENV) { print \$ENV{$key} = $ENV{$key}br/\n; } None of my scripts are functioning on my new server. The BEGIN statement doesn't write err.txt But it does function from a shell. I also changed the code thinking it was a header problem. But it does not function either. #!/usr/bin/perl -w use strict; BEGIN{open(STDERR, ./err.txt)} use CGI; my$q = CGI::new(); print $q-header; foreach my $key (sort keys %ENV) { print \$ENV{$key} = $ENV{$key}br/\n; } The permissions are set to 0755. I thought maybe the .pl extention wasn't recognized so I changed it to cgi, No such luck. I'm out of my bag of tricks. My provider isn't responding to my emails. I'm guessing apache isn't configured right. Your apache is probably set up to run as nobody::nogroup, or some similar lowest permission user::group. So your directory has to be world-writable for apache to write to it, or 777. It runs from the shell, because you are logged in as a user, and 755 will work. Setting anything world writable is dangerous. Remember to take proper precautions, like making the directory inaccessible through apache, and/or throw it in a database instead. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Do Else Unless Statements Exist?
Does Perl have any kind of else / unless statements, sort of like elsif? I tried: if ($foo) { } else unless ($bar) { } but it just gave me syntax errors. And I guess I could just do: if ($foo) { } else { unless ($bar) { } } But the place in the code I was trying it was for clarity, and all the nested unlesses don't seem to add to clarity. Thanks in advance. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Matching invalid characters in a URL
Any suggestions? Thanks for your help and thoughts. It is much easier to define the set all chars must be in then not. Use the =! which is the complement of all charachters matched by =~. Alternatively, I believe there is a c option you can use. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Use of FOR statement
On Wed, 2004-01-07 at 20:39, Paul Harwood wrote: I am reading through a book on Objects and References and I don't understand this statement: $sum += $_ for split //; FWIW, for is synonymous with foreach. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Integrating perl scripts into KDE / Gnome
I was curious if anyone knows a good resource on integrating Perl scripts into KDE (and I suppose gnome). I want to start doing things like adding my scripts to my taskbar, and was curious if that was possible without compiling C extensions. Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: stop
Uhhh...at the bottom of every list message is: -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response withold sarcastic comment about thinking before you post / -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: PERL debuggers
I've created a module that I am planning on eventually releasing to CPAN which provides a good framework for debugging. Basically you can have your code report 4 types of warnings: INFO WARNING ERROR FATAL_ERROR You can also assign a class to each and turn on or off all of one type or all of one subclass of one type. Everything either records to a log file or prints to STDERR, and I am going to (eventually) add the capability to e-mail the log of errors to an admin. (So if you create a program and your users do something unexpected you can have them send you a readout of exactly what happened). And I've got a bunch of other ideas (i.e. HTML output) that I may implement when I finally manage to getting around to see if I can put it on CPAN. It's written in pure perl and GPLed. e-mail me if you'd like me to send you over a copy. It's still being developed though. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: PERL debuggers
I'd like to add that it's not a debugger like the one someone else posted for stepping through your code and setting breakpoints. It's designed to allow you to create a log with the state of your script and what has been done, so that way you can have somebody who is not a programmer and who is using your script send you the log (because, of course, most of those type of people can't debug with you over the phone). :-D -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Learning Objects, destroy methods
I don't know if anybody has mentioned it yet, but check out weak references on CPAN: http://search.cpan.org/~lukka/WeakRef-0.01/WeakRef.pm -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: (I wish there was a) cpan user's guide
On Tue, 2004-01-06 at 02:10, chris wrote: I keep feeling I should learn more before I post here (lest I look like a lazy idiot who can't RTFM), but I'm getting too old to wait! http://search.cpan.org/~gaas/URI-1.29/URI.pm Search CPAN under URI instead of URL. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
killing processes after x seconds
Is it possible to (easily) tell perl to kill itself and all children if the script doesn't execute in x seconds? I thought about forking the script and having the parent sleep for x seconds at the top of the process, but that seems like a lot of extra code. I was hoping there was a timeout_process(x) function / CPAN module. Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Which is better: GTK or TK
I am trying to extend my perl skills to the point of being able to create programs with GUIs. I found a tutorial to both GTK and TK -- but the TK tutorial did in one line what the GTK tutorial did in many. I was wondering what the pros and cons of TK and GTK were, and whether GTK involves significantly more work or if the TK example was just clever coding. Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: deleting a hash ref's contents
IIRC, Perl's garbage collection system sits in the background waiting until it finds a chunk of memory not referenced by any variable and then deletes it. So references to anything keep the memory connected to the reference in play until either Perl dies or there are no variables which contain it. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Learning Objects, destroy methods
My problem is one of destroying a block (object), making sure that I have no memory leakage. Out of curiosity, when you say memory leakage do you mean that the memory persists after the Perl process exits, or just while it is running? And have you verified this? And, is the program a daemon where the memory leak will build up over time? (i.e. if the program runs for 10 minutes you may just want to bite the bullet and let the memory leak -- if it gets cleaned up when the process exits) -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Microsoft Services for UNIX/LINUX
On Mon, 2004-01-05 at 15:03, drieux wrote: On Jan 5, 2004, at 9:32 AM, [EMAIL PROTECTED] wrote: [..] I was wondering if anyone on this list have had any luck with this technique of executing UNIX-based applications. One thing that comes to mind is CGI-scripting, but this is not an option for me. [..] So you might want to solve that set of issues before you start worrying about the idea of solving your 'client-server' issues with a round of CGI code that will wind up on some web server that will allow an 'all browser' approach to get you around using the Xwindows and/or SMB/NFS and/or Or create a client script that can run with a GUI tool kit and connect to the master server. Or get cygwin and use ssh with X forwarding. Or pay money for a product like Hummingbird ($500 per user I believe) which will allow you to VNC with a *nix box and run X applications in a seperate window. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Hacks via Slow regular expressions
I was reading O'Reilly's Programming Perl, and under the security section it says that regular expressions from outside the program are not trusted because it is possible that they can take forever to execute. I was curious exactly what kind of regular expression takes forever to execute? Are these common, and is it possible that I can accidentally take forever to use a regular expression? Can anyone provide me with more information then O'Reilly's some regular expressions take an exponential time to execute? Thanks in advance, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Problems with LWP::UserAgent
Call me an old fogy, but I think that some of the mechanization of Web communications has gone too far. Providing interactive features in the CGI is one thing. It provides services for both sides of any transaction involved. Batch harvesting of pages meant for human perusal, like batch dialing of persons homes at mealtimes, strays across a line into misuse of technology, IMHO. Apparently, the folks at O'Reilly agree. Since some of them at least, have been around the CGI since its inception, you might have a bit of a challenge in thwarting their intended use of their site. Well, Safari *does* provide for printing of pages from a book and e-mailing copies of them to other people. My intention is not to twahrt them, but -- for instance -- when I go on a trip for christams instead of having to print out each and every chapter to the Perl Cookbook I can just send a script to do it. IMHO not a violation of the Safari terms of service. Not only that Safari has a number of features in place that I couldn't get around if I wanted to. For instance, all books must be kept on the bookshelf for at least 30 days -- which (short of hacking their server) is not going to be circumvented. So, all in all, I think that my usage falls under the term fair use. I have no desire to circumvent Safari's security -- I'm just looking to speed up something I do which conforms to the TOS of the web site. :-D -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Problems with LWP::UserAgent
Fair use is copyright law -- I don't know whether you're infringing anybody's copyright, but you're certainly violating O'Reilly's Terms of Service, which requires that you agree: not to use Web spiders or any other automated retrieval mechanisms when using the Service other than what is provided by the Service I guess I should stop then, but I was looking at O'Reilly's robots.txt file (http://safari.oreilly.com/robots.txt): User-Agent: * Allow: / Which made me think spidering was alright. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Problems with LWP::UserAgent
I am trying to create a spider to grab my books off of Safari for a batch printing job so I don't need to go through each chapter myself and hit the Print button. So I used this script to try and log myself in to the safari site: # BEGIN CODE #! /usr/bin/perl use strict; use warnings; use LWP; use LWP::UserAgent; # variables my $cookie_jar_file = ./cookies.txt; my @headers = ( 'User-Agent' = 'Mozilla/4.76 [en] (Win98; U)', 'Accept' = 'image/gif, image/x-bitmap, image/jpeg, image/pjpeg, image/png, */*', 'Accept-Charset' = 'iso-8859-1,*', 'Accept-Language' = 'en-US', catid = , s = 1, o = 1, b = 1, t = 1, f = 1, c = 1, u = 1, r = , l = 1, g = , usr = myemail, pwd = mypassword, savepwd = 1, ); # end variables my $user_agent = LWP::UserAgent-new; $user_agent-cookie_jar({file = $cookie_jar_file}); my $response = $user_agent-post( 'http://safari.oreilly.com/JVXSL.asp', @headers, ); # END CODE Now I know that this is the form I should post to because I stripped the following forms out of the web page (and there is no Javascript to modify the forms): form action=JVXSL.asp method=post input type=hidden name=catid value= input type=hidden name=s value=1 input type=hidden name=o value=1 input type=hidden name=b value=1 input type=hidden name=t value=1 input type=hidden name=f value=1 input type=hidden name=c value=1 input type=hidden name=u value=1 input type=hidden name=r value= input type=hidden name=l value=1 input type=hidden name=g value= input name=usr type=text value= size=12 input name=pwd type=password value= size=12 input type=checkbox name=savepwd value=1 input type=image name=Login src=images/btn_login.gif width=40 height=16 border=0 align=absmiddle /form When I pull up this web page there's nothing in $response-content. I know that safari.oreilly.com will return a blank page if it doesn't like the user agent, and upon signing in it'll return to the safari.oreilly.com page with a very large number of get variables. Does anyone know what I might be doing wrong? Also, I figured I'm not the only person who would want to do this. Anyone interested in starting up a Sourceforge project with me and releasing it under the GPL? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: how to remove a ^M charaters from a variable
\r Caveat: Only on *nix systems. Otherwise \n is 0x1512 and not 0x12. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Preventing Accidentally Fork Bombing My Box
I'm creating an app that uses forks in a number of places to do things quicker. Unfortunately, I have a bad habit of accidentally fork bombing my box. Is there any way I can run a perl process (even if it's a Linux command) so that it wont eat up all available resources if I screw up? Or do I just need to learn to be more careful? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: how to remove a ^M charaters from a variable
On Fri, 2003-12-19 at 11:54, Dan Anderson wrote: \r Caveat: Only on *nix systems. Otherwise \n is 0x1512 and not 0x12. That should read Otherwise \n can be 0x1512 -- i.e. on Windoze boxen. On Macs it's something different. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Preventing Accidentally Fork Bombing My Box
drieux [EMAIL PROTECTED] writes: On Dec 19, 2003, at 8:55 AM, Dan Anderson wrote: [..] I'm creating an app that uses forks in a number of places to do things quicker. Unfortunately, I have a bad habit of accidentally fork bombing my box. I'm not sure I get this phrase 'fork bombing' to begin with, I'll do something dumb, like fork in a loop while $number_forks $fork_this_many. But, for whatever reasons, I have a tendency to do things like create an infinite loop by accident, and fork an infinite number of processes, or soemthign like that. This results in what is effectively a DOS on my box, because it starts swapping as soon as it eats up all the RAM and is unresponsive without a hard reboot. :-( Now, try as I might to prevent these, in the same way that every once in a while I leave an infinite loop on a normal program or do something similarly dumb, when I do it with forks I have a tendency to eat up resources until I get DOSed. So instead of spending the 30 seconds killing the process, looking into the code, cursing myself, and fixing it, I end up hard rebooting and recovering all my autosaved files. :-( -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Running a system command as root
I am having problems. I want a cgi script to call a perl script I wrote, which is in the /var/www/cgi-bin directory, which is SUID root -- i.e. runs as root. So I chmod +s the script and ran it like: `./the_script`; in perl. The strangest thing happened though. I can't +SUID something for root in the /var/www/cgi-bin directory. I know webmin panels most virtual hosts use execute root commands. How do they do this, and how do I get around this? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Problems with Inheritance in GD::Graph
I am trying out GD::Graph, which is a CPAN module that creates a method new, and then for each graph type inherits that new method (I think -- I had to open the code). So I tried calling: my $graph = GD::Graph::bars-new(400, 600); And I get the error: Can't locate object method new via package GD::Graph::bars (perhaps you forgot to load GD::Graph::bars?) at - line 12. Now I know everything was installed. And I cracked the source to find that GD::Graph::bars should inherit new, but perl seems confused. What am I doing wrong? Thanks, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Nevermind WAs: Re: Problems with Inheritance in GD::Graph
Nevermind. I'm an idiot. I fogot to use GD::Graph::bars. :: hits head against wall:: Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Problems with Inheritance in GD::Graph
On Wed, 2003-12-17 at 14:04, Ed Christian wrote: Dan Anderson wrote: I am trying out GD::Graph, which is a CPAN module that creates a method new, and then for each graph type inherits that new method (I think -- I had to open the code). So I tried calling: my $graph = GD::Graph::bars-new(400, 600); And I get the error: Can't locate object method new via package GD::Graph::bars (perhaps you forgot to load GD::Graph::bars?) at - line 12. Stupid question: did you remember to use GD::Graph::bars; Nope. Thanks for your help. I really need another cup of caffeine..erm...coffee. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: silly qn,.
On Thu, 2003-12-18 at 06:03, Ajey wrote: hi, how can i find which perl modules are installed on linux os? Well Linux distributions differ in what they install, and even then you can install or uninstall or change what modules are installed yourself, so pretty much you're never guaranteed that any module is installed. Even if a module is part of the Core installation (i.e. the module defaults to installation with perl), your @INC can be modified to exclude it. So run the following script: #! /usr/bin/perl use strict; use warnings; my @dirs = @INC; while (my $dir = shift (@dirs)) { my @modules = glob $dir/*.pm; while (my $module = shift (@modules)) { my @parts = split '/', $module; my $module = pop (@parts); print Module $module is installed\n; } } print That's all \n\n; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
getting rid of whitespace at the beginning and end of a string
Is there a way to chomp all whitespace both at the beginning and end of a string? I was thinking of using a regexp like s[^\s*?][]sg and s[\s*?$][]sg; Is there a better way? (I'm thinking of PHP's trim function) -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: md5 function
On Thu, 2003-12-11 at 05:51, Randy W. Sims wrote: On 12/11/2003 5:41 AM, Yannick Warnier wrote: Hi all, Is there an easy function to apply an md5 to a string? (sha1 could also do) I've looked at the perl base functions and didn't find it but I would like to avoid the use of modules as much as I can. Thanks, Yannick Digest::MD5 Digest::SHA1 Both of these modules are included in core perl. There are no builtins as you describe, but that shouldn't be a problem since these are core modules. Why avoid modules? Caveat Coder! Perl can be set up so that the @INC doesn't point to the core modules. I have seen this on shared hosting, where (I assume) the sys admin decided to use it as a way to secure the box. Of course, if you use something like this: BEGIN { unshift ./modules, @INC; } you can then store all your modules in the ./modules directory and have them accessed. Of course, this may or may not violate their terms if you're selling the script. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How do I set up bidirectional pipes over a network connection?
On Tue, 2003-12-09 at 17:41, James Edward Gray II wrote: On Dec 9, 2003, at 4:12 PM, Dan Anderson wrote: Well, I was planning to implement the file transfers using Net::FTP or something similar to keep the problems down. But I want every node to be able to talk to other nodes, i.e. each node be able to send every other node a request to download a file and put it in directory . There will be one daemon functioning as the master to regulate, which will provide a database with the IP addresses and port/sockets the other daemons are listening on. Could every box but the main one be running an FTP server and then you only have to write the master script? Well what I had planned was that there would be a module to fetch files and put them where they are supposed to be using FTP, and a brain to listen and talk to the other nodes. I'm just throwing out ideas, to see if anything sparks. This one is probably too clumsy though, if you want to be able to trigger moves from the non-master boxes. Well FTP is a great protocol. It's a private network so I'm not to worried about the fact the files travel it unencrypted. Anybody splicing into my network has enough resources to get me other ways. :-D Doesn't sound to me like your getting out of this one easy, so the suggestion to go for a framework like POE is looking better and better, I would think. Thanks for all your help! -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How do I set up bidirectional pipes over a network connection?
On Tue, 2003-12-09 at 20:38, John W. Krahn wrote: Dan Anderson wrote: On Tue, 2003-12-09 at 16:31, James Edward Gray II wrote: On Dec 9, 2003, at 3:19 PM, Dan Anderson wrote: I have 2 Linux boxes I want to talk to each other over the local network using a Perl script. Is it possible to set up a bidirectional pipe so that 2 perl daemons can communicate with each other? How would I go about doing this and are there any modules to help? It's very possible and there are many modules to help. Help us help you though, what are you trying to do? It could make a big difference. I'm writing a perl daemon to do two things: back up important files on multiple boxen so if one gets taken out another will survive, and sync files in users directory from a main server -- i.e. I want to be able to do something like $ ./distribute.pl --file and have it sent to all boxen's ~/distributed/ directory. Could you not use NFS to mount the users directories from the main server and use the appropriate RAID arrays and backups on the main server? Actually, that's a good idea too. Thanks for your suggestions! -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: adding path to $PATH
On Wed, 2003-12-10 at 01:09, Pablo Cusnir wrote: Hi, Is there a way using Perl to add to the environment variable PATH a new path, and that addition will be valid after the script is ran and not only for the script's scope. I'm working in cshell in Solaris 5.8 The regular way to do it in the shell is: setenv PATH my_add_path:$PATH I tried using: system(setenv .); and also: system (csh setenv .); You'd need to add it to the CSH equivalent of the .bashrc found in users directory, or /etc/bashrc for it to persist. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Get file size without downloading
On Wed, 2003-12-10 at 09:42, Bob Showalter wrote: usef wrote: Hi, FTP or HTTP? HTTP, but I want to know the method for FTP as well. Thanks -u I think that will work for FTP as well. Give it a try. If I type ls when I FTP into somewhere I get a listing of files and size. I would guess either: a) ls is a command in FTP b) there is a corresponding command in the FTP module you are using. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Problems forking -- fork DOSes my comp
I am learning about forks, so I tried the following code to make sure I had everything down: #! /usr/bin/perl use strict; use warnings; my $counter = 1; my $pid = 0; while ($counter 50) { if ($pid = fork) { open (FORKED, ./fork/$counter) or die(COULD NOT OPEN FORK); print FORKED $counter; close(FORKED); $SIG{CHLD} = IGNORE; } $counter++; } I figured this would write 49 files relatively quickly and that would be the end of it. Running it DOSes a 1Ghz PIII Box I have takes 20 minutes -- during which time /nothing/ else can be done, i.e. a DOS. Oddly enough, putting the limit on counter down to 5 runs in less then 0.02s. So what am I doing wrong? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Problems forking -- fork DOSes my comp
On Wed, 2003-12-10 at 17:04, James Edward Gray II wrote: On Dec 10, 2003, at 3:52 PM, Dan Anderson wrote: I am learning about forks, so I tried the following code to make sure I had everything down: Still don't believe me about Network Programming with Perl, eh? Did I mention that it covers forking well? laughs LOL. Thanks for all your help. I actually put a copy on my Safari bookshelf but I have yet to start it. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
How do I set up bidirectional pipes over a network connection?
I have 2 Linux boxes I want to talk to each other over the local network using a Perl script. Is it possible to set up a bidirectional pipe so that 2 perl daemons can communicate with each other? How would I go about doing this and are there any modules to help? Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How do I set up bidirectional pipes over a network connection?
On Tue, 2003-12-09 at 16:31, James Edward Gray II wrote: On Dec 9, 2003, at 3:19 PM, Dan Anderson wrote: I have 2 Linux boxes I want to talk to each other over the local network using a Perl script. Is it possible to set up a bidirectional pipe so that 2 perl daemons can communicate with each other? How would I go about doing this and are there any modules to help? It's very possible and there are many modules to help. Help us help you though, what are you trying to do? It could make a big difference. I'm writing a perl daemon to do two things: back up important files on multiple boxen so if one gets taken out another will survive, and sync files in users directory from a main server -- i.e. I want to be able to do something like $ ./distribute.pl --file and have it sent to all boxen's ~/distributed/ directory. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: How do I set up bidirectional pipes over a network connection ?
You might look at the standard rdist(1) utility for this kind of thing. For crafting network daemons in Perl, Net::Daemon is a good place to start, IMO. What I am trying to do is too complex to successfully implement using a standard utility like rdist or CVS. Besides, rolling my own is so much more interesting. :-D -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How do I set up bidirectional pipes over a network connection?
How many boxes are we talking about here? Well starting off, 2. But I would like to expand to several more. Probably never more then 10. What you're talking about is no small feat. How can we help you? You want a server and a client, right? Could it be and FTP server and a script client? Well, I was planning to implement the file transfers using Net::FTP or something similar to keep the problems down. But I want every node to be able to talk to other nodes, i.e. each node be able to send every other node a request to download a file and put it in directory . There will be one daemon functioning as the master to regulate, which will provide a database with the IP addresses and port/sockets the other daemons are listening on. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Problems compiling Perl 5.6.1
When I try to compile Perl 5.6.1 (can't find any RPMs and, yes, I need 5.6.1), I get the following error: make[1]: Leaving directory `/root/perl-5.6.1/utils' Making x2p stuff make[1]: Entering directory `/root/perl-5.6.1/x2p' make[1]: *** No rule to make target `built-in', needed by `hash.o'. Stop. make[1]: Leaving directory `/root/perl-5.6.1/x2p' make: *** [translators] Error 2 What does that mean? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Setting the file permissions of a file I'm writing to
Is it possible to specify the permissions of a file I create when I: open (FOO, ./bar) or die (Could not create file); Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
What are the dangers of leaving a cgi-bin directory CHMOD 777
I have a perl script that writes to its directory, and as such the directory is CHMOD 777 in my cgi-bin. (Linux box) I figured this might be dangerous, but didn't think there was any harm in it. Am I right or will the script kiddies be all over me? -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Replacing text
I have a script that reads text from a file and inserts text into different places depending on what it needs to do. But I use split to replace the text, i.e.: ($first_part, $second_part) = split #INSERT#TEXT#HERE#, $document, 2; print FILEHANDLE $firstpart, $text_to_insert, $secondpart; Is there a replace function in perl that would let me do something like replace #INSERT#TEXT#HERE, $text_to_insert;? I was going to write my own method but was curious if perl had something faster? Thanks in advance, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Don't Send To Me! [OT]
On Mon, 2003-11-24 at 01:54, Jason Dusek wrote: Hi There, Is there some way to get people on this list to stop sending me two emails at once? I am on the beginner's list - so when you send email to me and then cc to the list, I get two. Which is annoying. I suppose I could write some rules to kill duplicate messages, but I have got stuff to do. If I post to the list, I think it may be safely assumed that I will read it to find out what people have to say about my posting. Your mail client may support disabling crossposting. Gnus does, basically all copies are only allowed into 1 directory, and forced into the one you specify as having higher priority (using rules). This isn't really a Perl question -- you should OT this thread. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: perl is slick
Vive OO. Rock on. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Viewing logs on other computers.
Although it's not quite the same thing, I wrote a pretty simple Perl script to keep track of disk space usage on a number of file servers. Because df needed to be run as root (access to /proc wasnm't allowed for underprivileged users) I setuided it to root. If I were you I would chgrp the /var/log to logviewer, or something like that. Then I would SetGID the script so it would run as the group (logviewer). Then you could read/parse/whatever the logs and use FTP, email, or something similar to send the log files to your main box. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problems with regular expressions
I have a regular expression that looks like: $foo =~ s[class.*?=.*?'.*?'][]sgi; The problem I run into is that if the following is presented to match: table class='foo'tr class='baz'td class='bar' The regular expression will match: class='foo'tr class='baz'td class='bar' And I'll get: table Is there any way I can tell the .*? to match as well as .? Thanks in advance, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problems with case insensitive tr/// regexp
I'm trying to create a script to remove all font tags from an HTML documents. I created a regular expression like this: ,[ working code | use strict; | use warnings; | my $foo =font whe; | $foo =~ tr/\.*font.*\//d; | print $foo, \n; `--- But, in order to remove tags from documents where the writers liked to use uppercase (or camel case) I want to make the search case insensitive. So I added an i like when I m/\.*font.*\/i font tags. So I had: ,[ erronous code | use strict; | use warnings; | my $foo =font whe; | $foo =~ tr/\.*font.*\//di; | print $foo, \n; `--- This code produces the error: ,[ the error | Bareword found where operator expected at - line 4, near | tr/\.*font.*\//di syntax error at - line 4, near | tr/\.*font.*\//di `-- So what am I doing wrong and how do I make a case insensitive tr/// regexp? Thanks for your help, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How does perl compile functions
I'm curious how perl compiles functions internally. When the actual C code (or ASM equivalent or bytecode or whatever Perl uses) for a function is run, is there overhead to the function? Are functions inlined? Does perl lazy compile functions? (i.e. functions never used are never compiled and that is why errors suddenly pop up when using a function for the same time). Thanks in advance from a curious mind, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using perl interpreter interactively like python?
On Thu, 2003-11-20 at 14:25, Jeff Kowalczyk wrote: I'd like to open perl and execute a few commands interactively in the console. I learn a lot in python this way, and I need to understand some perl code. Did this kind of thing ever get added to perl? I assume you're talking about how you can type $ python and enter whatever you want into python, and have it execute when you hit control-D. The same thing works in Perl, just type $ perl -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]