Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. obscurifer

    Cygwin vs. ActiveState Perl and Newlines

    I fixed it. I needed to use this line before the loop. binmode STDOUT; I'm still confused why this affects the explicit output of specific characters rather than simply affecting aliases like "\n" is something I'd be interested in finding out.
  2. obscurifer

    Cygwin vs. ActiveState Perl and Newlines

    I'm looking for a simple (or simple-minded) way to convert a text file from DOS-ish CR/LF end-of-line pairs to Unix-ish LF end-of-line characters. It should be pretty straightforward, since Perl contains a robust pattern matching facility. So here's my code. #! /usr/bin/perl while($line =...
  3. obscurifer

    PDF::Create

    At one time, I needed to create PDFs from HTML to deliver on an intranet. Because I'm a big fan of TMTOWTDI, I did the following steps. (Keep in mind that I was more of a neonate at the time.) 1. Use my CGI Perl script to create the HTML. 2. Write the same HTML to a file. 3. Use html2ps...
  4. obscurifer

    numbers

    You can also use the ceil() and floor() functions in the POSIX module. Example: ========= use POSIX; print floor(3/2) . "\n" . ceil(3/2) . "\n"; ========= This doesn't exactly round the number, but it does return the floor and ceiling.
  5. obscurifer

    Getting first and last line of a file into a $

    If the file is too big to fit in memory at one time, you can try this solution. ================== $firstline = &quot;&quot;; $lastline = &quot;&quot;; open IPF, &quot;filename&quot; or die &quot;Error opening input file: $!&quot;; $firstline = <IPF>; while(<IPF>) {$lastline = $_;}...
  6. obscurifer

    problem whith Net::SMTP

    Coderifous Wins! obscurifer is defeated.
  7. obscurifer

    problem whith Net::SMTP

    I think the addresses might need to be separated by a semicolon instead of a comma.
  8. obscurifer

    taking year out of localtime function.

    You could try something like splitting the date string on the space character, then pop the last element off the existing array, then join the array back together with spaces, then print the string. It's a little messy, but it works. ============ $thetime = scalar localtime; @timearray = split...
  9. obscurifer

    Simple syntax question.

    If the $date variable exists in a block that also includes the format_date() function, you should be able to modify $date directly within the function. All of the object lovers out there are cringing right now, though. The OO way to do it would be to make an object that had a format_date()...
  10. obscurifer

    Perl and 2GB files

    Perl 5.6 and higher support large files. Here's an excerpt from the perl56delta documentation file. =========== Large file support If you have filesystems that support ``large files'' (files larger than 2 gigabytes), you may now also be able to create and access them from Perl. NOTE: The...
  11. obscurifer

    HTML for opening in new tab

    Is there any extension to HTML that Mozilla uses to open pages in a new tab? This would be analagous to the <A HREF='whatever' target='_new'> construction that's commonly used to open pages in a new window. Oddly, though, a quick read of the HTML 4.01 spec didn't show me _new. Thanks!
  12. obscurifer

    why use perl?

    Generally, Perl is designed to accomplish easy tasks in very few lines of code. For example, in a UNIX-ey type of environment, this code emulates the cat utility, assuming you redirect the input. ==== #! /usr/local/bin/perl while(<>) { print; } ==== For active web content, there are reasons...
  13. obscurifer

    Handling Win32 shutdown

    Heh. Plan B is usually RTM again. In my first attempt at this, I wrote a message handler in C, and wrote some functionality in Perl. The C program launched the Perl program at the time of shutdown. I may have to revert back to that plan. Thnaks for the help. If I do ever figure out the...
  14. obscurifer

    file manipulation help needed

    === while(<IMAGES>) {...} === The <> operator expects a filehandle, not a directory handle (I think - I couldn't find a definitive reference in 60 seconds of searching). Keep in mind that there's more than one way to do it, but when I have to process all files of a particular type in a...
  15. obscurifer

    Handling Win32 shutdown

    You know, that's a really good question. I wrote another script that uses Win32::Event->pulse() to send an arbitrarily named Windows event, and an appropriately configured script caught that event, but I'm guessing Windows doesn't pass events around by name.
  16. obscurifer

    Handling Win32 shutdown

    I got it from <I>Programming Windows 95</I>, by Charles Petzold (ISBN: 1-55615-676-6), and it also exists in the Cygwin WINDOWSX.H file. From the text of the book: ====== Windows begins sending every window procedure a WM_QUERYENDSESSION message when the user ends a Windows session. If any...
  17. obscurifer

    Handling Win32 shutdown

    I want to write a program in Perl that sits and waits for Windows to shut down, then does something. I know that I have to use the Win32::Event module, and I have some code that I've written here. ======== use Win32::Event; $manual = 0; $initial = 0; $name = &quot;WM_QUERYENDSESSION&quot...
  18. obscurifer

    compiling Java code together with &quot;virtual machine&quot;

    You mention that you can't start an applet by double-clicking and that there are VM-imposed restrictions on file access for applets. The first point is true for both Java applets and applications, but the second point isn't true for Java applications. Java applications running on the local...
  19. obscurifer

    &quot;parallel port&quot;

    I'm not quite sure about that. It might be possible to open the parallel port twice - once for reading, and once for writing. I'll see if I can try that out today. If you have any success before I post, please post a reply.

Part and Inventory Search

Back
Top