Re: problem
The query string holds the contents of all variables passed to the script, not a single variable. It's a string. In the lines: $next = ++$current; $prev = --$current; what you're doing really is increment the value of $current and assign the new value to $next. Same thing for $prev which equals the new value of $current after decrementing it by one. Remove these 2 lines to see how the QUERY_STRING looks like before attempting to modify it. BTW: $next = ++$current is not the same as $next = $current + 1. It's the same as $current = $current+1; $next = $current; On Sat, 2 Jun 2001 20:29:18 -0700, Derek Duhon said: I have a print statement that prints out an html page, and after a lot of tinkering, I still can't get it to work. It prints out the html perfectly, but I can't seem to find a way for it to print the contents of the scalar statements. The print statement is encased in . Here is my source #!usr/local/bin/perl # #Program to generate endless webpage $current = $ENV{QUERY_STRING}; $next = ++$current; $prev = --$current; print Content-type: text/html\n\nHTMLHEADTITLEEndless!/TITLE/HEADBODY BGCOLOR = #00FONT COLOR = redH5$current/H5HR COLOR = redA HREF = endless?$prevPrevious Page/a | A HREF = endless?$nextNext Page/A/FONT/BODY/HTML; _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
remove from this list
This list if full of usefull info, but it's just out of control. How can I get removed from it? John
probably a simple matter but...
Hello all, I've constructed a perl script which takes number from a large text file and prints them as well as manipulates them later on. I've use a crude way of getting the data but it's working for one set of files but not the other. What happens is that it reads in the numbers until there is a negative number. When it reaches a negative number, it places the remaining text in that variable. Here's a sample of the text file and the program where that data should be read. #sample of the text Nitrogen 0.0 -5.78 0.0 0.0 0.0 #sample of the program. while(COMP2FILE){ if (/(Nitrogen) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) /) { if ($2 = 0.0) { $name = $1; $nitrogen1 = $2; $nitrogen2 =$3; $nitrogen3 = $4; $nitrogen4 = $5; $nitrogen5 = $6;}} } I thoguht placing the \- would get rid of the problem but it didn't. So, the end result is that $nitrogen1 = 0.0 and $nitrogen2 = -5.78 0.0 0.0 0.0. the other variables after that are undefined. If anyone can help out with this problem, that'd be great. Thanks for your help. Sincerely, Brent Buckalew
Re: Licensing (warning: plug included)
Hello, all, Adam Theo here; i didn't catch the first half of this thread, just the posts from the last digest. on the matter of compiling perl: this is something i have also been wanting to look into, for the reason of speeding up my programs, and being able to distribute my programs to people who don't have perl (probably because they are newbies to computers, and just want a program that works instead of having to install Perl5 and all required modules...). i plan to educate myself about this extensively. when i have educated myself, i plan to write it all up for my website. if anyone would like to be notified of it when it goes up, or contribute to it, just send to [EMAIL PROTECTED] and i'll notify you and include full credits for contributions. on the matter of GPL. that is a very good issue you bring up, mr. ghuloum. i have had questions about the GPL, and what happens if a person links (in various ways) his code to code covered by the GPL. now, to warn, plug follows, for a mailing list i am proud to host at my website. for newbies to open source, to help educate people on what open source and all it's parts are all about. # begin shameless plug: well, to start off, i am the proud host of two mailing lists, both started from ideas on the free-software-business list on crynwr.com. the first, is a list for newbies to open source. it is to help educate people on open source, it's philosophy, it's licenses, and all other issues. it is for people who are not familiar with the open source world and want to learn more about it. the purpose is much like this list, except it deals with open source in general, and not a programming language. an issue i want to bring up soon on it is to talk about the GPL and how projects using code (in various ways) covered by it can be affected. Robin Lavallee: if you are interested in mr Gholoum's GPL issue, i encourage you to consider subscribing. Abdulaziz Ghuloum: the list can use a good expert (really just someone who knows more than the newbies, and can put in a few cents). i'd be obliged if you would consider participating. the list is called The Bazaar List, named after Eric S Raymond's essay 'the cathedral and the bazaar', and it's website is at: http://www.theoretic.com/bazaar to subscribe: [EMAIL PROTECTED] thank you all. # end shameless plug # exhale, breath, sigh. :) -- /\--- Adam Theo --- //\\ Theoretic Solutions (www.Theoretic.com) /\ Software, Politics, and Advocacy /--||--\ email: [EMAIL PROTECTED] AIM: Adam Theo 2000 ||jabber: [EMAIL PROTECTED] ICQ: 3617306 || Did you ever get the feeling the world was a tuxedo, || and you were a pair of brown shoes?
Overloading
I have a module which overloads a few operators snippet: use overload + = \addoffset, - = \subtractoffset, q() = \printit; the functions are called OK when I code: $obj + 7; print $obj; ...although I get a Perl warning saying addition is useless which I would expect. Is this like saying resistance is futile? Anyway, if I simply change the + to += ( and do $obj += 7 ) the print function no longer works correctly; it returns the offset embedded in the module rather than calling the overloaded function. Even if I allow Perl to magically make the += happen for me it still does the same (wrong) thing. Am I going mad? Richard
a trivial problem...
Hello all, I've constructed a perl script to extract certain lines of data and print them out and use them in a later analysis. The catch I've run into is that the style I used for the first batch doesn't work for the second. I was wondering if any of you had a better/different way of getting the information. Anyway, here's a portion of the input file. I've added the to highlight the perl script or input files. Nitrogen 0.0 -5.78 0.0 0.0 0.0 Here's where the above text is read in. while(COMP2FILE){ if(/(Nitrogen) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*)/) { if ($2 = 0.0) { $name = $1; $nitrogenc1 = $2; $nitrogenc2 =$3; $nitrogenc3 = $4; $nitrogenc4 = $5; $nitrogenc5 = $6;}} } What it's doing with the data is that it'll read in the numbers up to the first negative number, then it just gives up and doesn't assign the -5.78 to $nitrogenc2 in the example above. I thought that adding the \- in the if conditional would correct the problem but it didn't. If you have any suggestions for this problem, that'd be great. Just two facts of improtance: (1) this is my first perl script and (2) I'm an astronomer and not a computer programmer. The above is probably uaesthetically pleasing but it just has to run. Thanks for your help! Sincerely, Brent Buckalew
Re: perl to build html
On Sun, 3 Jun 2001, KeN ClarK wrote: I bought O'Reilly's PERL In A Nutshell last evening and have been lurking here for awhile. I'm curious if any answers exist for this question: I want to take mp3's in a directory and create html page with href links to these files. There are far too many of them to just create the page raw. Assuredly this can be done. W/Linux, I've figured out how to recreate the page all the way to reading the *.mp3 contents...but then I get stuck. I have limited language experience. Any suggestions? Try using Apache::MP3 (available on CPAN) if you want to make a streaming MP3 server. If you want just a directory listing, Apache has the built-in feature of listing files in a directory if there's no index file. You should also use http://search.cpan.org and search for MP3; that might give you something useful. If you want to use Perl in a plain CGI, something like this in your CGI will be what you want: opendir (DIR, '/my/mp3/dir') or die; while (defined ($file = readdir (DIR) )) { print A HREF='$file'$file/A\n; } (This isn't complete code, but it should be a start. I used the *Perl Cookbook* to find it.) srl -- Shane R. Landrum [EMAIL PROTECTED] we generate our own light to compensate for the lack of light from above -AD GPG public key: http://cs.smith.edu/~slandrum/srl_pgpkey.txt
Re: probably a simple matter but...
On Jun 3, M.W. Koskamp said: #sample of the text Nitrogen 0.0 -5.78 0.0 0.0 0.0 #sample of the program. while(COMP2FILE){ if (/(Nitrogen) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) /) { if ($2 = 0.0) { $name = $1; $nitrogen1 = $2; $nitrogen2 =$3; $nitrogen3 = $4; $nitrogen4 = $5; $nitrogen5 = $6;}} } I thoguht placing the \- would get rid of the problem but it didn't. So, the end result is that $nitrogen1 = 0.0 and $nitrogen2 = -5.78 0.0 0.0 0.0. the other variables after that are undefined. (Nitrogen) will match Nitrogen \s* will match any number of spaces ([0-9.\-]*) will match the largest sequence of any character since there is a dot in the expression. No; a . inside a character class is not special at all. Brent, I suggest you change your / */ to /\s+/ (which matches any type of whitespace, not just space), and the /([0-9.\-]*)/ to something a bit more robust too, like /(-?\d+\.\d+)/, because if you know there'll always be a decimal point and a number after it, you can be that specific. Then again, you might just want to use the split() function: while (FILE) { my @fields = split; # this is like: split(' ', $_) if ($fields[0] eq 'Nitrogen' and $fields[1] = 0) { # do stuff here } } It's my guess that some of those spaces are really tabs... On another note, Mark-Jason Dominus has a talk he gives about red flags -- things in your program that should alert you to probable places where your program could be improved. One such flag is the use of families of variables: my ($foo1, $foo2, $foo3, $foo4) = (...); would be much better written (in 90% of cases) as my @foo = (...) which are then accessed as $foo[0], $foo[1], etc. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734 ** Manning Publications, Co, is publishing my Perl Regex book **
Re: Overloading
On Jun 3, Richard Hulse said: I have a module which overloads a few operators snippet: use overload + = \addoffset, - = \subtractoffset, q() = \printit; Even if I allow Perl to magically make the += happen for me it still does the same (wrong) thing. Are you doing that via: fallback = 1 in the argument list to 'use overload'? That's how the implicit definitions of operators work. It works for me: #!/usr/bin/perl -wl use overload ( '+' = \add, '+0' = \num, '' = \num, fallback = 1, ); sub add { my ($l, $r, $swap) = @_; ($l, $r) = ($r, $l) if $swap; my $sum = (ref($l) ? $l-[0] : $l) + (ref($r) ? $r-[0] : $r); return $sum; } sub num { $_[0][0] } $x = bless [ 10 ], 'main'; print $x; # 10 print $x + 3; # 13 $x += 6; print $x; # 16 __END__ -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734 ** Manning Publications, Co, is publishing my Perl Regex book **
Re: $str++ $str--
On 03 Jun 2001 11:18:57 AST, Abdulaziz Ghuloum said: oops, $str should be 'ab9' not 'ab1' in this example. $str = 'ab1'; $str++; print $str\n; # can you take a guess? Answer: 'ac0' _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: a trivial problem...
Well you could do it this way, if you're trying to read each line and process the same way (Assuming you only want lines starting with Nitrogen, and the lines are all structured the same): ## START while(COMP2FILE){ if (/^Nitrogen/) { @List = split (/\s+/); if ($List[1] = 0.0) { $name = $List[0]; $nitrogenc1 = $List[1]; $nitrogenc2 = $List[2]; $nitrogenc3 = $List[3]; $nitrogenc4 = $List[4]; $nitrogenc5 = $List[5]; #Do what you will } } } # END Or if you want to act on each line regardless of what it starts with: #START: while(COMP2FILE){ @List = split (/\s+/); if ($List[1] = 0.0) { $name = $List[0]; $nitrogenc1 = $List[1]; $nitrogenc2 = $List[2]; $nitrogenc3 = $List[3]; $nitrogenc4 = $List[4]; $nitrogenc5 = $List[5]; #Do what you will } } # END Hope that helps, Greg --- Brent Alan Buckalew [EMAIL PROTECTED] wrote: Hello all, I've constructed a perl script to extract certain lines of data and print them out and use them in a later analysis. The catch I've run into is that the style I used for the first batch doesn't work for the second. I was wondering if any of you had a better/different way of getting the information. Anyway, here's a portion of the input file. I've added the to highlight the perl script or input files. Nitrogen 0.0 -5.78 0.0 0.0 0.0 Here's where the above text is read in. while(COMP2FILE){ if(/(Nitrogen) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*)/) { if ($2 = 0.0) { $name = $1; $nitrogenc1 = $2; $nitrogenc2 =$3; $nitrogenc3 = $4; $nitrogenc4 = $5; $nitrogenc5 = $6;}} } What it's doing with the data is that it'll read in the numbers up to the first negative number, then it just gives up and doesn't assign the -5.78 to $nitrogenc2 in the example above. I thought that adding the \- in the if conditional would correct the problem but it didn't. If you have any suggestions for this problem, that'd be great. Just two facts of improtance: (1) this is my first perl script and (2) I'm an astronomer and not a computer programmer. The above is probably uaesthetically pleasing but it just has to run. Thanks for your help! Sincerely, Brent Buckalew __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
don't understand word boundary
on page 83 of Learning Perl, they give a regex example: /abc\bdef/; #never matches (impossibe for a boundary there) Could someone please explain this to me clearly so I can actually understand word boundaries? thanks... __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
RE: don't understand word boundary
Hey, Ok, basically a word boundary is considered something that could be in a traditional word, surround by something that can't be in a word (spaces, tabs, non-printable chars, etc). The equivalent of specifying a word boundary would be roughly the following regex: /[^a-zA-Z0-9-_][a-zA-Z0-9-_]+[^a-zA-Z0-9-_]/ Something that's not in a word, followed by something in a word, followed by something not in a word. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 03, 2001 12:11 PM To: [EMAIL PROTECTED] Subject: don't understand word boundary on page 83 of Learning Perl, they give a regex example: /abc\bdef/; #never matches (impossibe for a boundary there) Could someone please explain this to me clearly so I can actually understand word boundaries? thanks... __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
RE: don't understand word boundary
At 12:14 PM 6/3/2001 -0400, Eduard Grinvald wrote: The equivalent of specifying a word boundary would be roughly the following regex: /[^a-zA-Z0-9-_][a-zA-Z0-9-_]+[^a-zA-Z0-9-_]/ Something that's not in a word, followed by something in a word, followed by something not in a word. Sorry, this is too inaccurate. The whole reason we have \b instead of \W is that it can match a boundary at the beginning or end of the string. \b means a place (zero width) which has a word character on one side and not a word character on the other side. not a word character includes the possibility of the string boundary. Therefore abc\bdef could never match, because it asserts that there is a word boundary between the characters c and d, which are both word characters.
Re: don't understand word boundary
You == [EMAIL PROTECTED] writes: You on page 83 of Learning Perl, they give a regex You example: You /abc\bdef/; You #never matches (impossibe for a boundary there) You Could someone please explain this to me clearly so I You can actually understand word boundaries? First, understand what anchors do. ^ means beginning of string, but itself does not take up any space. It merely asserts that at this point in the string, for this regex to match, we must have this condition true: beginning of string. So, can you at least see that /abc^def/ could never match? Because we would never be at the beginning of string after we've matched a b c. Now, let's look at \b in the same light. \b says I've got \w on one side, and either \W or the edge of the string on the other. It itself is of no width; it's merely a condition like ^. Back to /abc\bdef/, if you're just having matched a b c, then certainly you've got a \w on one side (letter c), so for \b to match, it's gotta have \W or edge of string on the other. But if that's true, you can't have a d next, because that's neither \W nor edge of string! Does that help? I think we say this differently in llama3, but the text isn't directly in front of me, sorry. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: perl2exe
Jody == Jody Lowes [EMAIL PROTECTED] writes: Jody On Sunday 03 June 2001 10:26, you wrote: And perl2exe isn't. It's an installer maker, not a compiler. Jody I haven't installed it yet but this is from the readme file: So let's look at the lies or truth-stretching... Jody About This Program Jody Perl2Exe is a command line utility for converting Perl scripts Jody to executable files. In the sense that an installer is an exe, yes. In the implication that it speeds your programs up, no. A Perl script is already an executable file, anyway, so that's a bit like saying this magic wand converts your car into a intracontinental transportation device! Jody This allows you to create stand alone programs in perl that do Jody not require the perl interpreter. Right, because it installs all of the Perl interpreter needed to run your program. So what's missing there and therefore implied is the appended previously installed. It installs one distinct perl interpreter, albeit in a private place that you can't use with other Perl source codes. Jody You can also ship the executable file without having to ship Jody your perl source code. Right, because it ships your source code right there in the exe file, trivially extracted. Apparently, they don't even attempt to obfuscate that. Jody Perl2Exe also allows you to create no-console programs using Tk. As does Perl-TK if you install it. Jody Perl2Exe for Unix can generate executables for supported Unix Jody machines. For which you have the precise binary/source configuation. Unix runs on dozens of platforms, and with a non-trivial number of variant binary architectures on each. Jody Perl2Exe for Unix can also be used from a Win32 Jody host to generate executables for a Unix target host. Really? You'd need a helluva lot of cross compilation environment to do that. Jody This document covers all versions of Perl2Exe up to V5.xx. Where Jody there are differences between versions, the differences are Jody noted in the text.Usage: Jody perl2exe myscript.pl Jody This will convert a script named myscript.pl to myscript.exe. And just watch the size... :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: perl2exe
And perl2exe isn't. It's an installer maker, not a compiler. I haven't installed it yet but this is from the readme file: # Copied from pxman.html About This Program Perl2Exe is a command line utility for converting Perl scripts to executable files. This allows you to create stand alone programs in perl that do not require the perl interpreter. You can also ship the executable file without having to ship your perl source code. Perl2Exe also allows you to create no-console programs using Tk. Perl2Exe for Unix can generate executables for supported Unix machines. Perl2Exe for Unix can also be used from a Win32 host to generate executables for a Unix target host. This document covers all versions of Perl2Exe up to V5.xx. Where there are differences between versions, the differences are noted in the text.Usage: perl2exe myscript.pl This will convert a script named myscript.pl to myscript.exe. # end copied text
Re: $str++ $str--
On Jun 3, Abdulaziz Ghuloum said: Incrementing and decrementing strings are quiet puzzling to me. I don't seem to figure out the rationale behind the use of the increment (++) and decrement (--) operators when it comes to strings. Let me illustrate: Here's the short answer: Auto-increment (++) is magical for strings; auto-decrement is not. What does magical mean? It means that you can go from perl to pern in two easy steps: $x = perl; $x++; $x++; print $x; Note that you can't use $x += 2 there, since that is numerical addition, not the magical auto-increment operator. Maybe you can make out a rule for what happens in every case (just like the nested if-statements in the code Perl_sv_inc at sv.c lines 4605-4725 of the stable perl-5.6.1 distribution). Or just read 'perldoc perlop' for the information about ++ vs. -- Auto-increment and Auto-decrement ++ and -- work as in C. That is, if placed before a variable, they increment or decrement the variable before returning the value, and if placed after, increment or decrement the variable after returning the value. The auto-increment operator has a little extra builtin magic to it. If you increment a variable that is numeric, or that has ever been used in a numeric context, you get a normal increment. If, however, the variable has been used in only string contexts since it was set, and has a value that is not the empty string and matches the pattern /^[a-zA-Z]*[0- 9]*$/, the increment is done as a string, preserving each character within its range, with carry: print ++($foo = '99'); # prints '100' print ++($foo = 'a0'); # prints 'a1' print ++($foo = 'Az'); # prints 'Ba' print ++($foo = 'zz'); # prints 'aaa' The auto-decrement operator is not magical. It even tells you HOW the string must match in order to be treated as a string for auto-increment's magic. a11 is valid, but a1a is not. As to why -- is not magical, what is a--? -a? Maybe. But then, aa-- is z, so why isn't a-- ? It's confusing, and hardly useful. Magical ++ is more useful. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734 ** Manning Publications, Co, is publishing my Perl Regex book **
using print within subroutines
hello all- quick question that is definitely from a neophyte. i am currently using: sub begin { print Content-type: text/html\n\n; print html\n; print headtitleControl Panel/title/head\n; print body bgcolor=white\n; } sub footer { print /body\n; print /html\n; } within my code. it works like a charm. however, when i try: sub header { print head; Content-type: text/html\n\n html headtitleControl Panel/title/head body bgcolor=white head } is this not working because of a fault in my syntax? or is this not possible within perl? thanks! -charles
Re: using print within subroutines
[EMAIL PROTECTED] wrote: within my code. it works like a charm. however, when i try: sub header { print head; Content-type: text/html\n\n html headtitleControl Panel/title/head body bgcolor=white head } is this not working because of a fault in my syntax? or is this not possible within perl? You should be getting an error like: Can't find string terminator anywhere before EOF at ./foo.pl line nnn. because your statement is being evaluated as print ; (and head is being taken as a bareword) which is half-way clear from the error given above, and would surely be clear if you were using the -w switch. If you really want to end on head, go ahead and do that; or end on head and remove the leading spaces later on. One moral of this story is that the -w switch alerts you very quickly to a great many problems. Somebody once said it is a bug that the -w switch isn't mandatory (cf. man perl). Christian __ 117 NW 15th Street # S107[EMAIL PROTECTED] Gainesville, FL 32603-1973 (352) 392-0851
Re: Overloading
Hi Jeff, Thanks. According to the man pages Perl automatically substitutes + for += without fallback. The problem is that even if I substitute the += method for + it still doesn't work. Somehow $obj gets turned into the offset amount. I have spent several hours with the debugger trying to find where this happens. Any other clues? regards, Richard At 10:47 3/06/2001 -0400, Jeff Pinyan wrote: Are you doing that via: fallback = 1 in the argument list to 'use overload'? That's how the implicit definitions of operators work. It works for me:
Re: perl2exe
BTW, I never said I used this product, if even why I would want to use it. I never assumed it did a good job, or even a bad job for that matter. I never said that is made the programs run faster, or even spoke of the size of the resulting exe. The question was whether or not it 'compiled' in the sense that you don't need any runtime libraries to run the exe. I find this answer to be yes. The copied text is directly from the info in the package I downloaded. On Sunday 03 June 2001 11:41, you wrote: Jody == Jody Lowes [EMAIL PROTECTED] writes: Jody On Sunday 03 June 2001 10:26, you wrote: And perl2exe isn't. It's an installer maker, not a compiler. Jody I haven't installed it yet but this is from the readme file: So let's look at the lies or truth-stretching... Jody About This Program Jody Perl2Exe is a command line utility for converting Perl scripts Jody to executable files. In the sense that an installer is an exe, yes. In the implication that it speeds your programs up, no. A Perl script is already an executable file, anyway, so that's a bit like saying this magic wand converts your car into a intracontinental transportation device! Jody This allows you to create stand alone programs in perl that do Jody not require the perl interpreter. Right, because it installs all of the Perl interpreter needed to run your program. So what's missing there and therefore implied is the appended previously installed. It installs one distinct perl interpreter, albeit in a private place that you can't use with other Perl source codes. Jody You can also ship the executable file without having to ship Jody your perl source code. Right, because it ships your source code right there in the exe file, trivially extracted. Apparently, they don't even attempt to obfuscate that. Jody Perl2Exe also allows you to create no-console programs using Tk. As does Perl-TK if you install it. Jody Perl2Exe for Unix can generate executables for supported Unix Jody machines. For which you have the precise binary/source configuation. Unix runs on dozens of platforms, and with a non-trivial number of variant binary architectures on each. Jody Perl2Exe for Unix can also be used from a Win32 Jody host to generate executables for a Unix target host. Really? You'd need a helluva lot of cross compilation environment to do that. Jody This document covers all versions of Perl2Exe up to V5.xx. Where Jody there are differences between versions, the differences are Jody noted in the text.Usage: Jody perl2exe myscript.pl Jody This will convert a script named myscript.pl to myscript.exe. And just watch the size... :)
Re: Overloading
Jeff, I have sussed it. Page 353 of the Camel book says of the += operator the result is assigned to the left hand operand... The result of the '+ 1' method call is that a number in $self is modified. The last line of the method is: $self-{_time_offset} = $offset; ...which is fine until the return from that method is assigned with += (this assigns $offset to whatever). So I added: return $self; in the function and bingo, it works as expected! Perl did the right thing. I just didn't realise it. A trap for new players( like me ): Watch what your methods return when using assignment operators. Duh! Thanks for your help. Richard At 10:47 3/06/2001 -0400, Jeff Pinyan wrote: Are you doing that via: fallback = 1 in the argument list to 'use overload'? That's how the implicit definitions of operators work. It works for me: #!/usr/bin/perl -wl use overload ( '+' = \add, '+0' = \num, '' = \num, fallback = 1, ); sub add { my ($l, $r, $swap) = @_; ($l, $r) = ($r, $l) if $swap; my $sum = (ref($l) ? $l-[0] : $l) + (ref($r) ? $r-[0] : $r); return $sum; } sub num { $_[0][0] } $x = bless [ 10 ], 'main'; print $x; # 10 print $x + 3; # 13 $x += 6; print $x; # 16 __END__
Re: perl2exe
[I'm not sure where to tack this on. Please don't put any significance on how I'm attaching this to the thread. Also, I sent the same material earlier today, but I think it went off into never-never-land. If you receive this twice, my apologies.] There is a lot of noise on this channel about perl2exe. I feel obligated to throw in what I know. I'm a little upset by this as this is my first post to the list, and I would much prefer to sit back and see how the list functions before I speak up. But serious disinformation needs to be countered if this list is to serve its purpose. I have used perl2exe successfully in a mixed Win98, WinNT environment. There was a need to use a perl script I wrote on my personal Win98 machine on a number of WinNT machines on a secure network. Installing Perl itself and running the script directly was out of the question: this would have created an unacceptable security risk. It also would have been a headache to maintain, since the wetware in that environment is not reliable in either intelligence or intent. My original script was 12 kb, and used Perl/Tk. Perl2exe compiled it into a 1.6 Mb program, which archived to about 850 kb using WinZip (for transport and installation). These are acceptable sizes for stand-alone Windows apps. Note that the fixed overhead for perl2exe is around 1.5 Mb: a script ten times longer than mine could be expected to compile to under 1.7 Mb. Perl2exe does compile the script into a binary executable complete with the needed routines pulled out of the Perl installation. The result is a true binary compilation of the script, which is functionally no different than what Perl itself does in compiling the script internally whenever the script is run. The source script cannot be extracted from the result of perl2exe. (Well, you could reverse-engineer the thing, but if you've got that level of skill, you likely have half a dozen more satisfying projects to work on than hacking somebody else's stuff). The executable binary will be large, but it will be a fraction of the size of a full Perl installation (especially if that includes all the documentation that should go with Perl). The resulting exe runs as fast as the original Perl script, and no faster. However the perl2exe executable does not undergo the preparatory phases of loading Perl itself, then the script, then doing the compiling phase, so depending on what the application does, the perl2exe product will appear to be faster to the average user. That was the case in my application. But it is doubtful that reducing the loading time from maybe 0.3 seconds to something faster is meaningful. Perl2exe does a good job of what it does. Don't look for it to speed up your programs. Don't look for its executables to be small little things. Do consider it when you want to provide software to someone who shouldn't have or wouldn't want a full Perl installation on their machine. Do consider it if you want to keep your source code proprietary. It is a good product, and worth its low cost in some situations. --Will
Re: installing perl
Gil Tucker [ateliermobile] schrieb am 2001-05-30, 10:09: Hi everybody, Does anybody knows the fastest and easiest way tzo install Perl on Get IndigoPerl HERE: http://www.indigostar.com/ Apache already included. -gph -- =^..^=
Re: 'while' confusion
E. Alan Hogue schrieb am 2001-05-30, 20:56: Instead of this: foreach $field (@fld_vals) { while ($field = '') { you want that: == while ($field == '') { # '==' for ints, 'eq' for strings push (@nulls,$id); } } [...] while statement was actually _assigning_ '' to each according to this statement. -gph -- =^..^=
Re: unknown CPAN variables
Paul Cotter schrieb am 2001-05-31, 16:28: Can someone explain the following. The file /etc/inputrc certainly has the 'wrong' lines in it, but I am loathe to delete them without understanding what I am doing. (mmm, I wonder where I screwed up..) As the error messages show, you should choose between [On Off] as variables setting, look it the cases are correct, i suggest you'll find: meta-flag=on or s.th like that and not: meta-flag=On [root@prc /root]# perl -MCPAN -e shell Warning [/etc/inputrc line 4]: Invalid value `on' for variable `meta-flag'. Choose from [On Off]. Warning [/etc/inputrc line 5]: Invalid value `on' for variable `input-meta'. Choose from [On Off]. Warning [/etc/inputrc line 6]: Invalid value `off' for variable `convert-meta'. Choose from [On Off]. Warning [/etc/inputrc line 7]: Invalid value `on' for variable `output-meta'. Choose from [On Off]. cpan shell -- CPAN exploration and modules installation (v1.59) ReadLine support enabled -- Regards - Paul Cotter Regards - Paul Cotter -- =^..^=
Re: doubt about do/until
[EMAIL PROTECTED] schrieb am 2001-05-31, 18:30: Hi gurus, In http://www.cpan.org/doc/FMTEYEWTK/is_numeric.html, ( Is it a number? ), Tom Christiansen writes: -- If you do care about getting 0's, then do this: do { print Number, please: ; $answer = STDIN; if ($answer == 0 $answer ne '0') { print Bad number\n; } } until $answer; -- I tried this with ActiveState perl version 5.005_03. I entered 0 and got a bad number. After thinking awhile, I chomped the $answer. This works for 0, ( i.e. No Bad number message and the loop repeats ). I think we need a chomp there ( so instead of '0\n' ne '0', it is '0' ne '0' ). Is it so or am I missing something? I'm thinking about what it is doing ... If you enter a number, it exits, if you enter a zero it gives you a Bad number, as it is if you enter some non-digits. So, what is a number??? Obviously zero is no number, that is all this script is doing, checking your input, if it is a number. $ dountil.pl Number, please: 123 Siebenschlaefer@LORELEY ~/script $ dountil.pl Number, please: 0 Bad number Siebenschlaefer@LORELEY ~/script $ dountil.pl Number, please: 478 Siebenschlaefer@LORELEY ~/script $ dountil.pl Number, please: sdf Bad number -gph -- =^..^=
Re: perl2exe
prachi shroff schrieb am 2001-06-01, 11:04: Hi! I am tying to use the Perl2exe utility but am getting an error : Invalid Platform :win32 . I am running Win2000 and installed the exact versions recommended for the Perl I am using. Any suggestions on this will be great help. Indigo distributes perl2exe for several different platforms: http://www.indigostar.com/ -gph -- =^..^=
Graphics module gor perl
Hi All, Does anybody know, worked with , an easy to use perl module that can create graphs and graphical images I tried installing GD::graph but I have to install much more libs back. maybe there is a simpler module
Need to submit a form
Hi All I need to write an application that submits a form to a www site and accepts the return code. I have a URL I need to call and pass parameters as if I had submitted a HTML form. This URL will then return several values that I must evaluate and act on. I can write basic Perl and CGI applications although I have limited experience with modules but am unsure how to proceed. Actually everything I have done with Perl has been CGI. Can someone point me at the appropriate place to start reading? Is there a module I need to use? Thanks for any pointers Kevin
Re: Need to submit a form
Kevin == Kevin Hancock [EMAIL PROTECTED] writes: Kevin Hi All Kevin I need to write an application that submits a form to a www site and Kevin accepts the return code. I have a URL I need to call and pass Kevin parameters as if I had submitted a HTML form. This URL will then Kevin return several values that I must evaluate and act on. Kevin I can write basic Perl and CGI applications although I have limited Kevin experience with modules but am unsure how to proceed. Actually Kevin everything I have done with Perl has been CGI. Kevin Can someone point me at the appropriate place to start reading? Kevin Is there a module I need to use? perldoc lwpcook if that doesn't work, install LWP, and try again. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Counter problem
Hallo and thanks for your help I ran the following from my index.htm !--#exec cmd=/home/homepage/cgi-bin/counter.pl -- with the space-- as you suggested result: nothing was returned to the htm page Error log said: [Sun Jun 3 22:28:48 2001] [error] [client 208.46.234.171] File does not exist: /var/www/html/homepage.com/home/homepage/cgi-bin/counter.pl [Sun Jun 3 22:28:48 2001] [error] [client 208.46.234.171] unable to include /home/homepage/cgi-bin/counter.pl in parsed file /var/www/html/homepage.com/index.htm # then i ran !--#exec cgi=/home/homepage/cgi-bin/counter.pl -- with the space-- and changed the cmd to cgi result in my index.htm [an error occurred while processing this directive] Error log said: [Sun Jun 3 22:30:34 2001] [error] [client 208.46.234.171] invalid CGI ref /home/homepage/cgi-bin/counter.pl in /var/www/html/homepage.com/index.htm # I think it a server problem as i have many pages that have worked for MONTHS with: !-counter-- centerVotes !--#exec cmd=/home/homepage/cgi-bin/counter.pl-- /center and now when i use the view-source to see the code send to me i get: !-counter-- centerVotes /center A number used to appear here after centerVotes on the now blank line. I'm convinced its a command call or server error due to changes by my server anyone else on this thanks L H - Original Message - From: Me To: Luinrandir Hernson Sent: Sunday, June 03, 2001 1:33 AM Subject: Re: Counter problem I think I just spotted why it isn't working. You are using a line something like: !--#exec cmd=/home/homepage/cgi-bin/counter.pl-- Right? You need a space before the -- at the right hand end. In case that isn't it, here's some more notes. You are using cmd= rather than cgi=. That might be an issue. I ran it on active perl and it works just fine. Good. This means you should push your sysadmin for why he said: the program is not even being run because of the problem in the code abort the whole thing. Another idea. Perhaps the script is running fine but the html is not coming out quite right. Take a look at the html source. Is the counter html fragment in there? (Perhaps the ssi command is there; that would mean the server isn't even processing the ssi command.)