Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^5: PDF::Create Questions

by tall_man (Parson)
on Apr 09, 2003 at 15:08 UTC ( #249235=note: print w/replies, xml ) Need Help??

in reply to Re: Re^3: PDF::Create Questions
in thread PDF::Create Questions

You are not being specific about what you mean by "I fail" and "it doesn't work." What's the error message?

Using the file that came with the PDF::Create module, I was able to overwrite an existing pdf file with no problem at all. I can't imagine what is going wrong unless there is something strange about "/html"... Try creating and overwriting in a local directory instead.

Replies are listed 'Best First'.
Re: Re^5: PDF::Create Questions
by peppiv (Curate) on Apr 09, 2003 at 15:54 UTC
    My apologies. I let my frustration get the better of me sometimes. Appreciate the patience.

    I can easily create a file using this:
    my $pdf = new PDF::Create ('filename' => '../html/logs/mypdf.pdf', 'PageMode' => 'UseNone', 'Title' => 'Anything', );
    If I use this:
    my $pdf = new PDF::Create "> ('filename' => '../html/logs/mypdf.pdf', 'PageMode' => 'UseNone', 'Title' => 'Anything', )";
    It doesn't create a pdf. And it doesn't overwrite the existing one. I tried using a local directory and it made no difference.

    This is the error message I get when I run the second piece of code.

    Odd number of elements in hash assignment at /usr/lib/perl5/site_perl/5.6.1/PDF/ line 28.

    When I placed the '>' symbol in different parts of the line I would get 'syntax error in line ...... around '>'.."

    I know I'm missing something small here, and I just can't seem to find it. Any ideas are welcome. (Except "don't quit your day job"!) I like learning Perl!


      You are not understanding what the lines of code are going to do. You're trying to randomly come to a solution that will work long enough for you to tell your manager the problem is solved. While this problem-solving method has merit, especially if you're not a programmer by trade, it most definitely ... lacks completeness.

      First, you have to stop writing code. Yes, this means that you need to step away from the computer.

      Next, take a minute and actually attempt to understand what you're trying to do. Write it out on paper or a whiteboard or something. Lay out every single step, both in terms of business logic and then translate those business steps into programming steps. There will be a N to M relationship between them.

      At this point, look at the tools you have (PDF::Create, for example) and see what the documentation says for how to do something. If there is a language construct you don't understand (like Perl OO, for example), pick up a copy of an appropriate book (Damian's OO Perl or the Camel book) and learn the necessary language features.

      Now, at this point AND ONLY THIS POINT are you ready to actually write any code. Not only will you know what you want to write, but you'll also know how to write it. Syntax errors will become a thing of the past (other than typos).

      If this sounds like overkill - that's because this is repeatable, provable applications development. Not HaX0r1SiNg.

      We are the carpenters and bricklayers of the Information Age.

      Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

      Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      Your first block of code is correct, and it will overwrite the old file automatically. That's all there is to it.

      You are scaring me with your creative uses of ">", and now I wish I had never shown you that line. As I keep trying to tell you, the "new PDF::Create" call does that for itself.

        Thanks for the help tall_man. The first line of code does overwrite. It didn't before. The only thing I changed was the path. I used the ../html/logs/mypdf.pdf instead of /var/www/html/log/mypdf.pdf.

        BTW, Love Santa Fe. I stop in for lunch on my way to ski Taos. Much more interesting than this Orlando shallow city I live in.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://249235]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2021-06-15 00:48 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (66 votes). Check out past polls.