Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re^5: PDF::Create Questions

by peppiv (Curate)
on Apr 09, 2003 at 15:54 UTC ( #249272=note: print w/ replies, xml ) Need Help??


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

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/Create.pm 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!

peppiv


Comment on Re: Re^5: PDF::Create Questions
Select or Download Code
Re^7: PDF::Create Questions
by tall_man (Parson) on Apr 09, 2003 at 17:09 UTC
    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.

      peppiv

Re7:PDF::Create Questions
by dragonchild (Archbishop) on Apr 09, 2003 at 17:40 UTC
    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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2014-07-30 19:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (240 votes), past polls